2014-04-17 78 views
0

我得到的错误:“tshark:无效捕获过滤器”> test1.txt“接口NetToAutomationSlave!”无效捕获过滤器

private void OpenTWireShark() 
    { 
     string path = string.Format(@"-i 3 -Y ip.src==192.168.20.100 > test1.txt"); 
     ProcessStartInfo cmdStartInfo = new ProcessStartInfo(); 
     cmdStartInfo.FileName = @"C:\Program Files\Wireshark\tshark.exe"; 
     cmdStartInfo.RedirectStandardOutput = true; 
     cmdStartInfo.RedirectStandardError = true; 
     cmdStartInfo.RedirectStandardInput = true; 
     cmdStartInfo.UseShellExecute = false; 
     cmdStartInfo.CreateNoWindow = true; 
     cmdStartInfo.Arguments = path; 

     Process cmdProcess = new Process(); 
     cmdProcess.StartInfo = cmdStartInfo; 
     cmdProcess.ErrorDataReceived += cmd_Error; 
     cmdProcess.OutputDataReceived += cmd_DataReceived; 

     cmdProcess.EnableRaisingEvents = true; 

     cmdProcess.Start(); 

     cmdProcess.BeginOutputReadLine(); 
     cmdProcess.BeginErrorReadLine(); 

     cmdProcess.WaitForExit(); 

回答

0

您不能使用> test1.txt作为参数重定向标准输出。 您需要使用OutputDataReceived事件中的数据并将其记录到您的txt文件中

+0

当Im试图从OutputDataReceived中读取即时消息只获取行号而不是过滤器时。 ???例如:如果我试图将此行作为参数:“-i 3 -Y ip.src == 192.168.20.100”get中的输出为“1” – user216773

相关问题