bandit7-bandit-13 walkthrough


This levels can be solved using man, grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd.
Command breakdown
man
Displays command manuals
Usage:
man [command]
(Example:man grep
)Press
q
to exit,/
to search within manual
grep
Pattern search in files
Key flags:
-i
(case-insensitive)-v
(invert match)-l
(show filenames only)
Example:
grep "password" data.txt
sort
Sorts file contents
Important options:
-n
(numeric sort)-r
(reverse order)-u
(remove duplicates)
Example:
sort -n passwords.txt
uniq
Filters duplicate lines (requires sorted input)
Useful flags:
-c
(count occurrences)-d
(show duplicates only)
Example:
sort file.txt | uniq -c
strings
Extracts printable text from binaries
Example:
strings binary_file | grep "flag"
Often used with
grep
for CTF challenges
base64
Encodes/decodes Base64
Decoding:
base64 -d encoded.txt
Encoding:
cat file | base64
tr
Character translation/substitution
Common uses:
ROT13:
tr 'A-Za-z' 'N-ZA-Mn-za-m'
Remove spaces:
tr -d ' '
Example:
echo "text" | tr 'a-z' 'A-Z'
tar
Handles .tar archives
Key operations:
Extract:
tar -xf archive.tar
Create:
tar -cf archive.tar files/
List:
tar -tf archive.tar
gzip
/gunzip
Compress:
gzip file
(creates file.gz)Decompress:
gunzip file.gz
Works with tar:
tar -czf archive.tar.gz dir/
bzip2
/bunzip2
xxd
Hexdump utility
Create hexdump:
xxd file > hex.txt
Reverse:
xxd -r hex.txt > original
Essential for binary analysis
bandit7-bandit8
bandit8-bandit9
The uniq
command only compares adjacent lines – it won't detect duplicates separated by other lines. That's why we must sort first (sort data.txt | uniq -u
) to group identical lines together before filtering
bandit9-bandit10
bandit10-bandit11
Base64 is an encoding method that converts binary data to ASCII text, often ending with =
or ==
as padding. It uses 64 characters (A-Z, a-z, 0-9, +, /) to represent data. In Bandit, base64 -d
decodes these strings back to their original form. The ==
at the end is a telltale sign of Base64 encoding.
bandit11-bandit12
ROT13 is a simple cipher that rotates each letter by 13 positions in the alphabet (A becomes N, B becomes O, etc.), wrapping around from Z to A. It's reversible - applying ROT13 twice returns the original text. In Bandit, we use tr 'A-Za-z' 'N-ZA-Mn-za-m' to decode ROT13 text.The cipher was commonly used in early internet forums to hide spoilers or offensive content.
bandit12-bandit13
The Bandit 12→13 challenge is essentially a compression puzzle game. You start with a hexdump that needs to be converted back to binary using xxd -r
, then begin a series of decompression steps where you must:
Identify the compression type using
file
Rename the file with the correct extension (.gz, .bz2, .tar)
Decompress using the right tool (
gzip -d
,bzip2 -d
,tar -xf
)Repeat until you find the final ASCII password
Subscribe to my newsletter
Read articles from Sekina Murad directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
