Grepping for Gold

Term

Details

  • Location: North Pole
  • Troll: Greasy GopherGuts

Troll's Objective Message

Grnph. Blach! Phlegm.

I'm Greasy Gopherguts. I need help with parsing some Nmap output. If you help me find some results, I'll give you some hints about Wi-Fi. Click on the terminal next to me and read the instructions. Maybe search for a cheat sheet if the hints in the terminal don't do it for ya'. You’ll type quizme in the terminal and grep through the Nmap bigscan.gnmap file to find answers.

The goal of this terminal challenge is to teach you about grep. To view the hints for this terminal challenge use the menu on the left.

These are the questions you need to answer to solve this terminal challenge:

Term

Use the command grep '34.76.1.22' bigscan.gnmap to find the answer to question 1.

What port does 34.76.1.22 have open?

62078

You can use a similar command to find the answer to the second question, grep '34.77.207.226' bigscan.gnmap.

What port does 34.77.207.226 have open?

8080

The -c parameter in grep will count the number of matching lines. You can use the command grep 'Status: Up' bigscan.gnmap -c to find the answer to the third question.

What port does 34.77.207.226 have open?

26054

The | operator in grep means OR. You can use this operator to specify multiple strings you're looking for. You can use the command grep -E '(80|8080|443)/open' bigscan.gnmap -c | wc -l to find all hosts that have 80 or 8080 or 443 open. The wc -l counts the number of matching lines.

How many hosts have a web port open? (Let's just use TCP ports 80, 443, and 8080)

14372

You can use the command echo $((`egrep 'Up' bigscan.gnmap | wc -l` - `egrep 'Ports' bigscan.gnmap | wc -l`)) to find how many hosts are "Up" and how many ports are "open". This command will subtract the two results to find how many Up hosts have no open ports.

How many hosts with status Up have no (detected) open TCP ports?

402

You can use the command grep -E "(open\/tcp.*){12,}" bigscan.gnmap | wc -l to find the number of occurrences of open ports that are more than 12. You can change 12 to 13 to find that there are no matches for 13 occurrences.

What's the greatest number of TCP ports any one host has open?

12