Abno's blog

Bandit Level 4-5

First we have to move into the directory we want to work with. Then, we could cat each file and see how it looks... but that is boring and takes time.

Instead we can use the file command to make the programe look for us what is inside and tell us.

file -- -file00

it will give the output: -file00: data

It is easy now, we can just do the same thing only 10 times... but, once again, that is boring and takes time.

Instead we could use the find command to find all of the files in this directory and pipe them into the file command, effectively using it as a loop.

find . -type f | file -f -

output:

./-file01: data ./-file00: data ./-file06: data ./-file03: data ./-file05: data ./-file08: data ./-file04: data ./-file07: ASCII text ./-file02: data ./-file09: data

Using this data, we can just cat the file to get the answer.

P.S: As this stackoverflow user explained it is not the best solution, for reasons I won't explain. The best possible way to solve this task is listed below, but it is less intuitive for begginers in my opinion.

find . -type f -exec file -- {} +

From now on, I will use this solution in similar tasks.

#bandit #ctf #overthewire