|
8 | 8 | from __future__ import division |
9 | 9 |
|
10 | 10 | import codecs |
| 11 | +import collections |
11 | 12 | import functools |
12 | 13 | import glob |
13 | 14 | import inspect |
@@ -416,28 +417,39 @@ def _setBulkMultipleTargets(): |
416 | 417 | if not conf.bulkFile: |
417 | 418 | return |
418 | 419 |
|
419 | | - conf.bulkFile = safeExpandUser(conf.bulkFile) |
| 420 | + if isinstance(conf.bulkFile, collections.Iterable): |
| 421 | + def _(): |
| 422 | + for line in conf.bulkFile: |
| 423 | + if line: |
| 424 | + match = re.search(r"\bhttps?://[^\s'\"]+", line, re.I) |
| 425 | + if match: |
| 426 | + yield (match.group(0), conf.method, conf.data, conf.cookie, None) |
| 427 | + else: |
| 428 | + break |
| 429 | + kb.targets = _() |
| 430 | + else: |
| 431 | + conf.bulkFile = safeExpandUser(conf.bulkFile) |
420 | 432 |
|
421 | | - infoMsg = "parsing multiple targets list from '%s'" % conf.bulkFile |
422 | | - logger.info(infoMsg) |
| 433 | + infoMsg = "parsing multiple targets list from '%s'" % conf.bulkFile |
| 434 | + logger.info(infoMsg) |
423 | 435 |
|
424 | | - if not checkFile(conf.bulkFile, False): |
425 | | - errMsg = "the specified bulk file " |
426 | | - errMsg += "does not exist" |
427 | | - raise SqlmapFilePathException(errMsg) |
| 436 | + if not checkFile(conf.bulkFile, False): |
| 437 | + errMsg = "the specified bulk file " |
| 438 | + errMsg += "does not exist" |
| 439 | + raise SqlmapFilePathException(errMsg) |
428 | 440 |
|
429 | | - found = False |
430 | | - for line in getFileItems(conf.bulkFile): |
431 | | - if conf.scope and not re.search(conf.scope, line, re.I): |
432 | | - continue |
| 441 | + found = False |
| 442 | + for line in getFileItems(conf.bulkFile): |
| 443 | + if conf.scope and not re.search(conf.scope, line, re.I): |
| 444 | + continue |
433 | 445 |
|
434 | | - if re.match(r"[^ ]+\?(.+)", line, re.I) or kb.customInjectionMark in line: |
435 | | - found = True |
436 | | - kb.targets.add((line.strip(), conf.method, conf.data, conf.cookie, None)) |
| 446 | + if re.match(r"[^ ]+\?(.+)", line, re.I) or kb.customInjectionMark in line: |
| 447 | + found = True |
| 448 | + kb.targets.add((line.strip(), conf.method, conf.data, conf.cookie, None)) |
437 | 449 |
|
438 | | - if not found and not conf.forms and not conf.crawlDepth: |
439 | | - warnMsg = "no usable links found (with GET parameters)" |
440 | | - logger.warn(warnMsg) |
| 450 | + if not found and not conf.forms and not conf.crawlDepth: |
| 451 | + warnMsg = "no usable links found (with GET parameters)" |
| 452 | + logger.warn(warnMsg) |
441 | 453 |
|
442 | 454 | def _findPageForms(): |
443 | 455 | if not conf.forms or conf.crawlDepth: |
@@ -1631,7 +1643,8 @@ def _cleanupOptions(): |
1631 | 1643 |
|
1632 | 1644 | for key, value in conf.items(): |
1633 | 1645 | if value and any(key.endswith(_) for _ in ("Path", "File", "Dir")): |
1634 | | - conf[key] = safeExpandUser(value) |
| 1646 | + if isinstance(value, str): |
| 1647 | + conf[key] = safeExpandUser(value) |
1635 | 1648 |
|
1636 | 1649 | if conf.testParameter: |
1637 | 1650 | conf.testParameter = urldecode(conf.testParameter) |
|
0 commit comments