PT0-003 · Question #106
A penetration testing team wants to conduct DNS lookups for a set of targets provided by the client. The team crafts a Bash script for this task. However, they find a minor error in one line of the sc
The correct answer is D. host $i. Script Analysis: Line 1: #!/bin/bash - This line specifies the script should be executed in the Bash shell. Line 2: for i in $(cat example.txt); do - This line starts a loop that reads each line from the file example.txt and assigns it to the variable i. Line 3: curl $i - This li
Question
A penetration testing team wants to conduct DNS lookups for a set of targets provided by the client. The team crafts a Bash script for this task. However, they find a minor error in one line of the script:
1 #!/bin/bash 2 for i in $(cat example.txt); do 3 curl $i 4 done Which of the following changes should the team make to line 3 of the script?
Options
- Aresolvconf $i
- Brndc $i
- Csystemd-resolve $i
- Dhost $i
How the community answered
(15 responses)- A7% (1)
- B7% (1)
- D87% (13)
Explanation
Script Analysis: Line 1: #!/bin/bash - This line specifies the script should be executed in the Bash shell. Line 2: for i in $(cat example.txt); do - This line starts a loop that reads each line from the file example.txt and assigns it to the variable i. Line 3: curl $i - This line attempts to fetch the content from the URL stored in i using curl. However, for DNS lookups, curl is inappropriate. Line 4: done - This line ends the loop. Error Identification: The curl command is used for transferring data from or to a server, often used for HTTP requests, which is not suitable for DNS lookups. Correct Command: To perform DNS lookups, the host command should be used. The host command performs DNS lookups and displays information about the given domain. Corrected Script: Replace curl $i with host $i to perform DNS lookups on each target specified in example.txt.
Topics
Community Discussion
No community discussion yet for this question.