Post

Mass Port Scanner by Powershell (Specific and All Ports)

PS:

$ports = @(25, 53, 88, 135, 139, 389, 445, 636, 9389, 3269, 5722, 123, 464)
# tum portlari tara ornek: 53.. 65535
$serverIP = "10.5.10.217"

#Note: You cannot use cmdlet(Powershell) to Check UDP ports.
#Note: UDP bağlantı noktalarını Denetlemek için cmdlet(Powershell) kullanamazsınız.


foreach ($port in $ports) {
    $socket = New-Object System.Net.Sockets.TcpClient
    $result = $socket.BeginConnect($serverIP, $port, $null, $null)
    Start-Sleep -Milliseconds 500  # gecikme suresi
    if ($socket.Connected) {
        Write-Host "Port $port ACIK"
        $socket.Close()
    } else {
        Write-Host "Port $port KAPALI"
    }
}
This post is licensed under CC BY 4.0 by the author.