PowerShell ile Network Port Scan (tr-TR)

%3CLINGO-SUB%20id%3D%22lingo-sub-2067509%22%20slang%3D%22en-US%22%3EPowerShell%20ile%20Network%20Port%20Scan%20(tr-TR)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2067509%22%20slang%3D%22en-US%22%3E%3CP%3ENetworkcular%C4%B1n%20ve%20Windows%20sistem%20y%C3%B6neticilerin%20i%C5%9Fini%20kolayla%C5%9Ft%C4%B1racak%20bu%20basit%20PowerShell%20scripti%20ile%20networkunuzdaki%20portlar%C4%B1%20taray%C4%B1p%20scv%20format%C4%B1nda%20rapor%20halinde%20%C3%A7%C4%B1kt%C4%B1%20alabilirsiniz.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%24port%20%3D%20(enter%20port%20value)%0A%24network%20%3D%20%E2%80%9Center%20network%20value%E2%80%9D%0A%24range%20%3D%201..254%0A%24ErrorActionPreference%3D%20%E2%80%98silentlycontinue%E2%80%99%0A%24(Foreach%20(%24add%20in%20%24range)%0A%7B%20%24ip%20%3D%20%E2%80%9C%7B0%7D.%7B1%7D%E2%80%9D%20%E2%80%93F%20%24network%2C%24add%0AWrite-Progress%20%E2%80%9CScanning%20Network%E2%80%9D%20%24ip%20-PercentComplete%20((%24add%2F%24range.Count)*100)%0AIf(Test-Connection%20%E2%80%93BufferSize%2032%20%E2%80%93Count%201%20%E2%80%93quiet%20%E2%80%93ComputerName%20%24ip)%0A%7B%20%24socket%20%3D%20new-object%20System.Net.Sockets.TcpClient(%24ip%2C%20%24port)%0AIf(%24socket.Connected)%20%7B%20%E2%80%9C%24ip%20port%20%24port%20open%E2%80%9D%0A%24socket.Close()%20%7D%0Aelse%20%7B%20%E2%80%9C%24ip%20port%20%24port%20not%20open%20%E2%80%9D%20%7D%0A%7D%0A%7D)%20%7C%20Out-File%20C%3A%5Creports%5Cportscan.csv%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EUygulama%20g%C3%B6r%C3%BCnt%C3%BCs%C3%BC%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22demo.PNG%22%20style%3D%22width%3A%20859px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F246974iE44CBD452F3A82E5%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22demo.PNG%22%20alt%3D%22demo.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2067509%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EWindows%20PowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Contributor

Networkcuların ve Windows sistem yöneticilerin işini kolaylaştıracak bu basit PowerShell scripti ile networkunuzdaki portları tarayıp scv formatında rapor halinde çıktı alabilirsiniz.

 

$port = (enter port value)
$network = “enter network value”
$range = 1..254
$ErrorActionPreference= ‘silentlycontinue’
$(Foreach ($add in $range)
{ $ip = “{0}.{1}” –F $network,$add
Write-Progress “Scanning Network” $ip -PercentComplete (($add/$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 open”
$socket.Close() }
else { “$ip port $port not open ” }
}
}) | Out-File C:\reports\portscan.csv

 

Uygulama görüntüsü

demo.PNG

 

 

0 Replies