Back home
中文
H7 / SECURITY RESEARCH NOTES

Listening on a Specified Port on Windows with PowerShell

Environment

IPHOSTNAMENOTE
10.10.10.88win10_dqyLab host

The PowerShell script is as follows:

  • Listen on local port 9999 through PowerShell.
$host_ip = "127.0.0.1";
$port = 9999;
$Listener = [System.Net.Sockets.TcpListener]$port;
$Listener.Start();
$result = netstat -ano -p tcp | findStr $port | Out-String;

Check whether the listener started successfully

  • Check with a PowerShell command.
netstat -ano -p tcp | findStr 9999