What is it? @.@

Here is the place where I record some tactics about wargame, systems, and other security issues.

2014-01-23

OverTheWire - Bandit - Level 8 to Level 9

Description:

Level Goal
The password for the next level is stored in the file data.txt and is the only line of text that occurs only once
Commands you may need to solve this level
grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd
Solution:
  1. [Comment] Using SSH to connect the server
  2. sp@simple-plan:~|=> ssh bandit8@bandit.labs.overthewire.org
    ...
    bandit8@bandit.labs.overthewire.org's password: cvX2JJa4CFALtqS87jk27qwqGhBM9plV
  3. [Comment] Using ls command to list directory contents
  4. bandit8@melinda:~$ ls
    data.txt
  5. [Comment] Using sort command to sort lines of data.txt first
  6. [Comment] Then, using uniq command with --count option to count number of duplicate lines
  7. [Comment] At last, using grep command to search for the only one line
  8. [Comment] Don't forget to pipe the commands together
  9. bandit8@melinda:~$ sort data.txt | uniq --count | grep "1 "
          1 UsvVyFSfZZWbi6wgC7dAFyFuR6jQQUhR
  10. [Comment] Using exit command to disconnect connection to server
  11. bandit8@melinda:~$ exit
    logout
    Connection to bandit.labs.overthewire.org closed.
  12. [Comment] It's done! Saving the password for next level.
Reference:
sshhttp://linuxcommand.org/man_pages/ssh1.html
lshttp://linuxcommand.org/man_pages/ls1.html
cathttp://linuxcommand.org/man_pages/cat1.html
exithttp://linuxcommand.org/man_pages/logout1.html
cdhttp://linuxcommand.org/lc3_man_pages/cdh.html
findhttp://linuxcommand.org/man_pages/find1.html
grephttp://linuxcommand.org/lc3_man_pages/grep1.html
sorthttp://linuxcommand.org/lc3_man_pages/sort1.html
uniqhttp://linuxcommand.org/man_pages/uniq1.html

4 comments:

  1. @ Scooge Santa: If uniq -u searches for the unique line in the whole file, then why do we need to sort the data.txt file?

    ReplyDelete
  2. @ Scooge Santa: If uniq -u searches for the unique line in the whole file, then why do we need to sort the data.txt file?

    ReplyDelete
    Replies
    1. -u doesnt searches for the unique line, it put all duplicated lines in one example:
      Aaaaaa
      Bbbbbb
      Aaaaaa
      Aaaaaa

      Uniq -u

      Aaaaaa
      Bbbbbb

      If you use uniq -u -c

      3 Aaaaaaa
      1 Bbbbbbb

      Delete