From eaa2a4202f71dbb64c978cc9eaa584b26b78aab8 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Fri, 24 Jun 2011 05:40:03 +0000 Subject: [PATCH] changing to: --crawl=CRAWLDEPTH --- lib/controller/controller.py | 2 +- lib/core/option.py | 18 ++++-------------- lib/core/optiondict.py | 2 +- lib/parse/cmdline.py | 3 +-- lib/utils/crawler.py | 4 ++-- sqlmap.conf | 5 +++-- 6 files changed, 12 insertions(+), 22 deletions(-) diff --git a/lib/controller/controller.py b/lib/controller/controller.py index 30ece28a4..8714a69a6 100644 --- a/lib/controller/controller.py +++ b/lib/controller/controller.py @@ -210,7 +210,7 @@ def start(): action() return True - if conf.url and not any([conf.forms, conf.crawl]): + if conf.url and not any([conf.forms, conf.crawlDepth]): kb.targetUrls.add(( conf.url, conf.method, conf.data, conf.cookie )) if conf.configFile and not kb.targetUrls: diff --git a/lib/core/option.py b/lib/core/option.py index 350f84cb5..c786b2db5 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -413,21 +413,11 @@ def __setRequestFromFile(): __feedTargetsDict(conf.requestFile, addedTargetUrls) def __setCrawler(): - if not conf.crawl: + if not conf.crawlDepth: return crawler = Crawler() - depth = 1 - - infoMsg = "setting crawling options" - logger.info(infoMsg) - - message = "please enter maximum depth [Enter for %d (default)] " % depth - choice = readInput(message, default=str(depth)) - if choice and choice.isdigit(): - depth = int(choice) - - crawler.getTargetUrls(depth) + crawler.getTargetUrls() def __setGoogleDorking(): """ @@ -1319,7 +1309,7 @@ def __cleanupOptions(): if conf.tmpPath: conf.tmpPath = ntToPosixSlashes(normalizePath(conf.tmpPath)) - if conf.googleDork or conf.logFile or conf.bulkFile or conf.forms or conf.crawl: + if conf.googleDork or conf.logFile or conf.bulkFile or conf.forms or conf.crawlDepth: conf.multipleTargets = True if conf.optimize: @@ -1786,7 +1776,7 @@ def __basicOptionValidation(): errMsg = "switch --forms is compatible only with -u (--url) target switch" raise sqlmapSyntaxException, errMsg - if conf.forms and conf.crawl: + if conf.forms and conf.crawlDepth: errMsg = "switch --forms is currently not compatible with --crawl switch" raise sqlmapSyntaxException, errMsg diff --git a/lib/core/optiondict.py b/lib/core/optiondict.py index 620d7866d..2a52b27eb 100644 --- a/lib/core/optiondict.py +++ b/lib/core/optiondict.py @@ -167,7 +167,7 @@ optDict = { "beep": "boolean", "checkPayload": "boolean", "cleanup": "boolean", - "crawl": "boolean", + "crawlDepth": "integer", "forms": "boolean", "googlePage": "integer", "mobile": "boolean", diff --git a/lib/parse/cmdline.py b/lib/parse/cmdline.py index 46efe5c93..44c070365 100644 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -511,8 +511,7 @@ def cmdLineParser(): help="Clean up the DBMS by sqlmap specific " "UDF and tables") - miscellaneous.add_option("--crawl", dest="crawl", - action="store_true", + miscellaneous.add_option("--crawl", dest="crawlDepth", type="int", help="Crawl the website starting from the target url") miscellaneous.add_option("--forms", dest="forms", diff --git a/lib/utils/crawler.py b/lib/utils/crawler.py index 7b6c0d8e6..1cf8d4311 100644 --- a/lib/utils/crawler.py +++ b/lib/utils/crawler.py @@ -31,7 +31,7 @@ class Crawler: line option '--crawl' """ - def getTargetUrls(self, depth=1): + def getTargetUrls(self): try: threadData = getCurrentThreadData() threadData.shared.outputs = oset() @@ -98,7 +98,7 @@ class Crawler: logger.info("starting crawler") - for i in xrange(depth): + for i in xrange(conf.crawlDepth): threadData.shared.count = 0 threadData.shared.length = len(threadData.shared.unprocessed) numThreads = min(conf.threads, len(threadData.shared.unprocessed)) diff --git a/sqlmap.conf b/sqlmap.conf index 3329dcb25..e9be8818b 100644 --- a/sqlmap.conf +++ b/sqlmap.conf @@ -544,8 +544,9 @@ checkPayload = False cleanup = False # Crawl the website starting from the target url -# Valid: True or False -crawl = False +# Valid: integer +# Default: 0 +crawlDepth = 0 # Parse and test forms on target url # Valid: True or False