File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919from lib .core .revision import getRevisionNumber
2020
2121# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
22- VERSION = "1.0.5.34 "
22+ VERSION = "1.0.5.35 "
2323REVISION = getRevisionNumber ()
2424STABLE = VERSION .count ('.' ) <= 2
2525VERSION_STRING = "sqlmap/%s#%s" % (VERSION , "stable" if STABLE else "dev" )
130130# Default timeout for running commands over backdoor
131131BACKDOOR_RUN_CMD_TIMEOUT = 5
132132
133+ # Number of seconds to wait for thread finalization at program end
134+ THREAD_FINALIZATION_TIMEOUT = 1
135+
133136# Maximum number of techniques used in inject.py/getValue() per one value
134137MAX_TECHNIQUES_PER_VALUE = 2
135138
Original file line number Diff line number Diff line change 5454 from lib .core .profiling import profile
5555 from lib .core .settings import IS_WIN
5656 from lib .core .settings import LEGAL_DISCLAIMER
57+ from lib .core .settings import THREAD_FINALIZATION_TIMEOUT
5758 from lib .core .settings import VERSION
5859 from lib .core .testing import smokeTest
5960 from lib .core .testing import liveTest
@@ -276,15 +277,16 @@ def main():
276277 if conf .get ("dumper" ):
277278 conf .dumper .flush ()
278279
279- if threading .activeCount () > 1 :
280- logger .debug ("short delay for thread finalization" )
281- try :
282- time .sleep (0.5 )
283- except KeyboardInterrupt :
284- pass
280+ # short delay for thread finalization
281+ try :
282+ _ = time .time ()
283+ while threading .activeCount () > 1 and (time .time () - _ ) > THREAD_FINALIZATION_TIMEOUT :
284+ time .sleep (0.01 )
285+ except KeyboardInterrupt :
286+ pass
285287
286288 # Reference: http://stackoverflow.com/questions/1635080/terminate-a-multi-thread-python-program
287- if conf . get ( "threads" , 0 ) > 1 or conf . get ( "dnsServer" ) :
289+ if threading . activeCount ( ) > 1 :
288290 os ._exit (0 )
289291
290292if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments