Link to home
Start Free TrialLog in
Avatar of SEWS-E
SEWS-EFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Wireshark vbscript does not run when using capture filter parameters

Hi,

I'm writing a vbscript to automate wireshark captures using dumpcap.exe, but i've hit a bit of a stumbling block when I try to use a capture filter in the code.

The bit of code below runs and works ok.
Const ForAppending = 8

Set objShell = CreateObject("WScript.Shell")

Set objWshScriptExec = objShell.Exec("C:\Program Files\Wireshark\dumpcap.exe -a duration:15 -w C:\wireshark.pcap")

Open in new window


When I add a capture filter '-f net 10.44.4.0/23' into the objShell.Exec command parameters, the vbscript runs and then promptly closes without running wireshark.
Const ForAppending = 8

Set objShell = CreateObject("WScript.Shell")

Set objWshScriptExec = objShell.Exec("C:\Program Files\Wireshark\dumpcap.exe -f net 10.44.4.0/23 -a duration:15 -w C:\wireshark.pcap")

Open in new window


If I run
I'm guessing there's a syntax error in the command and it needs some quotes wrapping around something, but I can't figure out where or what!

If anyone could point me in the right direction that would be great.

Thanks,

Paul
Avatar of SEWS-E
SEWS-E
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Also, if I run the below from the command line it works;

dumpcap.exe -f "net 10.44.4.0/23" -a duration:15 -w C:\test.pcap

Thanks,

Paul
ASKER CERTIFIED SOLUTION
Avatar of SEWS-E
SEWS-E
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial