mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-09 06:01:29 +00:00
Some code refactoring
This commit is contained in:
@@ -57,8 +57,7 @@ def tableExists(tableFile, regex=None):
|
||||
logger.warn(warnMsg)
|
||||
|
||||
message = "are you sure you want to continue? [y/N] "
|
||||
test = readInput(message, default="N")
|
||||
kb.tableExistsChoice = test[0] in ("y", "Y")
|
||||
kb.tableExistsChoice = readInput(message, default='N', boolean=True)
|
||||
|
||||
if not kb.tableExistsChoice:
|
||||
return None
|
||||
@@ -161,8 +160,7 @@ def columnExists(columnFile, regex=None):
|
||||
logger.warn(warnMsg)
|
||||
|
||||
message = "are you sure you want to continue? [y/N] "
|
||||
test = readInput(message, default="N")
|
||||
kb.columnExistsChoice = test[0] in ("y", "Y")
|
||||
kb.columnExistsChoice = readInput(message, default='N', boolean=True)
|
||||
|
||||
if not kb.columnExistsChoice:
|
||||
return None
|
||||
|
||||
@@ -130,8 +130,8 @@ def crawl(target):
|
||||
if not conf.sitemapUrl:
|
||||
message = "do you want to check for the existence of "
|
||||
message += "site's sitemap(.xml) [y/N] "
|
||||
test = readInput(message, default="n")
|
||||
if test[0] in ("y", "Y"):
|
||||
|
||||
if readInput(message, default='N', boolean=True):
|
||||
found = True
|
||||
items = None
|
||||
url = urlparse.urljoin(target, "/sitemap.xml")
|
||||
@@ -198,8 +198,8 @@ def storeResultsToFile(results):
|
||||
if kb.storeCrawlingChoice is None:
|
||||
message = "do you want to store crawling results to a temporary file "
|
||||
message += "for eventual further processing with other tools [y/N] "
|
||||
test = readInput(message, default="N")
|
||||
kb.storeCrawlingChoice = test[0] in ("y", "Y")
|
||||
|
||||
kb.storeCrawlingChoice = readInput(message, default='N', boolean=True)
|
||||
|
||||
if kb.storeCrawlingChoice:
|
||||
handle, filename = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.CRAWLER, suffix=".csv" if conf.forms else ".txt")
|
||||
|
||||
@@ -382,8 +382,8 @@ def storeHashesToFile(attack_dict):
|
||||
if kb.storeHashesChoice is None:
|
||||
message = "do you want to store hashes to a temporary file "
|
||||
message += "for eventual further processing with other tools [y/N] "
|
||||
test = readInput(message, default="N")
|
||||
kb.storeHashesChoice = test[0] in ("y", "Y")
|
||||
|
||||
kb.storeHashesChoice = readInput(message, default='N', boolean=True)
|
||||
|
||||
if not kb.storeHashesChoice:
|
||||
return
|
||||
@@ -482,11 +482,11 @@ def attackDumpedTable():
|
||||
storeHashesToFile(attack_dict)
|
||||
|
||||
message = "do you want to crack them via a dictionary-based attack? %s" % ("[y/N/q]" if conf.multipleTargets else "[Y/n/q]")
|
||||
test = readInput(message, default="N" if conf.multipleTargets else "Y")
|
||||
choice = readInput(message, default='N' if conf.multipleTargets else 'Y').strip().upper()
|
||||
|
||||
if test[0] in ("n", "N"):
|
||||
if choice == 'N':
|
||||
return
|
||||
elif test[0] in ("q", "Q"):
|
||||
elif choice == 'Q':
|
||||
raise SqlmapUserQuitException
|
||||
|
||||
results = dictionaryAttack(attack_dict)
|
||||
@@ -805,9 +805,8 @@ def dictionaryAttack(attack_dict):
|
||||
logger.critical(warnMsg)
|
||||
|
||||
message = "do you want to use common password suffixes? (slow!) [y/N] "
|
||||
test = readInput(message, default="N")
|
||||
|
||||
if test[0] in ("y", "Y"):
|
||||
if readInput(message, default='N', boolean=True):
|
||||
suffix_list += COMMON_PASSWORD_SUFFIXES
|
||||
|
||||
infoMsg = "starting dictionary-based cracking (%s)" % __functions__[hash_regex].func_name
|
||||
|
||||
Reference in New Issue
Block a user