QuestionQ74
Reconnaissance and EnumerationA penetration tester obtains initial access to a system and prepares to conduct further reconnaissance. The tester cannot use Nmap on the system used to obtain initial access. The tester creates the following script to scan a network range:

The tester needs to modify the existing script to scan multiple ports. The tester enters a comma-separated port list in the port variable. Which of the following should the tester do next to achieve the required functionality?
- A Duplicate the $socket code block and modify $port for each new port variable.
- B Add a new Foreach loop directly beneath the other Foreach loop and enclose with {...}.
- C Add $p in $port to the initial Foreach loop directly following the $range variable.
- D Add $(Each ($p in $port) on the line before $socket and enclose with {....}.
Community Discussion