主机发现
查询域内的主机信息
net view /domain
发生系统错误 6118 出现这种错误时 Computer Browser 被禁用了 在域管理启用即可
net view /domain:icsec
查询通信
arp -a
nbtscan 发现主机
下载地址:http://www.unixwiz.net/tools/nbtscan.html
nbtscan-1.0.35.exe --r 192.168.1.0/24
ping命令发现主机
windows:
for /l %i in (1,1,255) do @ping 192.168.1.%i -w 1 -n 1|find /i "ttl="
linux:
for k in $( seq 1 255);do ping -c 1 192.168.1.$k|grep "ttl"|awk -F "[ :]+" '{print $4}'; done
powershell 脚本扫描 IP 地址存活:
powershell.exe -exec bypass -Command "Import-Module ./Invoke-TSPingSweep.ps1;Invoke-TSPingSweep -StartAddress 192.168.1.0 -EndAddress 192.168.1.255"
PowerShell 实现基本的端口扫描功能
针对单个 IP 的多个端口的扫描:
1..1024 | % {echo ((new-object Net.Sockets.TcpClient).Connect("192.168.1.12",$_)) "Port $_ is open!"} 2>$null
针对某 IP 段中单个端口的扫描:
foreach ($ip in 1..20) {Test-NetConnection -Port 80 -InformationLevel "Detailed" 192.168.1.$ip}
针对某 IP 段 & 多个端口的扫描器
1..20 | % { $a = $_; 1..1024 | % {echo ((new-object Net.Sockets.TcpClient).Connect("10.0.0.$a",$_)) "Port $_ is open!"} 2>$null}