WireShark Capinfos to capture pcap data
- 7 years ago
I made it :)
function returnCaptureDuration(sFilePath)
{
try
{
//u=Dration,T=Table report, m=Separates the infos by comma, Q=Quote infos with double quotes, r=Do not generate a header record
var sCmdLine = CAPINFOS_PATH + " -uTmQr " + sFilePath;
var WshShell = Sys.OleObject("WScript.Shell");
var Result = WshShell.Exec(sCmdLine);
//Check Exit code (1 is bad, 0 is good & we have an output)
if (Result.ExitCode != 0)
{
Log.Error("The running of the following command has failed: " + sCmdLine);
}
//we always have 1 output, return it
var sOutput = Result.StdOut.ReadLine();
Log.Message("Display output is: " + sOutput);
sOutput = aqString.Replace(sOutput.split(",")[1], "\"", "");
var iDuration = aqConvert.StrToInt(sOutput);
Log.Checkpoint("Duration is: " + iDuration + " seconds");
return iDuration;
}
catch (e)
{
ErrorHandling.logTestException(arguments.callee, e);
}
}