Pre-Summer Sale Special Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: ac4s65

A penetration tester gains initial access to a system and gets ready to perform additional...

A penetration tester gains initial access to a system and gets ready to perform additional reconnaissance. The tester cannot use Nmap on the system they used to gain initial access. The tester develops the following script to scan a network range:

$port = 80

$network = 192.168.1

$range = 1..254

$ErrorActionPreference = 'silentlycontinue'

$(Foreach ($r in $range)

{

$ip = "{0}.{1}" -F $network,$r

Write-Progress "Scanning" $ip -PercentComplete (($r/$range.Count)*100)

If(Test-Connection -BufferSize 32 -Count 1 -quiet -ComputerName $ip)

{

$socket = new-object System.Net.Sockets.TcpClient($ip, $port)

If($socket.Connected)

{

"$ip port $port is open"

$socket.Close()

}

else { "$ip port $port is closed" }

}

}) | Out-File C:\nefarious_location\portscan.csv

The tester wants to modify the current script so multiple ports can be scanned. The tester enters a comma-separated list of ports in the port variable. Which of the following should the tester do next to provide the intended outcome?

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.

PT0-003 PDF/Engine
  • Printable Format
  • Value of Money
  • 100% Pass Assurance
  • Verified Answers
  • Researched by Industry Experts
  • Based on Real Exams Scenarios
  • 100% Real Questions
buy now PT0-003 pdf
Get 65% Discount on All Products, Use Coupon: "ac4s65"