MayADevBe Blog

A Blog about Computer Science

OverTheWire Bandit Level 17 -> 18 - Walkthrough

Previous Level: Level 17


Login

SSH: ssh -i sshkey17.private bandit17@bandit.labs.overthewire.org -p 2220

Password: -

(Private SSH key from the previous level)

Task

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

A little bit of Theory

The diff command prints the difference between two files.

Solution

Find the one line that is different between two files.

1
2
3
4
5
bandit17@bandit:~$ diff passwords.old passwords.new 
42c42
< w0Yfolrc5bwjS4qw5mq1nnQi6mF03bii
---
> kfBf3eYk5BPBRzwjqutbbfE887SVc5Yd

So since I wrote ‘passwords.new’ in second place, the new password is also printed in the second part.

Alternative

This is an alternative I thought of based on level 9. However, it does not seem that sort keeps the overall order of the files. But grep can be used to confirm the correct password.

1
2
3
4
5
6
bandit17@bandit:~$ sort passwords.old passwords.new | uniq -u
kfBf3eYk5BPBRzwjqutbbfE887SVc5Yd
w0Yfolrc5bwjS4qw5mq1nnQi6mF03bii
bandit17@bandit:~$ cat passwords.new | grep w0Yfolrc5bwjS4qw5mq1nnQi6mF03bii
bandit17@bandit:~$ cat passwords.new | grep kfBf3eYk5BPBRzwjqutbbfE887SVc5Yd
kfBf3eYk5BPBRzwjqutbbfE887SVc5Yd

https://overthewire.org/wargames/bandit/bandit18.html


Next Level: Level 19


Share on: