312-50V13 · Question #308
You start performing a penetration test against a specific website and have decided to start from grabbing all the links from the main page. What Is the best Linux pipe to achieve your milestone?
The correct answer is C. wget https://site.com | grep "< a href=\*http" | grep "site.com". To identify lines containing links from a webpage during a penetration test, a Linux pipe can retrieve the content and use grep commands to filter for anchor tags and specific domain patterns.
Question
Options
- Adirb https://site.com | grep "site"
- Bcurl -s https://site.com | grep `'< a href-'http" | grep "site-com- | cut -d "V" -f 2
- Cwget https://site.com | grep "< a href=*http" | grep "site.com"
- Dwget https://site.com | cut-d"http-
How the community answered
(49 responses)- A6% (3)
- B12% (6)
- C80% (39)
- D2% (1)
Why each option
To identify lines containing links from a webpage during a penetration test, a Linux pipe can retrieve the content and use `grep` commands to filter for anchor tags and specific domain patterns.
`dirb` is a web content scanner used for directory brute-forcing, not for extracting links from a main page's content.
The `cut` command in this option is improperly formatted (`-d "V" -f 2`) and would not correctly extract URLs, nor is the `grep "site-com-"` regex standard for this purpose.
`wget https://site.com` retrieves the webpage content. The subsequent `grep "< a href=\*http"` filters for lines containing anchor tags that link to HTTP resources, and `grep "site.com"` further refines the output to include only links relevant to the target domain, effectively identifying lines with links.
This command is syntactically incomplete and would not function as intended to extract links from a webpage.
Concept tested: Linux command-line tools for web reconnaissance and text processing
Topics
Community Discussion
No community discussion yet for this question.