SSH exercises
Bandit Level 0 → Level 1
Conect to ssh by port 2220
Saved the pass
Bandit Level 1 → Level 2
i got the password of bandit2 i guess… ill try to log in
Bandit Level 2 → Level 3
i just did cat and used tab key to autocomplete credentials for bandit3
Bandit Level 3 → Level 4
was pretty easy listing with the -la flag because when you use normal ls there are some directories hidden
Bandit Level 4 → Level 5
i Just did cat until i got the password but i think you can use grep to sort the files
Bandit Level 5 → Level 6
For this level i have to be honest i lost so much time because of one little thing(not using “ls -la”) the thing here is
i used find to get exactly what the description was giving
human-readable
1033 bytes in size
not executable
Get X1mi16’s stories in your inbox
Join Medium for free to get updates from this writer.
“find . -type f ! -executable -size 1033c”
“.”: to look in this directory only
-type f: to look for a type in this case f of file
! -executable: to look for NOT executable the ! acts like a NOT
-size 1033: to look for the size of the file this case was 1033c, c of characters and 1033 because 1033 bytes in size.(i tried to put “— “before the 1033 to indicate minus 1033 bytes and +1033 to indicate plus 1033 bytes and this was the output
as you can’t see there are a lot of those files so when done the “find . -type f ! -executable -size 1033c” there was one and only file
when i went to checked at that path i got confused with the -file2 one because i didnt use the “ls -la” to see the hidden file that was actually the correct one after i noticed i tried to log in and then it was a success
that the real pass
Bandit Level 6 → Level 7
after the last one this one was pretty easy
in this case i used the 2>/dev/null to filter errors or permision denied
if you choose to ls the ”var/lib/dpkg/info” youll find a lot of files like in this ss
thats why i cat directly the file
Bandit Level 7 → Level 8
this one actually was easier than the one before just by using “grep “millionth” data.txt”
basically grep is used to look out for text inside one or more files
“millionth”: to look for the exact word inside $X file
data.txt: the name of the file
or another way i found was using the ctrl + shift + f in the kali terminal looking for the word “millionth”
Bandit Level 8 → Level 9
This one i had to read some manuals to get it right, to get the pass i needed to pipeline “sort” and “uniq” to reorganize the entire thing the hint that the lvl gives you is “the only line of the text that occurs only once” with that knowledge i used “sort” to see what happened the output below:
as you are looking at it is organized from 0 to the letter Z by this time you could see which one is not duplicated just by looking at this sort but it still confusing so the next thing i did was “sort data.txt | uniq -u” to get the only one thats not repeated
then after pocking around i found another command that could be useful
almost the same as the other one but this list how many times is a file duplicated with the “uniq -c “ option
Bandit Level 9 → Level 10
This one is easy just by typing “strings data.txt” you can notice that there are several ====== in one line and next to it its the password. BUT you can use strings data.txt | grep “=” to list only the lines of the strings that have = on it just look at the example
Bandit Level 10 → Level 11
This one was a piece of cake just by putting the information in base64 in cyberchef





