Solved

Wireshark vbscript does not run when using capture filter parameters

Posted on 2012-04-11
2
801 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
Comment Utility
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
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
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 how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

763 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

9 Experts available now in Live!

Get 1:1 Help Now