|
12 | 12 | from lib.core.common import dataToSessionFile |
13 | 13 | from lib.core.common import formatFingerprintString |
14 | 14 | from lib.core.common import readInput |
| 15 | +from lib.core.convert import base64pickle |
| 16 | +from lib.core.convert import base64unpickle |
15 | 17 | from lib.core.data import conf |
16 | 18 | from lib.core.data import kb |
17 | 19 | from lib.core.data import logger |
@@ -78,30 +80,15 @@ def setInjection(inj): |
78 | 80 | session file. |
79 | 81 | """ |
80 | 82 |
|
81 | | - if inj.place == PLACE.UA: |
82 | | - inj.parameter = conf.agent |
83 | | - |
84 | 83 | condition = ( |
85 | 84 | ( not kb.resumedQueries |
86 | 85 | or ( kb.resumedQueries.has_key(conf.url) and |
87 | | - ( not kb.resumedQueries[conf.url].has_key("Injection point") |
88 | | - or not kb.resumedQueries[conf.url].has_key("Injection parameter") |
89 | | - ) ) ) |
| 86 | + not kb.resumedQueries[conf.url].has_key("Injection data") |
| 87 | + ) ) |
90 | 88 | ) |
91 | 89 |
|
92 | 90 | if condition: |
93 | | - dataToSessionFile("[%s][%s][%s][Injection point][%s]\n" % (conf.url, inj.place, safeFormatString(conf.parameters[inj.place]), inj.place)) |
94 | | - dataToSessionFile("[%s][%s][%s][Injection parameter][%s]\n" % (conf.url, inj.place, safeFormatString(conf.parameters[inj.place]), inj.parameter)) |
95 | | - dataToSessionFile("[%s][%s][%s][Injection parameter type][%s]\n" % (conf.url, inj.place, safeFormatString(conf.parameters[inj.place]), PAYLOAD.PARAMETER[inj.ptype])) |
96 | | - dataToSessionFile("[%s][%s][%s][Injection prefix][%s]\n" % (conf.url, inj.place, safeFormatString(conf.parameters[inj.place]), inj.prefix)) |
97 | | - dataToSessionFile("[%s][%s][%s][Injection suffix][%s]\n" % (conf.url, inj.place, safeFormatString(conf.parameters[inj.place]), inj.suffix)) |
98 | | - |
99 | | - for stype, sdata in inj.data.items(): |
100 | | - dataToSessionFile("[%s][%s][%s][Injection type][%s]\n" % (conf.url, inj.place, safeFormatString(conf.parameters[inj.place]), PAYLOAD.SQLINJECTION[stype])) |
101 | | - dataToSessionFile("[%s][%s][%s][Injection title][%s]\n" % (conf.url, inj.place, safeFormatString(conf.parameters[inj.place]), sdata[0])) |
102 | | - dataToSessionFile("[%s][%s][%s][Injection payload][%s]\n" % (conf.url, inj.place, safeFormatString(conf.parameters[inj.place]), sdata[1])) |
103 | | - dataToSessionFile("[%s][%s][%s][Injection where][%s]\n" % (conf.url, inj.place, safeFormatString(conf.parameters[inj.place]), sdata[2])) |
104 | | - dataToSessionFile("[%s][%s][%s][Injection comment][%s]\n" % (conf.url, inj.place, safeFormatString(conf.parameters[inj.place]), sdata[3])) |
| 91 | + dataToSessionFile("[%s][%s][%s][Injection data][%s]\n" % (conf.url, inj.place, safeFormatString(conf.parameters[inj.place]), base64pickle(inj))) |
105 | 92 |
|
106 | 93 | def setDbms(dbms): |
107 | 94 | """ |
@@ -370,96 +357,11 @@ def resumeConfKb(expression, url, value): |
370 | 357 | except ValueError: |
371 | 358 | pass |
372 | 359 |
|
373 | | - elif expression == "Injection point" and url == conf.url: |
374 | | - injPlace = value[:-1] |
375 | | - |
376 | | - logMsg = "resuming injection point '%s' from session file" % injPlace |
377 | | - logger.info(logMsg) |
378 | | - |
379 | | - if not conf.paramDict.has_key(injPlace): |
380 | | - warnMsg = "none of the parameters you provided " |
381 | | - warnMsg += "matches the resumable injection point. " |
382 | | - warnMsg += "sqlmap is going to reidentify the " |
383 | | - warnMsg += "injectable point" |
384 | | - logger.warn(warnMsg) |
385 | | - else: |
386 | | - if kb.injection.place is not None and kb.injection.parameter is not None: |
387 | | - kb.injections.append(kb.injection) |
388 | | - kb.injection = injectionDict() |
389 | | - |
390 | | - kb.injection.place = injPlace |
391 | | - |
392 | | - elif expression == "Injection parameter" and url == conf.url: |
393 | | - injParameter = unSafeFormatString(value[:-1]) |
394 | | - |
395 | | - logMsg = "resuming injection parameter '%s' from session file" % injParameter |
396 | | - logger.info(logMsg) |
397 | | - |
398 | | - condition = ( |
399 | | - not conf.paramDict.has_key(kb.injection.place) or |
400 | | - not conf.paramDict[kb.injection.place].has_key(injParameter) |
401 | | - ) |
402 | | - |
403 | | - if condition: |
404 | | - warnMsg = "none of the parameters you provided " |
405 | | - warnMsg += "matches the resumable injection parameter. " |
406 | | - warnMsg += "sqlmap is going to reidentify the " |
407 | | - warnMsg += "injectable point" |
408 | | - logger.warn(warnMsg) |
409 | | - else: |
410 | | - kb.injection.parameter = injParameter |
411 | | - |
412 | | - elif expression == "Injection parameter type" and url == conf.url: |
413 | | - kb.injection.ptype = unSafeFormatString(value[:-1]) |
414 | | - |
415 | | - logMsg = "resuming injection parameter type '%s' from session file" % kb.injection.ptype |
416 | | - logger.info(logMsg) |
417 | | - |
418 | | - elif expression == "Injection prefix" and url == conf.url: |
419 | | - kb.injection.prefix = unSafeFormatString(value[:-1]) |
420 | | - |
421 | | - logMsg = "resuming injection prefix '%s' from session file" % kb.injection.prefix |
422 | | - logger.info(logMsg) |
423 | | - |
424 | | - elif expression == "Injection suffix" and url == conf.url: |
425 | | - kb.injection.suffix = unSafeFormatString(value[:-1]) |
426 | | - |
427 | | - logMsg = "resuming injection suffix '%s' from session file" % kb.injection.suffix |
428 | | - logger.info(logMsg) |
429 | | - |
430 | | - elif expression == "Injection type" and url == conf.url: |
431 | | - stype = unSafeFormatString(value[:-1]) |
432 | | - kb.injection.data[stype] = [] |
433 | | - |
434 | | - logMsg = "resuming injection type '%s' from session file" % stype |
435 | | - logger.info(logMsg) |
436 | | - |
437 | | - elif expression == "Injection title" and url == conf.url: |
438 | | - title = unSafeFormatString(value[:-1]) |
439 | | - kb.injection.data[kb.injection.data.keys()[0]].append(title) |
440 | | - |
441 | | - logMsg = "resuming injection title '%s' from session file" % title |
442 | | - logger.info(logMsg) |
443 | | - |
444 | | - elif expression == "Injection payload" and url == conf.url: |
445 | | - payload = unSafeFormatString(value[:-1]) |
446 | | - kb.injection.data[kb.injection.data.keys()[0]].append(payload) |
447 | | - |
448 | | - logMsg = "resuming injection payload '%s' from session file" % payload |
449 | | - logger.info(logMsg) |
450 | | - |
451 | | - elif expression == "Injection where" and url == conf.url: |
452 | | - where = unSafeFormatString(value[:-1]) |
453 | | - kb.injection.data[kb.injection.data.keys()[0]].append(where) |
454 | | - |
455 | | - logMsg = "resuming injection where '%s' from session file" % where |
456 | | - logger.info(logMsg) |
457 | | - |
458 | | - elif expression == "Injection comment" and url == conf.url: |
459 | | - comment = unSafeFormatString(value[:-1]) |
460 | | - kb.injection.data[kb.injection.data.keys()[0]].append(comment) |
| 360 | + elif expression == "Injection data" and url == conf.url: |
| 361 | + injection = base64unpickle(value[:-1]) |
| 362 | + kb.injections.append(injection) |
461 | 363 |
|
462 | | - logMsg = "resuming injection comment '%s' from session file" % comment |
| 364 | + logMsg = "resuming injection data" |
463 | 365 | logger.info(logMsg) |
464 | 366 |
|
465 | 367 | elif expression == "Boolean-based blind injection" and url == conf.url: |
|
0 commit comments