Pipe
Category: General Skills
Points: 110
Problem
During your adventure, you will likely encounter a situation where you need to process data that you receive over the network rather than through a file. Can you find a way to save the output from this program and search for the flag? Connect with 2018shell.picoctf.com 2015
.
Hint
- Remember the flag format is picoCTF{XXXX}
- Ever heard of a pipe? No not that kind of pipe… This kind
Solution
In this problem, we have to get the data and print the same on the console to get the required flag. We have to do two things in a way such that the output of 1 will go to the input of the other command. That is where the pipe comes in as stated in the question.
The pipe is used to concatenate 2 commands such that the output of first will act as input to the other. You can read more about the pipe and its usage from the Linux man-pages here.
Now coming back to the question we still have to figure out which 2 commands to be piped together. We know that we have to search from the stream that will be resulted by the going to the URL and the port no as we did in problem by using the netcat (nc) command. To pattern search, we can make use of grep command as we did in the problem. As all keys start with picoCTF we can use that to our advantage. Therefore our final command to be entered will be as follows:
nc 2018shell2.picoctf.com 2015 | grep picoCTF.
It will result in giving the flag picoCTF{almost_like_mario_8861411c}
Enter the same in text box and hit submit.
Solution Flag
picoCTF{almost_like_mario_8861411c}
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