4545from lib .core .enums import HASHDB_KEYS
4646from lib .core .enums import HEURISTIC_TEST
4747from lib .core .enums import HTTPMETHOD
48+ from lib .core .enums import NOTE
4849from lib .core .enums import PAYLOAD
4950from lib .core .enums import PLACE
5051from lib .core .exception import SqlmapBaseException
@@ -225,23 +226,23 @@ def _saveToResultsFile():
225226 results = {}
226227 techniques = dict (map (lambda x : (x [1 ], x [0 ]), getPublicTypeMembers (PAYLOAD .TECHNIQUE )))
227228
228- for inj in kb .injections :
229+ for inj in kb .injections + kb . falsePositives :
229230 if inj .place is None or inj .parameter is None :
230231 continue
231232
232- key = (inj .place , inj .parameter )
233+ key = (inj .place , inj .parameter , ';' . join ( inj . notes ) )
233234 if key not in results :
234235 results [key ] = []
235236
236237 results [key ].extend (inj .data .keys ())
237238
238239 for key , value in results .items ():
239- place , parameter = key
240- line = "%s,%s,%s,%s%s " % (safeCSValue (kb .originalUrls .get (conf .url ) or conf .url ), place , parameter , "" .join (map (lambda x : techniques [x ][0 ].upper (), sorted (value ))), os .linesep )
240+ place , parameter , notes = key
241+ line = "%s,%s,%s,%s,%s%s " % (safeCSValue (kb .originalUrls .get (conf .url ) or conf .url ), place , parameter , "" .join (map (lambda x : techniques [x ][0 ].upper (), sorted (value ))), notes , os .linesep )
241242 conf .resultsFP .writelines (line )
242243
243244 if not results :
244- line = "%s,,,%s" % (conf .url , os .linesep )
245+ line = "%s,,,, %s" % (conf .url , os .linesep )
245246 conf .resultsFP .writelines (line )
246247
247248def start ():
@@ -522,7 +523,10 @@ def start():
522523 proceed = not kb .endDetection
523524
524525 if getattr (injection , "place" , None ) is not None :
525- kb .injections .append (injection )
526+ if NOTE .FALSE_POSITIVE_OR_UNEXPLOITABLE in injection .notes :
527+ kb .falsePositives .append (injection )
528+ else :
529+ kb .injections .append (injection )
526530
527531 # In case when user wants to end detection phase (Ctrl+C)
528532 if not proceed :
@@ -651,6 +655,8 @@ def start():
651655 errMsg = getSafeExString (ex )
652656
653657 if conf .multipleTargets :
658+ _saveToResultsFile ()
659+
654660 errMsg += ", skipping to the next %s" % ("form" if conf .forms else "URL" )
655661 logger .error (errMsg )
656662 else :
@@ -669,9 +675,10 @@ def start():
669675 if kb .dataOutputFlag and not conf .multipleTargets :
670676 logger .info ("fetched data logged to text files under '%s'" % conf .outputPath )
671677
672- if conf .multipleTargets and conf .resultsFilename :
673- infoMsg = "you can find results of scanning in multiple targets "
674- infoMsg += "mode inside the CSV file '%s'" % conf .resultsFilename
675- logger .info (infoMsg )
678+ if conf .multipleTargets :
679+ if conf .resultsFilename :
680+ infoMsg = "you can find results of scanning in multiple targets "
681+ infoMsg += "mode inside the CSV file '%s'" % conf .resultsFilename
682+ logger .info (infoMsg )
676683
677684 return True
0 commit comments