mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-04-25 11:23:44 +03:00
fix for a ImportError bug reported by g@brindi.si
This commit is contained in:
parent
9cf33ec997
commit
fad77dd078
|
@ -12,6 +12,13 @@ try:
|
||||||
except ImportError, _:
|
except ImportError, _:
|
||||||
from extra.fcrypt.fcrypt import crypt
|
from extra.fcrypt.fcrypt import crypt
|
||||||
|
|
||||||
|
_multiprocessing = None
|
||||||
|
try:
|
||||||
|
import multiprocessing
|
||||||
|
_multiprocessing = multiprocessing
|
||||||
|
except ImportError, _: # problems on FreeBSD (Reference: http://www.velocityreviews.com/forums/t716510-freebsd-and-multiprocessing.html)
|
||||||
|
pass
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
@ -56,9 +63,6 @@ from lib.core.settings import ML
|
||||||
from lib.core.settings import UNICODE_ENCODING
|
from lib.core.settings import UNICODE_ENCODING
|
||||||
from lib.core.settings import ROTATING_CHARS
|
from lib.core.settings import ROTATING_CHARS
|
||||||
|
|
||||||
if PYVERSION >= "2.6":
|
|
||||||
import multiprocessing
|
|
||||||
|
|
||||||
def mysql_passwd(password, uppercase=True):
|
def mysql_passwd(password, uppercase=True):
|
||||||
"""
|
"""
|
||||||
Reference(s):
|
Reference(s):
|
||||||
|
@ -558,15 +562,15 @@ def dictionaryAttack(attack_dict):
|
||||||
retVal = None
|
retVal = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if PYVERSION >= "2.6" and not IS_WIN:
|
if _multiprocessing and not IS_WIN:
|
||||||
if multiprocessing.cpu_count() > 1:
|
if _multiprocessing.cpu_count() > 1:
|
||||||
infoMsg = "starting %d processes " % multiprocessing.cpu_count()
|
infoMsg = "starting %d processes " % _multiprocessing.cpu_count()
|
||||||
singleTimeLogMessage(infoMsg)
|
singleTimeLogMessage(infoMsg)
|
||||||
|
|
||||||
processes = []
|
processes = []
|
||||||
retVal = multiprocessing.Queue()
|
retVal = _multiprocessing.Queue()
|
||||||
for i in xrange(multiprocessing.cpu_count()):
|
for i in xrange(_multiprocessing.cpu_count()):
|
||||||
p = multiprocessing.Process(target=__bruteProcessVariantA, args=(attack_info, hash_regex, kb.wordlist, suffix, retVal, i, multiprocessing.cpu_count()))
|
p = _multiprocessing.Process(target=__bruteProcessVariantA, args=(attack_info, hash_regex, kb.wordlist, suffix, retVal, i, _multiprocessing.cpu_count()))
|
||||||
processes.append(p)
|
processes.append(p)
|
||||||
|
|
||||||
for p in processes:
|
for p in processes:
|
||||||
|
@ -576,10 +580,9 @@ def dictionaryAttack(attack_dict):
|
||||||
p.join()
|
p.join()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if not IS_WIN:
|
warnMsg = "multiprocessing hash cracking is currently "
|
||||||
warnMsg = "multiprocessing not supported on current version of "
|
warnMsg += "not supported on this platform"
|
||||||
warnMsg += "Python (%s < 2.6)" % PYVERSION
|
singleTimeWarnMessage(warnMsg)
|
||||||
singleTimeWarnMessage(warnMsg)
|
|
||||||
|
|
||||||
retVal = Queue()
|
retVal = Queue()
|
||||||
__bruteProcessVariantA(attack_info, hash_regex, kb.wordlist, suffix, retVal, 0, 1)
|
__bruteProcessVariantA(attack_info, hash_regex, kb.wordlist, suffix, retVal, 0, 1)
|
||||||
|
@ -614,17 +617,17 @@ def dictionaryAttack(attack_dict):
|
||||||
retVal = None
|
retVal = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if PYVERSION >= "2.6" and not IS_WIN:
|
if _multiprocessing and not IS_WIN:
|
||||||
if multiprocessing.cpu_count() > 1:
|
if _multiprocessing.cpu_count() > 1:
|
||||||
infoMsg = "starting %d processes " % multiprocessing.cpu_count()
|
infoMsg = "starting %d processes " % _multiprocessing.cpu_count()
|
||||||
singleTimeLogMessage(infoMsg)
|
singleTimeLogMessage(infoMsg)
|
||||||
|
|
||||||
processes = []
|
processes = []
|
||||||
retVal = multiprocessing.Queue()
|
retVal = _multiprocessing.Queue()
|
||||||
found_ = multiprocessing.Value('i', False)
|
found_ = _multiprocessing.Value('i', False)
|
||||||
|
|
||||||
for i in xrange(multiprocessing.cpu_count()):
|
for i in xrange(_multiprocessing.cpu_count()):
|
||||||
p = multiprocessing.Process(target=__bruteProcessVariantB, args=(user, hash_, kwargs, hash_regex, kb.wordlist, suffix, retVal, found_, i, multiprocessing.cpu_count()))
|
p = _multiprocessing.Process(target=__bruteProcessVariantB, args=(user, hash_, kwargs, hash_regex, kb.wordlist, suffix, retVal, found_, i, _multiprocessing.cpu_count()))
|
||||||
processes.append(p)
|
processes.append(p)
|
||||||
|
|
||||||
for p in processes:
|
for p in processes:
|
||||||
|
@ -636,10 +639,9 @@ def dictionaryAttack(attack_dict):
|
||||||
found = found_.value != 0
|
found = found_.value != 0
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if not IS_WIN:
|
warnMsg = "multiprocessing hash cracking is currently "
|
||||||
warnMsg = "multiprocessing not supported on current version of "
|
warnMsg += "not supported on this platform"
|
||||||
warnMsg += "Python (%s < 2.6)" % PYVERSION
|
singleTimeWarnMessage(warnMsg)
|
||||||
singleTimeWarnMessage(warnMsg)
|
|
||||||
|
|
||||||
class Value():
|
class Value():
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue
Block a user