判断远程主机服务器。这可能不够准确,因为合格的管理员可能会去修改Banner。
代码如下(从我的Web追捕里找出来的,用VB.Net)
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