medium.com 1 min read Original Source

Bandit | Level 7→ 8| OverTheWire

OverTheWire: Level Goal
Edit description

Level Goal

_The password for the next level is stored in the file data.txt next to the word _millionth

Commands you may need to solve this level

grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd

grep — Searches text inside files for specific patterns or keywords.

sort — Sorts lines of text alphabetically or numerically.

uniq — Removes duplicate lines or shows unique lines from sorted input.

strings — Extracts readable text from binary files.

base64 — Encodes or decodes data using Base64 encoding.

tr — Translates or deletes characters from input text.

tar — Archives multiple files/directories into a single file or extracts them.

gzip — Compresses files using the Gzip algorithm; gunzip decompresses.

bzip2 — Compresses files using the Bzip2 algorithm; bunzip2 decompresses.

xxd — Creates a hex dump of a file or converts a hex dump back to binary.
grep — Searches text inside files for specific patterns or keywords.

sort — Sorts lines of text alphabetically or numerically.

uniq — Removes duplicate lines or shows unique lines from sorted input.

strings — Extracts readable text from binary files.

base64 — Encodes or decodes data using Base64 encoding.

tr — Translates or deletes characters from input text.

tar — Archives multiple files/directories into a single file or extracts them.

gzip — Compresses files using the Gzip algorithm; gunzip decompresses.

bzip2 — Compresses files using the Bzip2 algorithm; bunzip2 decompresses.

xxd — Creates a hex dump of a file or converts a hex dump back to binary.

Solution for this challenge :

  1. Login

ssh bandit7@bandit.labs.overthewire.org -p 2220
ssh bandit7@bandit.labs.overthewire.org -p 2220

View the contents of the current working directory

bandit7@bandit:~$ ls
data.txt
bandit7@bandit:~$ ls
data.txt

We know the password is next to the word “millionth” in the file. We can look for this pattern by using the grep command

bandit7@bandit:~$ grep -n  millionth data.txt
millionth cvX2JJa4CFALtqS87jk27qwqGhBM9plV
bandit7@bandit:~$ grep -n  millionth data.txt
millionth cvX2JJa4CFALtqS87jk27qwqGhBM9plV

Explanation:

  • grep — Searches for a pattern in a file.
  • -n — Shows the line number where the match occurs.
  • millionth — The text pattern that grep is looking for.
  • data.txt — The file in which to search.
  • We have found the password for the next level !!

cvX2JJa4CFALtqS87jk27qwqGhBM9plV
cvX2JJa4CFALtqS87jk27qwqGhBM9plV
  • Logout of current session and use password of user bandit8 to access next level

Previous Level:

Bandit | Level 6→ 7| OverTheWire
Level Goal