This commit is contained in:
Miroslav Stampar 2020-03-12 22:36:12 +01:00
parent 111201978c
commit 5fd2598da0
4 changed files with 17 additions and 3 deletions

View File

@ -18,7 +18,7 @@ from lib.core.enums import OS
from thirdparty.six import unichr as _unichr from thirdparty.six import unichr as _unichr
# sqlmap version (<major>.<minor>.<month>.<monthly commit>) # sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.4.3.5" VERSION = "1.4.3.6"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

View File

@ -761,6 +761,9 @@ def cmdLineParser(argv=None):
parser.add_argument("--debug", dest="debug", action="store_true", parser.add_argument("--debug", dest="debug", action="store_true",
help=SUPPRESS) help=SUPPRESS)
parser.add_argument("--disable-multi", dest="disableMulti", action="store_true",
help=SUPPRESS)
parser.add_argument("--disable-precon", dest="disablePrecon", action="store_true", parser.add_argument("--disable-precon", dest="disablePrecon", action="store_true",
help=SUPPRESS) help=SUPPRESS)

View File

@ -913,6 +913,8 @@ def _bruteProcessVariantB(user, hash_, kwargs, hash_regex, suffix, retVal, found
proc_count.value -= 1 proc_count.value -= 1
def dictionaryAttack(attack_dict): def dictionaryAttack(attack_dict):
global _multiprocessing
suffix_list = [""] suffix_list = [""]
custom_wordlist = [""] custom_wordlist = [""]
hash_regexes = [] hash_regexes = []
@ -922,6 +924,9 @@ def dictionaryAttack(attack_dict):
processException = False processException = False
foundHash = False foundHash = False
if conf.disableMulti:
_multiprocessing = None
for (_, hashes) in attack_dict.items(): for (_, hashes) in attack_dict.items():
for hash_ in hashes: for hash_ in hashes:
if not hash_: if not hash_:
@ -1108,7 +1113,7 @@ def dictionaryAttack(attack_dict):
else: else:
warnMsg = "multiprocessing hash cracking is currently " warnMsg = "multiprocessing hash cracking is currently "
warnMsg += "not supported on this platform" warnMsg += "%s on this platform" % ("not supported" if not conf.disableMulti else "disabled")
singleTimeWarnMessage(warnMsg) singleTimeWarnMessage(warnMsg)
retVal = _queue.Queue() retVal = _queue.Queue()
@ -1196,7 +1201,7 @@ def dictionaryAttack(attack_dict):
else: else:
warnMsg = "multiprocessing hash cracking is currently " warnMsg = "multiprocessing hash cracking is currently "
warnMsg += "not supported on this platform" warnMsg += "%s on this platform" % ("not supported" if not conf.disableMulti else "disabled")
singleTimeWarnMessage(warnMsg) singleTimeWarnMessage(warnMsg)
class Value(object): class Value(object):

View File

@ -335,6 +335,12 @@ def main():
logger.critical(errMsg) logger.critical(errMsg)
raise SystemExit raise SystemExit
elif all(_ in excMsg for _ in ("Resource temporarily unavailable", "os.fork()", "dictionaryAttack")):
errMsg = "there has been a problem while running the multiprocessing hash cracking. "
errMsg += "Please rerun with option '--threads=1'"
logger.critical(errMsg)
raise SystemExit
elif "can't start new thread" in excMsg: elif "can't start new thread" in excMsg:
errMsg = "there has been a problem while creating new thread instance. " errMsg = "there has been a problem while creating new thread instance. "
errMsg += "Please make sure that you are not running too many processes" errMsg += "Please make sure that you are not running too many processes"