()
| 482 | logger.warning(warnMsg) |
| 483 | |
| 484 | def _findPageForms(): |
| 485 | if not conf.forms or conf.crawlDepth: |
| 486 | return |
| 487 | |
| 488 | if conf.url and not checkConnection(): |
| 489 | return |
| 490 | |
| 491 | found = False |
| 492 | infoMsg = "searching for forms" |
| 493 | logger.info(infoMsg) |
| 494 | |
| 495 | if not any((conf.bulkFile, conf.googleDork)): |
| 496 | page, _, _ = Request.queryPage(content=True, ignoreSecondOrder=True) |
| 497 | if findPageForms(page, conf.url, True, True): |
| 498 | found = True |
| 499 | else: |
| 500 | if conf.bulkFile: |
| 501 | targets = getFileItems(conf.bulkFile) |
| 502 | elif conf.googleDork: |
| 503 | targets = [_[0] for _ in kb.targets] |
| 504 | kb.targets.clear() |
| 505 | else: |
| 506 | targets = [] |
| 507 | |
| 508 | for i in xrange(len(targets)): |
| 509 | try: |
| 510 | target = targets[i].strip() |
| 511 | |
| 512 | if not re.search(r"(?i)\Ahttp[s]*://", target): |
| 513 | target = "http://%s" % target |
| 514 | |
| 515 | page, _, _ = Request.getPage(url=target.strip(), cookie=conf.cookie, crawling=True, raise404=False) |
| 516 | if findPageForms(page, target, False, True): |
| 517 | found = True |
| 518 | |
| 519 | if conf.verbose in (1, 2): |
| 520 | status = '%d/%d links visited (%d%%)' % (i + 1, len(targets), round(100.0 * (i + 1) / len(targets))) |
| 521 | dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status), True) |
| 522 | except KeyboardInterrupt: |
| 523 | break |
| 524 | except Exception as ex: |
| 525 | errMsg = "problem occurred while searching for forms at '%s' ('%s')" % (target, getSafeExString(ex)) |
| 526 | logger.error(errMsg) |
| 527 | |
| 528 | if not found: |
| 529 | warnMsg = "no forms found" |
| 530 | logger.warning(warnMsg) |
| 531 | |
| 532 | def _setDBMSAuthentication(): |
| 533 | """ |
no test coverage detected
searching dependent graphs…