sp; End Function
Private Function GetSenderIPEndPoint() As IPEndPoint Return New IPEndPoint(GetSenderAddress, GetSenderPort) End Function
Private Function GetreceiverIPEndPoint() As IPEndPoint Return New IPEndPoint(GetReceiverAddress, getReceiverPort) End Function
Private Function GetSenderAddress() As IPAddress Return GetAddress(12) End Function
Private Function GetSenderPort() As Integer Return GetPort(20) End Function
Private Function GetReceiverAddress() As IPAddress Return GetAddress(16) End Function
Private Function getReceiverPort() As Integer Return GetPort(21) End Function
Private Function GetAddress(ByVal StartIndex As Integer) As IPAddress Dim b(3) As Byte Array.Copy(data, StartIndex, b, 0, 4) Return IPAddress.Parse(String.Format("{0}.{1}.{2}.{3}", b(0), b(1), b(2), b(3))) End Function
Private Function GetPort(ByVal StartIndex As Integer) As Integer Return data(StartIndex) * 256 + data(StartIndex + 1) End Function
Private Function GetData() As Byte() Dim b As Byte() Dim HeaderLength As Integer
Select Case Me.Protocal Case Sockets.ProtocolType.Tcp HeaderLength = 40 Case Sockets.ProtocolType.Udp HeaderLength = 28 End Select ReDim b(data.Length - HeaderLength) Array.Copy(data, HeaderLength, b, 0, data.Length - HeaderLength) Return b End Function
End Class
上一页 [1] [2] [Delphi程序]Xray@NET,业余写的SNIFFER
|