push fortify reports and analysis file
[ssproject1617.git] / testcms-final-anon / Fortifytestcms-final-anon.bat
1 @echo off
2 REM ###########################################################################
3 REM Script generated by HPE Security Fortify SCA Scan Wizard (c) 2011-2016 Hewlett Packard Enterprise Development LP
4 REM Created on 2016/11/09 09:06:13
5 REM ###########################################################################
6 REM Generated for the following languages:
7 REM Javascript
8 REM PHP
9 REM SQL
10 REM ###########################################################################
11 REM DEBUG - if set to true, runs SCA in debug mode
12 REM SOURCEANALYZER - the name of the SCA executable
13 REM FPR - the name of analysis result file
14 REM BUILDID - the SCA build id
15 REM ARGFILE - the name of the argument file that's extracted and passed to SCA
16 REM BYTECODE_ARGFILE - the name of the argument file for Java Bytecode translation that's extracted and passed to SCA
17 REM MEMORY - the memory settings for SCA
18 REM LAUNCHERSWITCHES - the launcher settings that are used to invoke SCA
19 REM OLDFILENUMBER - this defines the file which contains the number of files within the project, it is automatically generated
20 REM FILENOMAXDIFF - this is the percentage of difference between the number of files which will trigger a warning by the script
21 REM ###########################################################################
22
23 set DEBUG=false
24 set SOURCEANALYZER=sourceanalyzer
25 set FPR="Fortifytestcms-final-anon.fpr"
26 set BUILDID="testcms-final-anon"
27 set ARGFILE="Fortifytestcms-final-anon.bat.args"
28 set BYTECODE_ARGFILE="Fortifytestcms-final-anon.bat.bytecode.args"
29 set MEMORY=-Xmx682M -Xms400M -Xss24M
30 set LAUNCHERSWITCHES=""
31 set OLDFILENUMBER=Fortifytestcms-final-anon.bat.fileno
32 set FILENOMAXDIFF=10
33 set ENABLE_BYTECODE=false
34
35 set PROJECTROOT0="C:\Users\mrl\Desktop\ssproject1617\testcms-final-anon"
36 IF NOT EXIST %PROJECTROOT0% (
37 ECHO ERROR: This script is being run on a different machine than it was
38 ECHO generated on or the targeted project has been moved. This script is
39 ECHO configured to locate files at
40 ECHO %PROJECTROOT0%
41 ECHO Please modify the %%PROJECTROOT0%% variable found
42 ECHO at the top of this script to point to the corresponding directory
43 ECHO located on this machine.
44 GOTO :FINISHED
45 )
46
47 IF %DEBUG%==true set LAUNCHERSWITCHES=-debug %LAUNCHERSWITCHES%
48 echo Extracting Arguments File
49
50
51 echo. >%ARGFILE%
52 echo. >%BYTECODE_ARGFILE%
53 SETLOCAL ENABLEDELAYEDEXPANSION
54 IF EXIST %0 (
55 set SCAScriptFile=%0
56 ) ELSE (
57 set SCAScriptFile=%0.bat
58 )
59
60 set PROJECTROOT0=%PROJECTROOT0:)=^)%
61 FOR /f "delims=" %%a IN ('findstr /B /C:"REM ARGS" %SCAScriptFile%' ) DO (
62 set argVal=%%a
63 set argVal=!argVal:PROJECTROOT0_MARKER=%PROJECTROOT0:~1,-1%!
64 echo !argVal:~9! >> %ARGFILE%
65 )
66 set PROJECTROOT0=%PROJECTROOT0:)=^)%
67 FOR /f "delims=" %%a IN ('findstr /B /C:"REM BYTECODE_ARGS" %SCAScriptFile%' ) DO (
68 set ENABLE_BYTECODE=true
69 set argVal=%%a
70 set argVal=!argVal:PROJECTROOT0_MARKER=%PROJECTROOT0:~1,-1%!
71 echo !argVal:~18! >> %BYTECODE_ARGFILE%
72 )
73 ENDLOCAL && set ENABLE_BYTECODE=%ENABLE_BYTECODE%
74
75 REM ###########################################################################
76 echo Cleaning previous scan artifacts
77 %SOURCEANALYZER% %MEMORY% %LAUNCHERSWITCHES% -b %BUILDID% -clean
78 IF %ERRORLEVEL%==1 (
79 echo Sourceanalyzer failed, exiting
80 GOTO :FINISHED
81 )
82 REM ###########################################################################
83 echo Translating files
84 %SOURCEANALYZER% %MEMORY% %LAUNCHERSWITCHES% -b %BUILDID% @%ARGFILE%
85 IF %ERRORLEVEL%==1 (
86 echo Sourceanalyzer failed, exiting
87 GOTO :FINISHED
88 )
89 REM ###########################################################################
90 IF %ENABLE_BYTECODE%==true (
91 echo Translating Java bytecode files
92 %SOURCEANALYZER% %MEMORY% %LAUNCHERSWITCHES% -b %BUILDID% @%BYTECODE_ARGFILE%
93 IF %ERRORLEVEL%==1 (
94 echo Sourceanalyzer failed, exiting
95 GOTO :FINISHED
96 )
97 )
98 REM ###########################################################################
99 echo Testing Difference between Translations
100 SETLOCAL
101 FOR /F "delims=" %%A in ('%SOURCEANALYZER% -b %BUILDID% -show-files ^| findstr /R /N "^" ^| find /C ":" ') DO SET FILENUMBER=%%A
102 IF NOT EXIST %OLDFILENUMBER% (
103 ECHO It appears to be the first time running this script, setting %OLDFILENUMBER% to %FILENUMBER%
104 ECHO %FILENUMBER% > %OLDFILENUMBER%
105 GOTO TESTENDED
106 )
107
108 FOR /F "delims=" %%i IN (%OLDFILENUMBER%) DO SET OLDFILENO=%%i
109 set /a DIFF=%OLDFILENO% * %FILENOMAXDIFF%
110 set /a DIFF /= 100
111 set /a MAX=%OLDFILENO% + %DIFF%
112 set /a MIN=%OLDFILENO% - %DIFF%
113
114 IF %FILENUMBER% LSS %MIN% set SHOWWARNING=true
115 IF %FILENUMBER% GTR %MAX% set SHOWWARNING=true
116
117 IF DEFINED SHOWWARNING (
118 ECHO WARNING: The number of files has changed by over %FILENOMAXDIFF%%%, it is recommended
119 ECHO that this script is regenerated with the ScanWizard
120 )
121 :TESTENDED
122 ENDLOCAL
123
124 REM ###########################################################################
125 echo Starting scan
126 %SOURCEANALYZER% %MEMORY% %LAUNCHERSWITCHES% -b %BUILDID% -scan -f %FPR%
127 IF %ERRORLEVEL%==1 (
128 echo Sourceanalyzer failed, exiting
129 GOTO :FINISHED
130 )
131 REM ###########################################################################
132 echo Finished
133 :FINISHED
134 REM ARGS "-Dcom.fortify.sca.fileextensions.sql=PLSQL"
135 REM ARGS "PROJECTROOT0_MARKER"