Skip to content

Commit 961f49d

Browse files
committed
Fixes #6200
1 parent d84fe38 commit 961f49d

3 files changed

Lines changed: 24 additions & 7 deletions

File tree

‎lib/core/settings.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from thirdparty import six
2020

2121
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
22-
VERSION = "1.10.12.12"
22+
VERSION = "1.10.12.13"
2323
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2424
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2525
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

‎lib/utils/hash.py‎

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,10 +1606,14 @@ def dictionaryAttack(attack_dict):
16061606
process.daemon = True
16071607
process.start()
16081608

1609-
while count.value > 0:
1609+
while count.value > 0 and any(_.is_alive() for _ in processes):
16101610
time.sleep(0.5)
16111611

1612-
else:
1612+
if count.value > 0: # worker(s) died without finishing (e.g. a launcher re-running the main script in 'spawn' workers - #6200)
1613+
_multiprocessing = None
1614+
gc.enable()
1615+
1616+
if not _multiprocessing:
16131617
warnMsg = "multiprocessing hash cracking is currently "
16141618
warnMsg += "%s on this platform" % ("not supported" if not conf.disableMulti else "disabled")
16151619
singleTimeWarnMessage(warnMsg)
@@ -1666,10 +1670,14 @@ def dictionaryAttack(attack_dict):
16661670
process.daemon = True
16671671
process.start()
16681672

1669-
while count.value > 0:
1673+
while count.value > 0 and any(_.is_alive() for _ in processes):
16701674
time.sleep(0.5)
16711675

1672-
else:
1676+
if count.value > 0: # worker(s) died without finishing (e.g. a launcher re-running the main script in 'spawn' workers - #6200)
1677+
_multiprocessing = None
1678+
gc.enable()
1679+
1680+
if not _multiprocessing:
16731681
warnMsg = "multiprocessing hash cracking is currently "
16741682
warnMsg += "%s on this platform" % ("not supported" if not conf.disableMulti else "disabled")
16751683
singleTimeWarnMessage(warnMsg)
@@ -1738,12 +1746,16 @@ def dictionaryAttack(attack_dict):
17381746
process.daemon = True
17391747
process.start()
17401748

1741-
while count.value > 0:
1749+
while count.value > 0 and any(_.is_alive() for _ in processes):
17421750
time.sleep(0.5)
17431751

17441752
found = found_.value != 0
17451753

1746-
else:
1754+
if count.value > 0: # worker(s) died without finishing (e.g. a launcher re-running the main script in 'spawn' workers - #6200)
1755+
_multiprocessing = None
1756+
gc.enable()
1757+
1758+
if not _multiprocessing:
17471759
warnMsg = "multiprocessing hash cracking is currently "
17481760
warnMsg += "%s on this platform" % ("not supported" if not conf.disableMulti else "disabled")
17491761
singleTimeWarnMessage(warnMsg)

‎sqlmap.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ def main():
177177
Main function of sqlmap when running from command line.
178178
"""
179179

180+
# a multiprocessing 'spawn' worker still bootstrapping must never run the scan itself (e.g. a launcher re-executing
181+
# this script as '__main__' when the worker imports it - #6200); bail out, so the parent can fall back to a single process
182+
if getattr(sys.modules.get("multiprocessing") and sys.modules["multiprocessing"].current_process(), "_inheriting", False):
183+
return
184+
180185
try:
181186
dirtyPatches()
182187
resolveCrossReferences()

0 commit comments

Comments
 (0)