Solved

Wireshark vbscript does not run when using capture filter parameters

Posted on 2012-04-11
2
829 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

A Wildcard Certificate means all of your sub-domains will resolve to the same location, regardless of the non-SSL Document-Root specification. A user will need to purchase a wildcard SSL from a vendor or a reseller that supplies them. Similar to ha…
So, you're experiencing issues on your network and you've decided that you need to perform some tests to determine whether your cabling is good.  You're likely thinking that you may need to spend money which you probably don't have on hiring/purchas…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

867 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now