diff --git a/lib/core/option.py b/lib/core/option.py index 0bf43f825..0e4a8878a 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -109,6 +109,7 @@ from lib.core.settings import UNENCODED_ORIGINAL_VALUE from lib.core.settings import UNION_CHAR_REGEX from lib.core.settings import UNKNOWN_DBMS_VERSION from lib.core.settings import WEBSCARAB_SPLITTER +from lib.core.threads import getCurrentThreadData from lib.core.update import update from lib.parse.configfile import configFileParser from lib.parse.payloads import loadPayloads @@ -1331,6 +1332,9 @@ def __cleanupOptions(): if conf.code: conf.code = int(conf.code) + threadData = getCurrentThreadData() + threadData.reset() + def __setConfAttributes(): """ This function set some needed attributes into the configuration diff --git a/lib/core/threads.py b/lib/core/threads.py index 072d99129..7df2a7bc4 100644 --- a/lib/core/threads.py +++ b/lib/core/threads.py @@ -33,10 +33,16 @@ class _ThreadData(threading.local): """ def __init__(self): - global shared + self.reset() + + def reset(self): + """ + Resets thread data model + """ self.disableStdOut = False self.hashDBCursor = None + self.inTransaction = False self.lastErrorPage = None self.lastHTTPError = None self.lastRedirectMsg = None diff --git a/lib/utils/hashdb.py b/lib/utils/hashdb.py index ce7ae7f39..2a2555a7d 100644 --- a/lib/utils/hashdb.py +++ b/lib/utils/hashdb.py @@ -22,7 +22,6 @@ class HashDB(object): self.filepath = filepath self._write_cache = {} self._cache_lock = threading.Lock() - self._in_transaction = False def _get_cursor(self): threadData = getCurrentThreadData() @@ -109,11 +108,13 @@ class HashDB(object): self.endTransaction() def beginTransaction(self): - if not self._in_transaction: + threadData = getCurrentThreadData() + if not threadData.inTransaction: self.cursor.execute('BEGIN TRANSACTION') - self._in_transaction = True + threadData.inTransaction = True def endTransaction(self): - if self._in_transaction: + threadData = getCurrentThreadData() + if threadData.inTransaction: self.cursor.execute('END TRANSACTION') - self._in_transaction = False + threadData.inTransaction = False