這幾天做ASP.Net追捕,也算是我入門吧。思路很簡單,主要就是識別遠程主機傳回的Banner,判斷遠程主機服務器。這可能不夠准確,因為合格的管理員可能會去修改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)
&
nbsp; 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 Thenvv 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
因為是摘出來的,所以有的變量沒有定義,大家自己去琢磨吧。
ZSIP:分析出的真實IP