这几天做asp.net追捕,也算是我入门吧。思路很简单,主要就是识别远程主机传回的banner, 代码如下(从我的web追捕里找出来的,用vb.net)
判断远程主机服务器。这可能不够准确,因为合格的管理员可能会去修改banner。
dim swwriter as streamwriter
'用以向网络基础数据流传送数据
dim nsstream as.networkstream
'创建发送数据的网络基础数据流
dim tcpclient2 as tcpclient
'通过它实现向远程主机提出tcp连接申请
dim shostname as string
dim srread as streamreader
'从网络基础数据流中读取数据
'http服务追捕
if tcpconnect(zsip, 80) = "cg" then
opphttp.text = "http服务已开启!服务软件类型:未知"
try
'tcpclient = new tcpclient(ipaddress, port)
tcpclient2 = new tcpclient(zsip.tostring(), 80)
tcpclient2.receivetimeout = 1000000
tcpclient2.sendtimeout = 1000000
'对远程主机的8000端口提出tcp连接申请
nsstream = tcpclient2.getstream()
'通过申请,并获取传送数据的网络基础数据流
swwriter = new streamwriter(nsstream)
swwriter.writeline("get /index.htm http/1.1")
swwriter.writeline("host:" & ip.text)
swwriter.writeline("accept:*/*")
swwriter.writeline("referer:")
swwriter.writeline()
'刷新当前数据流中的数据
swwriter.flush()
srread = new streamreader(nsstream, encoding.default)
'以得到的网络基础数据流来初始化streamreader实例
dim l as integer = 0
do while not srread.peek = -1 and l < 20
strhttp = strhttp & srread.readline()
l = l + 1
loop
if instr(strhttp, "iis") > 0 then
opphttp.text = "http服务已开启!服务软件类型:iis 版本未知"
systemfw = "windowsnt/2000/xp/2003"
end if
if instr(strhttp, "apache") > 0 then
opphttp.text = "http服务已开启!服务软件类型:apache 版本未知"
end if
if instr(strhttp, .netscape-enterprise") > 0 then
opphttp.text = "http服务已开启!服务软件类型.netscape-enterprise 版本未知"
end if
if instr(strhttp, "microsoft-iis/5.0") > 0 then
opphttp.text = "http服务已开启!服务软件类型:iis 5.0"
systemfw = "windows2000"
end if
if instr(strhttp, "microsoft-iis/5.1") > 0 then
opphttp.text = "http服务已开启!服务软件类型:iis 5.1"
systemfw = "windows2000/xp"
end if
if instr(strhttp, "microsoft-iis/6.0") > 0 then
opphttp.text = "http服务已开启!服务软件类型:iis 6.0"
systemfw = "windows2003"
end if
if instr(strhttp, "apache/2") > 0 then
opphttp.text = "http服务已开启!服务软件类型:apache 2.x"
end if
if instr(strhttp, "apache/2.0.54") > 0 then
opphttp.text = "http服务已开启!服务软件类型:apache 2.0.54"
end if
if instr(strhttp, "apache/2.0.52") > 0 then
opphttp.text = "http服务已开启!服务软件类型:apache 2.0.52"
end if
if instr(strhttp, "apache/2.1.6") > 0 then
opphttp.text = "http服务已开启!服务软件类型:apache 2.1.6"
end if
if instr(strhttp, "apache/1.3.2") > 0 then
opphttp.text = "http服务已开启!服务软件类型:apache 1.3.x"
end if
if instr(strhttp, "apache/1.3.20") > 0 then
opphttp.text = "http服务已开启!服务软件类型:apache 1.3.20"
end if
if instr(strhttp, "apache/1.3.23") > 0 then
opphttp.text = "http服务已开启!服务软件类型:apache 1.3.23"
end if
if instr(strhttp, "apache/1.3.26") > 0 then
opphttp.text = "http服务已开启!服务软件类型:apache 1.3.26"
end if
if instr(strhttp, "apache/1.3.27") > 0 then
opphttp.text = "http服务已开启!服务软件类型:apache 1.3.27"
end if
if instr(strhttp, "apache/1.3.33") > 0 then
opphttp.text = "http服务已开启!服务软件类型:apache 1.3.33"
end if
if instr(strhttp, .netscape-enterprise/4.1") > 0 then
opphttp.text = "http服务已开启!服务软件类型.netscape-enterprise 4.1"
end if
if instr(strhttp, "unix") > 0 then
systemfw = "类unix/linux系统"
end if
catch
end try
因为是摘出来的,所以有的变量没有定义,大家自己去琢磨吧。
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器