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 store -->  capinfos.exe -u c:\file.pcap   --> in a var s ?

 

https://www.wireshark.org/docs/wsug_html_chunked/AppToolscapinfos.html

 

 

  • 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);
    }
    }

7 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    Are you trying to log the result that's in your var S?

    • fazlook's avatar
      fazlook
      Frequent Contributor

      Yes, I want to log it & also compare it to another value. This is how it shows in CMD

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        What file type is capinfos returning to you?