Valid PT0-003 Dumps shared by EduDump.com for Helping Passing PT0-003 Exam! EduDump.com now offer the newest PT0-003 exam dumps, the EduDump.com PT0-003 exam questions have been updated and answers have been corrected get the newest EduDump.com PT0-003 dumps with Test Engine here:
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?
Correct Answer: B
When Nmap is unavailable on a compromised host, PenTest+ expects testers to adapt by using native scripting (for example, PowerShell) to perform reconnaissance and port checks with built-in .NET classes such as System.Net.Sockets.TcpClient. To scan multiple ports, the script must iterate over two dimensions: the host range and the port list. In PowerShell, supplying a comma-separated list to a variable (for example, $port = 80,443,445) creates an array-like collection. The correct way to use that collection is to add a nested Foreach loop inside the existing loop that iterates through IPs, so each reachable host is tested against every port in the list.