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

Skip to content

Commit 4eeeb36

Browse files
committed
asking and skipping to the next google result page if no usable links found
1 parent 1c633b7 commit 4eeeb36

2 files changed

Lines changed: 33 additions & 21 deletions

File tree

lib/core/option.py

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -420,31 +420,43 @@ def __setGoogleDorking():
420420
googleObj = Google(handlers)
421421
googleObj.getCookie()
422422

423-
matches = googleObj.search(conf.googleDork)
423+
def search():
424+
matches = googleObj.search(conf.googleDork)
424425

425-
if not matches:
426-
errMsg = "unable to find results for your "
427-
errMsg += "Google dork expression"
428-
raise sqlmapGenericException, errMsg
426+
if not matches:
427+
errMsg = "unable to find results for your "
428+
errMsg += "Google dork expression"
429+
raise sqlmapGenericException, errMsg
429430

430-
googleObj.getTargetUrls()
431+
googleObj.getTargetUrls()
432+
return matches
431433

432-
if kb.targetUrls:
433-
infoMsg = "sqlmap got %d results for your " % len(matches)
434-
infoMsg += "Google dork expression, "
434+
while True:
435+
matches = search()
436+
if kb.targetUrls:
437+
infoMsg = "sqlmap got %d results for your " % len(matches)
438+
infoMsg += "Google dork expression, "
435439

436-
if len(matches) == len(kb.targetUrls):
437-
infoMsg += "all "
438-
else:
439-
infoMsg += "%d " % len(kb.targetUrls)
440+
if len(matches) == len(kb.targetUrls):
441+
infoMsg += "all "
442+
else:
443+
infoMsg += "%d " % len(kb.targetUrls)
440444

441-
infoMsg += "of them are testable targets"
442-
logger.info(infoMsg)
443-
else:
444-
errMsg = "sqlmap got %d results " % len(matches)
445-
errMsg += "for your Google dork expression, but none of them "
446-
errMsg += "have GET parameters to test for SQL injection"
447-
raise sqlmapGenericException, errMsg
445+
infoMsg += "of them are testable targets"
446+
logger.info(infoMsg)
447+
break
448+
449+
else:
450+
message = "sqlmap got %d results " % len(matches)
451+
message += "for your Google dork expression, but none of them "
452+
message += "have GET parameters to test for SQL injection. "
453+
message += "do you want to skip to the next result page? [Y/n]"
454+
test = readInput(message, default="Y")
455+
456+
if test[0] in ("n", "N"):
457+
raise sqlmapSilentQuitException
458+
else:
459+
conf.googlePage += 1
448460

449461
def __setBulkMultipleTargets():
450462
if not conf.bulkFile:

lib/parse/cmdline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ def cmdLineParser():
503503
action="store_true", default=False,
504504
help="Parse and test forms on target url")
505505

506-
miscellaneous.add_option("--gpage", dest="googlePage", type="int",
506+
miscellaneous.add_option("--gpage", dest="googlePage", default=1, type="int",
507507
help="Use Google dork results from specified page number")
508508

509509
miscellaneous.add_option("--mobile", dest="mobile",

0 commit comments

Comments
 (0)