Forum Discussion

fazlook's avatar
fazlook
Frequent Contributor
6 years ago
Solved

WireShark Capinfos to capture pcap data

Good day,   I am not sure if this is the right place to ask my question as it could be not related to TC.   How do I actually print values displayed out of capinfos.exe ?   say i want to ...
  • fazlook's avatar
    fazlook
    6 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);
    }
    }