/// <summary> /// Send a queue of raw packets to the network. /// </summary> /// <param name="device">The PcapDevice on which to send the queue</param> /// <param name="synchronize">determines if the send operation must be synchronized: /// if it is non-zero, the packets are sent respecting the timestamps, /// otherwise they are sent as fast as possible /// <returns></returns> public int Transmit(PcapDevice device, bool synchronize) { if (!device.PcapOpened) { throw new PcapException("Can't transmit queue, the pcap device is closed."); } if (m_queue == IntPtr.Zero) { throw new PcapException("Can't transmit queue, this queue is disposed"); } int sync = synchronize ? 1 : 0; return(SharpPcap.pcap_sendqueue_transmit(device.PcapHandle, m_queue, sync)); }
/// <summary> /// Stellt eine Klasse da die das Sniffen von Packets regelt /// </summary> /// <param name="port">Der Port auf den der TCPStreamAssembler horchen soll</param> public L2NetSniffer(PcapDevice device, int dst_port) { this.dst_port = dst_port; this.device = device; /* * (((ip.src == 192.168.100.150) && (tcp.dstport == 7777) ) || ((ip.src == 78.46.33.43) && (tcp.dstport == 52784))) */ this.tcpDumpFilter = "port " + dst_port; this.clientStr = new L2NetStream(); this.serverStr = new L2NetStream(); // TODO: wenn keine devices gefunden wurden, Meldung this.Init(); }
/// <summary> /// Initialisiert die SnifferControll /// </summary> /// <param name="device">Das PcapDevice mit dem gesnifft werden soll</param> /// <param name="filter">Der TCPDumpfilter der angewendet werden soll</param> public void Init(PcapDevice device, string filter) { this.device = device; this.tcpDumpFilter = filter; //Register our handler function to the 'packet arrival' event this.device.PcapOnPacketArrival += new SharpPcap.PacketArrivalEvent(device_PcapOnPacketArrival); //Open the device for capturing //true -- means promiscuous mode //1000 -- means a read wait of 1000ms this.device.PcapOpen(false, 100); //Associate the filter with this capture this.device.PcapSetFilter(this.tcpDumpFilter); }
public void Remove( PcapDevice value ) { List.Remove( value ); }
public void Insert( int index, PcapDevice value ) { List.Insert( index, value ); }
public int IndexOf( PcapDevice value ) { return( List.IndexOf( value ) ); }
public bool Contains( PcapDevice value ) { // If value is not of type PcapDevice, this will return false. return( List.Contains( value ) ); }
public int Add( PcapDevice value ) { return( List.Add( value ) ); }
/// <summary> /// Send a queue of raw packets to the network. /// </summary> /// <param name="device">The PcapDevice on which to send the queue</param> /// <param name="synchronize">determines if the send operation must be synchronized: /// if it is non-zero, the packets are sent respecting the timestamps, /// otherwise they are sent as fast as possible /// <returns></returns> public int Transmit( PcapDevice device, bool synchronize) { if(!device.PcapOpened) throw new PcapException("Can't transmit queue, the pcap device is closed."); if(m_queue==IntPtr.Zero) { throw new PcapException("Can't transmit queue, this queue is disposed"); } int sync = synchronize ? 1 : 0; return SharpPcap.pcap_sendqueue_transmit(device.PcapHandle, m_queue, sync); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { int index = comboBox1.SelectedIndex; dev = devices[index]; this.propertyGrid1.SelectedObject = (dev as NetworkDevice); }
public bool Contains(PcapDevice value) { // If value is not of type PcapDevice, this will return false. return(List.Contains(value)); }
public void Remove(PcapDevice value) { List.Remove(value); }
public void Insert(int index, PcapDevice value) { List.Insert(index, value); }
public int IndexOf(PcapDevice value) { return(List.IndexOf(value)); }
public int Add(PcapDevice value) { return(List.Add(value)); }
private void buttonOk_Click(object sender, EventArgs e) { this.selectedDevice = this.deviceList[this.comboBoxDevices.SelectedIndex]; this.port = (int)this.numericUpDown1.Value; this.Hide(); }