@@ -19,26 +19,32 @@ public QualysWASScanStatusService(WASClient client) {
19
19
* @param scanId
20
20
* @return
21
21
*/
22
- public String fetchScanStatus (String scanId , String portalUrl , int INTERVAL , int TIMEOUT ) {
22
+ public String fetchScanStatus (String scanId , String scanType , boolean severityCheck , String portalUrl , int INTERVAL , int TIMEOUT ) {
23
23
long startTime = System .currentTimeMillis ();
24
24
long timeoutInMillis = TimeUnit .MINUTES .toMillis (TIMEOUT );
25
25
long intervalInMillis = TimeUnit .MINUTES .toMillis (INTERVAL );
26
- String status = null ;
26
+ String status = "" ;
27
+ boolean failed = false ;
27
28
28
29
try {
29
30
while ((status = client .getScanFinishedStatus (scanId )) == null ) {
30
31
long endTime = System .currentTimeMillis ();
31
32
if ((endTime - startTime ) > timeoutInMillis ) {
32
- logger .info ("Failed to get scan result; timeout of " + TIMEOUT + " minutes reached." );
33
33
String message1 = "Failed to get scan result; timeout of " + TIMEOUT + " minutes reached." ;
34
34
String message2 = "Please switch to WAS Classic UI and Check for report..." ;
35
35
String message3 = "To check scan result, please follow the url: " + portalUrl + "/portal-front/module/was/#forward=/module/was/&scan-report=" + scanId ;
36
36
logger .info (message1 );
37
37
logger .info (message2 );
38
38
logger .info (message3 );
39
- String message = message1 + "\n " + message2 + "\n " + message3 ;
40
- Helper .dumpDataIntoFile (message , "Qualys_Wasscan_" + scanId + ".txt" );
41
- System .exit (1 );
39
+ if (scanType .equalsIgnoreCase ("vulnerability" ) && severityCheck ) {
40
+ failed = true ;
41
+ }
42
+ if (failed ) {
43
+ String message = message1 + "\n " + message2 + "\n " + message3 ;
44
+ Helper .dumpDataIntoFile (message , "Qualys_Wasscan_" + scanId + ".txt" );
45
+ System .exit (1 );
46
+ }
47
+ break ;
42
48
} else {
43
49
try {
44
50
logger .info ("Waiting for " + INTERVAL + " minute(s) before making next attempt for scanResult of scanId:" + scanId + "..." );
0 commit comments