Solved

Wireshark vbscript does not run when using capture filter parameters

Posted on 2012-04-11
2
842 Views
Last Modified: 2012-04-11
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
0
Comment
Question by:SEWS-E
  • 2
2 Comments
 
LVL 2

Author Comment

by:SEWS-E
ID: 37832991
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
0
 
LVL 2

Accepted Solution

by:
SEWS-E earned 0 total points
ID: 37833299
Ok I figured it out. The syntax needs to look like this:

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

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Use of TCL script on Cisco devices:  - create file and merge it with running configuration to apply configuration changes
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question