private void PipeCreate() { try { WiresharkPipe = new NamedPipeServerStream(pipe_name, PipeDirection.Out, 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous); // Wait WiresharkPipe.WaitForConnection(); // Wireshark Global Header pcap_hdr_g p = new pcap_hdr_g(65535, pcap_netid); byte[] bh = p.ToByteArray(); WiresharkPipe.Write(bh, 0, bh.Length); IsConnected = true; } catch { } }
private void PipeCreate() { try { WiresharkPipe = new NamedPipeServerStream(PipeName, PipeDirection.Out, 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous); } catch (IOException) { Console.WriteLine("[-] Got an IOException while trying to create the output pipe (Is there another sniffer running?)."); Environment.Exit(1); } // Wait WiresharkPipe.WaitForConnection(); // Wireshark Global Header pcap_hdr_g p = new pcap_hdr_g(65535, PcapNetID); byte[] bh = p.ToByteArray(); WiresharkPipe.Write(bh, 0, bh.Length); IsConnected = true; }