Hallo,
Im moment versuche ich mit sharppcap TCPPackete zusenden. Leider schaffe ich es nicht ich habe schon gegoogelt aber Leider nix aktuelles gefunden.
Hier erstmal das der Code um Packete zuempfangen das Funktioniert auch.
Hier die Funk zum Senden:
Und Hier noch Form_Load:
Im moment versuche ich mit sharppcap TCPPackete zusenden. Leider schaffe ich es nicht ich habe schon gegoogelt aber Leider nix aktuelles gefunden.
Hier erstmal das der Code um Packete zuempfangen das Funktioniert auch.
VB.NET-Quellcode
- Private Sub Device_OnPacketArrival(ByVal sender As Object, ByVal e As SharpPcap.CaptureEventArgs) Handles
- Device.OnPacketArrival
- CheckForIllegalCrossThreadCalls = False '
- Dim retPacket As Packet = Packet.ParsePacket(CType(1, LinkLayers), e.Packet.Data)
- Dim contcpPacket As TcpPacket = TcpPacket.GetEncapsulated(retPacket)
- If contcpPacket.SourcePort = 8101 Then
- Dim retdata As String = ASCII.GetString(contcpPacket.PayloadData)
- 'String Verarbeiten.
- 'Neues Packet Senden.
- SendPacket("L|1|0|0|0&S|0|0|2&", contcpPacket.DestinationPort, contcpPacket.SourcePort)
- MsgBox("gesendet")
- End If
- End Sub
Hier die Funk zum Senden:
Und Hier noch Form_Load:
VB.NET-Quellcode
- TopMost = True
- 'Selecting Device
- Try
- Devices = CaptureDeviceList.Instance
- Catch ex As Exception
- MessageBox.Show("Please install Winpcap and restart the Application!", "SFCatcher Error!", MessageBoxButtons.OK, MessageBoxIcon.Error)
- End
- End Try
- If Devices.Count < 1 Then
- MessageBox.Show("No devices found!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error)
- End
- End If
- If Devices.Count > 1 Then
- For Each dev In Devices
- Using devdialog As New DeviceDialog
- devdialog.list_devices.Items.Add(dev.Name)
- If devdialog.ShowDialog = Windows.Forms.DialogResult.OK Then
- iDeviceID = devdialog.list_devices.SelectedIndex
- Device = Devices(iDeviceID)
- End If
- End Using
- Next
- ElseIf Devices.Count = 1 Then
- iDeviceID = 0
- Device = Devices(iDeviceID)
- End If
- '//Open Device
- Device.Open(DeviceMode.Promiscuous, 1000)
- Device.Filter = "tcp"
- Device.StartCapture()
Dieser Beitrag wurde bereits 3 mal editiert, zuletzt von „Tantra“ ()