Can not record with tshark

Ask general questions here.
rastek
Posts: 182
Joined: Wed Aug 06, 2014 12:00 pm

Can not record with tshark

Post by rastek » Tue Nov 17, 2020 6:27 am

Hello all,

I tried few ways but can not record anything, code does not give an error but there is not captured file et all. I hope someone can help me on this
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = @"C:\Program Files\wireshark\tshark ";
psi.Arguments = "-i vEthernet -w capture-output.pcap";
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.CreateNoWindow = true;
Process tsharkProcess = Process.Start(psi);
string s = tsharkProcess.StandardOutput.ReadToEnd();
Console.WriteLine(s);

Delay.Duration(10000, false);

tsharkProcess.Kill();

I also tried to run in a cmd but did not help (I can paste code here, forum does not accept)

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6360
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Can not record with tshark

Post by odklizec » Wed Nov 18, 2020 9:51 am

Hi,

Two things...
Have you tried to run the wireshark command line you are using in code via Windows CMD? Just make sure if wireshark itself works as expected.

If the cmd line itself works OK in Windows CMD window, then debug your code (line by line) and make sure that below line produces correct (error-less) process...

Code: Select all

Process tsharkProcess = Process.Start(psi);
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration