PicoCTF 2018 Walkthrough – Grep & Strings

Grep 1

Category : General

Points: 75


Can you find the flag in the file? This would be really obnoxious to look through by hand, see if you can find a faster way. You can also find the file in /problems/grep-1_3_8d9cff3d178c231ab735dfef3267a1c2 on the shell server.


grep tutorial


In this problem, you are given a file which you find a file which you can download or you can access in the shell of the website by running command cd /problems/grep-1_3_8d9cff3d178c231ab735dfef3267a1c2. The cd command is used to change the directory.

When you open the file in a text editor or in the command line by using the command cat file you will see a lot of information in it which will be overwhelming. The cat command is used to open the files. You can learn more about it here. The problem also hints of the same, stating that it’s obnoxious to look through by hand.

That is where the grep command comes into the picture. It is used to find the pattern in the file where both pattern and filename should be provided in the terminal. The syntax of the grep command is grep pattern filename. To read more on this you can use the trusted Linux man pages.

Now we know that we need to search for the pattern but what pattern should we search in the file. I initially searched key in the file but then I realised that all the flags start with picoCTF which I searched next and voila I got a match. I ran the command grep picoCTF file to get the flag I was looking for. It returned picoCTF{grep_and_you_will_find_cdf2e7c2} as the flag which I entered and clicked submit to got 75 points.

Solution Flag



Category : General

Points: 100


Can you find the flag in this file without actually running it? You can also find the file in /problems/strings_2_b7404a3aee308619cb2ba79677989960 on the shell server.




In this problem, we need to find the flag without running the file. We are also provided with a hint of using strings command.

Strings command is used to see the contents of the executable file or non-text file which are printable or reading friendly. More about the same can be read here.

Now when I downloaded the file it was saved as strings as its name. I went inside the folder where it was saved open the terminal and ran strings strings as the command. It printed out a very large number of data and it was not possible to go through the hand, character by character. Then I got the idea of using grep command for pattern matching. Then I ran the two commands- strings and grep with a pipe.

A pipe is a command which lets us run more than one command with the output of one becomes the input of the next command. It is denoted by ‘|’. You can learn more about the pipe here.

Hence I ran the command strings strings | grep pico as generally, the key starts with picoCTF as its prefix. I got the output as picoCTF{sTrIngS_sAVeS_Time_3f712a28} which I entered in the text box provided and bagged 100 points

Solution Flag


For more capture the flag challenges visit Ctf

If you want to see Leetcode explained solutions visit Leetcode Solutions.

Check out my socials below in the footer. Feel free to ask any doubts in comment section or contact me via Contact page I will surely respond. 

Happy Learning 🙂

1 thought on “PicoCTF 2018 Walkthrough – Grep & Strings”

  1. Pingback: PicoCTF 2018 Walkthrough – Pipe - Capture the Flag - Cse Nerd

Leave a Comment

Your email address will not be published. Required fields are marked *