mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 09:36:35 +03:00
Another update for #4367
This commit is contained in:
parent
e621d7ec6a
commit
194c911433
|
@ -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.11.7"
|
VERSION = "1.4.11.8"
|
||||||
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)
|
||||||
|
|
|
@ -583,6 +583,41 @@ __functions__ = {
|
||||||
HASH.SHA512_BASE64: sha512_generic_passwd,
|
HASH.SHA512_BASE64: sha512_generic_passwd,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _finalize(retVal, results, processes, attack_info=None):
|
||||||
|
if _multiprocessing:
|
||||||
|
gc.enable()
|
||||||
|
|
||||||
|
# NOTE: https://github.com/sqlmapproject/sqlmap/issues/4367
|
||||||
|
# NOTE: https://dzone.com/articles/python-101-creating-multiple-processes
|
||||||
|
for process in processes:
|
||||||
|
try:
|
||||||
|
process.terminate()
|
||||||
|
process.join()
|
||||||
|
except (OSError, AttributeError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
if retVal:
|
||||||
|
removals = set()
|
||||||
|
|
||||||
|
if conf.hashDB:
|
||||||
|
conf.hashDB.beginTransaction()
|
||||||
|
|
||||||
|
while not retVal.empty():
|
||||||
|
user, hash_, word = item = retVal.get(block=False)
|
||||||
|
results.append(item)
|
||||||
|
removals.add((user, hash_))
|
||||||
|
hashDBWrite(hash_, word)
|
||||||
|
|
||||||
|
for item in attack_info or []:
|
||||||
|
if (item[0][0], item[0][1]) in removals:
|
||||||
|
attack_info.remove(item)
|
||||||
|
|
||||||
|
if conf.hashDB:
|
||||||
|
conf.hashDB.endTransaction()
|
||||||
|
|
||||||
|
if hasattr(retVal, "close"):
|
||||||
|
retVal.close()
|
||||||
|
|
||||||
def storeHashesToFile(attack_dict):
|
def storeHashesToFile(attack_dict):
|
||||||
if not attack_dict:
|
if not attack_dict:
|
||||||
return
|
return
|
||||||
|
@ -1148,30 +1183,7 @@ def dictionaryAttack(attack_dict):
|
||||||
logger.warn(warnMsg)
|
logger.warn(warnMsg)
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
if _multiprocessing:
|
_finalize(retVal, results, processes, attack_info)
|
||||||
gc.enable()
|
|
||||||
|
|
||||||
# NOTE: https://github.com/sqlmapproject/sqlmap/issues/4367
|
|
||||||
# NOTE: https://dzone.com/articles/python-101-creating-multiple-processes
|
|
||||||
for process in processes:
|
|
||||||
try:
|
|
||||||
process.terminate()
|
|
||||||
process.join()
|
|
||||||
except (OSError, AttributeError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
if retVal:
|
|
||||||
if conf.hashDB:
|
|
||||||
conf.hashDB.beginTransaction()
|
|
||||||
|
|
||||||
while not retVal.empty():
|
|
||||||
user, hash_, word = item = retVal.get(block=False)
|
|
||||||
attack_info = [_ for _ in attack_info if _[0][0] != user or _[0][1] != hash_]
|
|
||||||
hashDBWrite(hash_, word)
|
|
||||||
results.append(item)
|
|
||||||
|
|
||||||
if conf.hashDB:
|
|
||||||
conf.hashDB.endTransaction()
|
|
||||||
|
|
||||||
clearConsoleLine()
|
clearConsoleLine()
|
||||||
|
|
||||||
|
@ -1253,20 +1265,7 @@ def dictionaryAttack(attack_dict):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
if _multiprocessing:
|
_finalize(retVal, results, processes, attack_info)
|
||||||
gc.enable()
|
|
||||||
|
|
||||||
if retVal and conf.hashDB:
|
|
||||||
if conf.hashDB:
|
|
||||||
conf.hashDB.beginTransaction()
|
|
||||||
|
|
||||||
while not retVal.empty():
|
|
||||||
user, hash_, word = item = retVal.get(block=False)
|
|
||||||
hashDBWrite(hash_, word)
|
|
||||||
results.append(item)
|
|
||||||
|
|
||||||
if conf.hashDB:
|
|
||||||
conf.hashDB.endTransaction()
|
|
||||||
|
|
||||||
clearConsoleLine()
|
clearConsoleLine()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user