Bandit Level 17 → Level 18

Level Goal

There are 2 files in the homedirectory: passwords.old and The password for the next level is in and is the only line that has been changed between passwords.old and

Commands you may need to solve this level

cat, grep, ls

Since the command diff will output all the lines that are different between two files, this was a lot easier than I expected.

diff passwords.old
< kfBf3eYk5BPBRzwjqutbbfE887SVc5Yd
> PRjrhDcANrVM6em57fPnFp4Tcq8gvwzK

The top line is from and it is the next password. However, I want to find out how to do this with grep. Looking at grep options, Our goal is to use one file as a list of pattern to match the other file and find out which line is not matched. From man page, -f will read one or more newline separated pattern from file. -v will invert the match. We put the after passwords.old to use passwords.old as the pattern and anything different in will be output and the result are the same.

grep -vf passwords.old