Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8599005

Browse files
committed
Implementation for an Issue #771
1 parent 208d51e commit 8599005

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

lib/core/option.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -571,11 +571,11 @@ def retrieve():
571571
if re.search(r"(.*?)\?(.+)", link):
572572
kb.targets.add((link, conf.method, conf.data, conf.cookie))
573573
elif re.search(URI_INJECTABLE_REGEX, link, re.I):
574-
if kb.data.onlyGETs is None and conf.data is None:
574+
if kb.data.onlyGETs is None and conf.data is None and not conf.googleDork:
575575
message = "do you want to scan only results containing GET parameters? [Y/n] "
576576
test = readInput(message, default="Y")
577577
kb.data.onlyGETs = test.lower() != 'n'
578-
if not kb.data.onlyGETs:
578+
if not kb.data.onlyGETs or conf.googleDork:
579579
kb.targets.add((link, conf.method, conf.data, conf.cookie))
580580

581581
return links
@@ -659,14 +659,17 @@ def _findPageForms():
659659
infoMsg = "searching for forms"
660660
logger.info(infoMsg)
661661

662-
if not any((conf.bulkFile, conf.sitemapUrl)):
662+
if not any((conf.bulkFile, conf.googleDork, conf.sitemapUrl)):
663663
page, _ = Request.queryPage(content=True)
664664
findPageForms(page, conf.url, True, True)
665665
else:
666666
if conf.bulkFile:
667667
targets = getFileItems(conf.bulkFile)
668-
else:
668+
elif conf.sitemapUrl:
669669
targets = parseSitemap(conf.sitemapUrl)
670+
elif conf.googleDork:
671+
targets = [_[0] for _ in kb.targets]
672+
kb.targets.clear()
670673
for i in xrange(len(targets)):
671674
try:
672675
target = targets[i]
@@ -676,6 +679,8 @@ def _findPageForms():
676679
if conf.verbose in (1, 2):
677680
status = '%d/%d links visited (%d%%)' % (i + 1, len(targets), round(100.0 * (i + 1) / len(targets)))
678681
dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status), True)
682+
except KeyboardInterrupt:
683+
break
679684
except Exception, ex:
680685
errMsg = "problem occurred while searching for forms at '%s' ('%s')" % (target, ex)
681686
logger.error(errMsg)
@@ -2168,8 +2173,8 @@ def _basicOptionValidation():
21682173
errMsg = "maximum number of used threads is %d avoiding potential connection issues" % MAX_NUMBER_OF_THREADS
21692174
raise SqlmapSyntaxException(errMsg)
21702175

2171-
if conf.forms and not any((conf.url, conf.bulkFile, conf.sitemapUrl)):
2172-
errMsg = "switch '--forms' requires usage of option '-u' ('--url'), '-m' or '-x'"
2176+
if conf.forms and not any((conf.url, conf.googleDork, conf.bulkFile, conf.sitemapUrl)):
2177+
errMsg = "switch '--forms' requires usage of option '-u' ('--url'), '-g', '-m' or '-x'"
21732178
raise SqlmapSyntaxException(errMsg)
21742179

21752180
if conf.requestFile and conf.url and conf.url != DUMMY_URL:

0 commit comments

Comments
 (0)