|
56 | 56 | from lib.core.exception import SqlmapNotVulnerableException |
57 | 57 | from lib.core.exception import SqlmapSilentQuitException |
58 | 58 | from lib.core.exception import SqlmapSkipTargetException |
| 59 | +from lib.core.exception import SqlmapSystemException |
59 | 60 | from lib.core.exception import SqlmapValueException |
60 | 61 | from lib.core.exception import SqlmapUserQuitException |
61 | 62 | from lib.core.settings import ASP_NET_CONTROL_REGEX |
@@ -243,16 +244,20 @@ def _saveToResultsFile(): |
243 | 244 |
|
244 | 245 | results[key].extend(injection.data.keys()) |
245 | 246 |
|
246 | | - for key, value in results.items(): |
247 | | - place, parameter, notes = key |
248 | | - line = "%s,%s,%s,%s,%s%s" % (safeCSValue(kb.originalUrls.get(conf.url) or conf.url), place, parameter, "".join(techniques[_][0].upper() for _ in sorted(value)), notes, os.linesep) |
249 | | - conf.resultsFP.write(line) |
| 247 | + try: |
| 248 | + for key, value in results.items(): |
| 249 | + place, parameter, notes = key |
| 250 | + line = "%s,%s,%s,%s,%s%s" % (safeCSValue(kb.originalUrls.get(conf.url) or conf.url), place, parameter, "".join(techniques[_][0].upper() for _ in sorted(value)), notes, os.linesep) |
| 251 | + conf.resultsFP.write(line) |
250 | 252 |
|
251 | | - if not results: |
252 | | - line = "%s,,,,%s" % (conf.url, os.linesep) |
253 | | - conf.resultsFP.write(line) |
| 253 | + if not results: |
| 254 | + line = "%s,,,,%s" % (conf.url, os.linesep) |
| 255 | + conf.resultsFP.write(line) |
254 | 256 |
|
255 | | - conf.resultsFP.flush() |
| 257 | + conf.resultsFP.flush() |
| 258 | + except IOError, ex: |
| 259 | + errMsg = "unable to write to the results file '%s' ('%s'). " % (conf.resultsFilename, getSafeExString(ex)) |
| 260 | + raise SqlmapSystemException(errMsg) |
256 | 261 |
|
257 | 262 | @stackedmethod |
258 | 263 | def start(): |
|
0 commit comments