ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Wireshark-users: [Wireshark-users] Launching Wireshark from .NET and reading pcap data from stdin

From: Jim Balo <jimbalo22@xxxxxxxxx>
Date: Sat, 11 Oct 2008 09:45:41 -0700 (PDT)
Hi,
 
I working on a .NET app to help analyze pcap files.  I am trying to figure out how to launch Wireshark and pass it the pcap data via standard in.  Here is what I tried:
 
Process process = new Process();
process.StartInfo.FileName = @"C:\Program Files\Wireshark\wireshark.exe";
process.StartInfo.Arguments = "-k -i -";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardInput = true;
process.Start();
stream.Write(packetArray, 0, packetArray.Length); // packetArray is byte array of raw packet data, including pcap header, etc.
process.Close()
 
Wireshark starts just fine, but it does not read what I send to stdin (in the status bar, it says, "Waiting for capture data...")
 
Any help on this would be great!
 
Thanks,
JB