[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Wireshark vbscript does not run when using capture filter parameters

Posted on 2012-04-11
2
Medium Priority
?
961 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Transparency shows that a company is the kind of business that it wants people to think it is.
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses
Course of the Month19 days, 21 hours left to enroll

873 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