Windows无界面非交互shell下安装nmap脚本

  有时候由于防火墙的原因只能通过80或1433等其他非交互的环境连接内网机器,而此时你又想探测一下内网的其他机器或是对外扫描所有端口来探测一下防火墙放行的端口这个时候nmap就是一个不二的选择。

  Nmap需要Winpcap和Vc库的支持,但Winpcap又必须在窗口界面下安装。最简单的办法就是写个程序发送窗口句柄事件,但这样就会不够灵活等我安装Cain的时候又得写一个。于是就用vbs写了一个脚本,修改起来比较方便。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
WScript.Echo "Nmap install script. @b4dboy"
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "winpcap-nmap-4.12.exe"
WScript.Sleep 100
WshShell.AppActivate "WinPcap (Nmap) 4.1.2 Setup "
WScript.Sleep 100
WshShell.SendKeys "%A"
WScript.Sleep 2500
WshShell.SendKeys "%N"
WScript.Sleep 500
WshShell.SendKeys "%N"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
WScript.Echo ""
WScript.Echo "WinPcap install finished"
WshShell.Run "vcredist_x86.exe /q"
WScript.Sleep 2500
WScript.Echo "Vcredist_x86 install finished"
WshShell.Run "vcredist2008_x86.exe /q"
WScript.Sleep 2500
WScript.Echo "Vcredist2008_x86 install finished"

测试环境:windows 2003 + nmap-6.40