Previous Level Guide: Bandit Level 16 → 17
Access
SSH: ssh bandit17@bandit.labs.overthewire.org -p 2220
Password: none (ssh key from previous level)
Info
Description: There are 2 files in the homedirectory: passwords.old and passwords.new. The password for the next level is in passwords.new and is the only line that has been changed between passwords.old and passwords.new. NOTE: if you have solved this level and see ‘Byebye!’ when trying to log into bandit18, this is related to the next level, bandit19 Commands: cat, grep, ls, diff
Theory
To get the password, the instructions say that we have to search the only password that doesn't repeat between two files. So as we've done before, I'd guess that each file has like a million passwords but they're all the same passwords between files, except for one in each file, where one of the two is the correct one, specifically the one in the new file, as it is the only changed line. So after going through the manual pages of diff, which is the only command in the instructions that we haven't seen yet, it is once again exactly what we need for this challenge, which is to detect different lines between two texts or files. So with that, we get this command:
diff passwords.old passwords.new
Solution
Now you just have to get into the level and let me check for the files just in case:
~$ ls passwords.old passwords.new
Alright, now let's do the actual differential command:
~$ diff passwords.old passwords.new 38c38 < PrfckKPv5Q9yXesJ5h5l1f87qNJJC9FF --- > Qj1lAo6a6zjWQ4JtBWYetDly9Ez9QYNZ
By the way, that 38c38 thing is basically in what line of the file the difference was (for example, if it says 12c36 it means that the difference was in the line 12 of the old file and the line 36 of the new file). And that's it, it worked! Now we should be good to exit three times in a row, like in a previous level, then be able to go to the next level.
https://overthewire.org/wargames/bandit/bandit17.htmlNext Level Guide: Bandit Level 17 → Level 18