Certified Ethical Hacker (CEH v11) — Question 202
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?
Answer options
- A. wget https://site.com | grep ג€<a href=\ג€httpג€ | grep ג€site.comג€
- B. curl -s https://site.com | grep ג€<a href=\ג€httpג€ | grep ג€site.comג€ | cut -d ג€\ג€ג€ -f 2
- C. dirb https://site.com | grep ג€siteג€
- D. wget https://site.com | cut -d ג€httpג€
Correct answer: B
Explanation
The correct answer is B because it uses 'curl' to silently fetch the webpage content, then filters for links with 'grep', and extracts the actual URLs using 'cut'. Option A lacks the ability to extract the URLs in a clean manner, and options C and D do not effectively retrieve all the relevant links from the main page.