WebInspect CLI Report Generation

Hello, I'm new to the community and my question is regarding the possibility of running a command to start a scan and then creating a new report with a new name each and every time that command is ran in the CLI without editing the command to create a new report with a different name each time I run it. I'm trying to create a basic batch file that when ran, after completing the scan it generates a new report with a different name each time I run it without any other user input. Currently, the only way I can generate a report with a different name after a scan is by specifying the name I want to use manually each time. That complicates things since I want to use my batch file as a simple automation solution. Any help is welcomed. Thanks.

  • Verified Answer

    In your WI.exe command line, you can use the -f switch to define the path and filename. Then you can add something similar to the following in the batch file that will set the date and time to be included in the -f switch for the unique filename.

    echo off
    set CUR_YYYY=%date:~10,4%
    set CUR_MM=%date:~4,2%
    set CUR_DD=%date:~7,2%
    set CUR_HH=%time:~0,2%
    if %CUR_HH% lss 10 (set CUR_HH=0%time:~1,1%)
    
    set CUR_NN=%time:~3,2%
    set CUR_SS=%time:~6,2%
    set CUR_MS=%time:~9,2%
    
    set SUBFILENAME=%CUR_YYYY%%CUR_MM%%CUR_DD%-%CUR_HH%%CUR_NN%%CUR_SS%
    
    "C:\Program Files\Fortify\Fortify WebInspect\wi.exe" -u http://zero.webappsecurity.com -r Vulnerability -y Standard -f c:\temp\%SUBFILENAME%.pdf -gp

  • Thanks for the suggestion. This actually worked perfectly for my situation. I was able to run the script and it completed the scan, created the pdf and appended the current date and time to de file name.