OverTheWire Bandit: Level 17 → Level 18
•
Technical Note
Context
Sometimes finding what changed in a system is harder than finding a needle in a haystack. In this level, we have two files: passwords.old and passwords.new. The password is the only line that exists in the new file but not in the old one.
Instead of squinting at thousands of lines, we will use Linux’s comparison tool: diff.
Goal
Compare passwords.old and passwords.new to identify the modified line containing the password.
Solution
The command is straightforward:
diff passwords.old passwords.new
Output Analysis:
You will see something like this:
42c42
< 53an0.... (Old password)
---
> hga5tuuCLF6fFzUpnagimn8ssu9LFrdg (New password)
<(Less than): Content present in the first file (passwords.old) but not in the second.>(Greater than): Content present in the second file (passwords.new) file but not in the first.
So, the password we need is the one next to the > symbol: hga5tuuCLF6fFzUpnagimn8ssu9LFrdg.
Alternatively, to verify visually, you can use colored output (if supported):
diff --color passwords.old passwords.new
Key Takeaways
diff: Compares files line by line. It is essential in software development (git diff) and system administration (checking config changes).