Developers

console automation with multiple capture templates

A place for developers to exchange information about extending OmniPeek, and ask technical questions about plugins on MyPeek, scripting, and programming.
gpreston
Posts: 6
Joined: Wed May 05, 2010 8:04 am

console automation with multiple capture templates

Postby gpreston » Wed May 05, 2010 8:26 am

Hey all, was hoping someone could help me along here. I'd like some help with something I'm trying to achieve. Using the original example for the Peek COM Interface with Visual Basic, it was modified a bit to handle a single capture template. This has worked just fine for our needs.

I've begun work in an attempt to have the script dynamically load up every available capture template kept in the appropriate directory structure.

I'm having a lot of problems with this though, and am hoping someone could maybe help me along?

Thank you,

Gabriel

PS: Links to the code will be in my next post, can't post links in my first post on the forums.

gpreston
Posts: 6
Joined: Wed May 05, 2010 8:04 am

RE: console automation with multiple capture templates

Postby gpreston » Wed May 05, 2010 8:27 am

Original working code:

http://pastebin.org/203314

New work-in-progress code:

http://pastebin.org/203310

Spacepacket
Posts: 78
Joined: Thu May 22, 2008 9:36 am

RE: RE: console automation with multiple capture templates

Postby Spacepacket » Thu May 06, 2010 11:20 am

Hi gpreston,

I always like to start with something that works. How about starting with something simpler, and adding to that? That way, you can tell us specifically what is wrong.

-spacepacket

gpreston
Posts: 6
Joined: Wed May 05, 2010 8:04 am

RE: RE: RE: console automation with multiple capture templat

Postby gpreston » Thu May 06, 2010 11:25 am

I provided a simple version of the script that I currently use that handles a single capture template. This one works and is what is currently in use in our production environment.

My current progress on handling more than one capture template is what is in the second script that I shared. It searches the subfolders of the specified directory to find other capture templates, then attempts to just loop through these and tell OmniPeek to open them up. If necessary, I can edit the script to put in some more comments so its a bit easier to follow.

Please let me know if there's something more you need. I've pretty much exhausted my knowledge of VBScript on this, unfortunately.

Spacepacket
Posts: 78
Joined: Thu May 22, 2008 9:36 am

RE: RE: RE: RE: console automation with multiple capture tem

Postby Spacepacket » Mon May 17, 2010 10:49 am

I got your working script to work. It looks like the point of it is to control the capture using peek.cfg. Pretty cool.

My recommendation going forward is to upgrade to OmniEngine for your captures, and automate it using OmniScript. Like the Peek COM API, OmniScript is also COM based, so you can use it from any language that supports COM.

For automation, OmniEngine has many advantages over the OmniPeek Console. Primarily, the OmniEngine is a server, and has no UI. This is better for scripting, allowing you to automate and control the actual capture, instead of the UI that in turn controls the capture.

Also, with OmniScript, your application can automate any number of OmniEngines remotely. Beyond that, the ability to dynamically change captures and filters on the fly provides much better granular control.

In your case, you would not need specialized code in your script to keep the capture alive. Omniscript based scripts use guids to identify existing captures.

-Spacepacket

gpreston
Posts: 6
Joined: Wed May 05, 2010 8:04 am

RE: RE: RE: RE: RE: console automation with multiple capture

Postby gpreston » Mon May 17, 2010 10:51 am

Hmm, okay, I will have to take a look at the OmniEngine and see what I can do with it. In the meantime, I converted our script from VBScript to Perl because of how Perl handles arrays of objects and have had a lot more success with it. I'll still look at OmniEngine though as that may give us better control over all of our boxes.

Spacepacket
Posts: 78
Joined: Thu May 22, 2008 9:36 am

RE: console automation with multiple capture

Postby Spacepacket » Mon May 17, 2010 11:01 am

We do not have a sample of a Perl Script using the Peek COM API yet. Can you share?

We also do not have a sample of a Perl Script using OmniScript yet. We are happy to help you along the way, if you decide to script in Perl against the OmniEngine. From what you have said so far, I think you will like it.

-Spacepacket

gpreston
Posts: 6
Joined: Wed May 05, 2010 8:04 am

RE: RE: console automation with multiple capture

Postby gpreston » Mon May 17, 2010 11:02 am

Of course, once I polish it up and work out the last final kinks I'll be more than happy to share it on here.

gpreston
Posts: 6
Joined: Wed May 05, 2010 8:04 am

RE: RE: RE: console automation with multiple capture

Postby gpreston » Mon May 17, 2010 1:21 pm

I've tried to add in a fair number of comments to explain what's going on, but this is what I came up with to control OmniPeek using Perl. It will recursively search through a directory (c:\scripts) to find all capture templates (*.ctf) and add them to a hash array. If it finds any capture templates, it will...

1) Load OmniPeek if its not already loaded
2) Create the $documents holder
3) Open each capture template and save the returned object to a hash array
4a) Check the c:\scripts\var\peek.cfg file to see if it is set to Capture
4b) Monitor c:\scripts\var\peek.cfg file while it is set to Capture and tell each opened capture template to Start Capture.
4c) When it is no longer set to Capture, tell each opened capture template to Stop Capture.
4d) Loop through 4a-4d until peek.cfg is set to Terminate
5) Tell each opened capture template to close once peek.cfg is set to Terminate

http://pastebin.org/245457

We control the capture status by going into the command prompt and doing an echo Capture > c:\scripts\var\peek.cfg, or echo Terminate, etc.


Return to “Developers”

Who is online

Users browsing this forum: No registered users and 2 guests