mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 01:26:42 +03:00
Minor patch (for late threading issues)
This commit is contained in:
parent
d886b08dd9
commit
63d7cd607e
|
@ -19,7 +19,7 @@ from lib.core.enums import OS
|
|||
from lib.core.revision import getRevisionNumber
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.0.5.34"
|
||||
VERSION = "1.0.5.35"
|
||||
REVISION = getRevisionNumber()
|
||||
STABLE = VERSION.count('.') <= 2
|
||||
VERSION_STRING = "sqlmap/%s#%s" % (VERSION, "stable" if STABLE else "dev")
|
||||
|
@ -130,6 +130,9 @@ HTTP_ACCEPT_ENCODING_HEADER_VALUE = "gzip,deflate"
|
|||
# Default timeout for running commands over backdoor
|
||||
BACKDOOR_RUN_CMD_TIMEOUT = 5
|
||||
|
||||
# Number of seconds to wait for thread finalization at program end
|
||||
THREAD_FINALIZATION_TIMEOUT = 1
|
||||
|
||||
# Maximum number of techniques used in inject.py/getValue() per one value
|
||||
MAX_TECHNIQUES_PER_VALUE = 2
|
||||
|
||||
|
|
10
sqlmap.py
10
sqlmap.py
|
@ -54,6 +54,7 @@ try:
|
|||
from lib.core.profiling import profile
|
||||
from lib.core.settings import IS_WIN
|
||||
from lib.core.settings import LEGAL_DISCLAIMER
|
||||
from lib.core.settings import THREAD_FINALIZATION_TIMEOUT
|
||||
from lib.core.settings import VERSION
|
||||
from lib.core.testing import smokeTest
|
||||
from lib.core.testing import liveTest
|
||||
|
@ -276,15 +277,16 @@ def main():
|
|||
if conf.get("dumper"):
|
||||
conf.dumper.flush()
|
||||
|
||||
if threading.activeCount() > 1:
|
||||
logger.debug("short delay for thread finalization")
|
||||
# short delay for thread finalization
|
||||
try:
|
||||
time.sleep(0.5)
|
||||
_ = time.time()
|
||||
while threading.activeCount() > 1 and (time.time() - _) > THREAD_FINALIZATION_TIMEOUT:
|
||||
time.sleep(0.01)
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
# Reference: http://stackoverflow.com/questions/1635080/terminate-a-multi-thread-python-program
|
||||
if conf.get("threads", 0) > 1 or conf.get("dnsServer"):
|
||||
if threading.activeCount() > 1:
|
||||
os._exit(0)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in New Issue
Block a user