Post

first grep

picoCTF first grep Challenge

first grep

Challenge description:

Can you find the flag in file? This would be really tedious to look through manually, something tells me there is a better way.

Okay, so here we’ve been given a pretty big file, and we need to pull out the flag. Now, we know that the flag starts with picoCTF, but how can we find it quickly in a large file? Well, we use grep!

Now, you can use grep in one of two ways. We’ll cover both here

Way #1

The first way is to only use grep by itself. The syntax is grep [string to search for] [file].

1
2
❯ grep pico file
picoCTF{grep_is_good_to_find_things_dba08a45}

Way #2

Now let’s say you don’t have a file, or you didn’t like the first way for some reason. You can also use cat to send the file’s contents to stdout, and pipe it into grep. Piping output to grep is useful is you’re working with data not in a file, or trying to chain together a command.

1
2
❯ cat file | grep pico
picoCTF{grep_is_good_to_find_things_dba08a45}

Either way, you get the flag!

FLAG: picoCTF{grep_is_good_to_find_things_dba08a45}

This post is licensed under CC BY 4.0 by the author.