Reconnaissance and Enumeration

A tester has a shell on a Windows host with only default tooling and must test TCP 445 on every address in hosts.txt. Which command fits?

Show the answer

Correct answerB. Get-Content hosts.txt | ForEach-Object { Test-NetConnection $_ -Port 445 }

AWhy not this: The /dev/tcp path is a Bash feature and does not exist in Windows.

BWhy this is right: Test-NetConnection -Port is built into Windows PowerShell and tests each address from the file.

CWhy not this: This needs a Python interpreter and a script, neither present on a default Windows host.

DWhy not this: This is a Bash loop that needs a shell and netcat, which a default Windows host lacks.

PowerShell ships with Windows, and Test-NetConnection with -Port checks a TCP port, so piping Get-Content into ForEach-Object tests each address. The Bash and Python options rely on tools a default Windows host does not provide.