mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 09:36:35 +03:00
some more optimizations
This commit is contained in:
parent
267d67b024
commit
9697e80013
|
@ -129,6 +129,9 @@ def main():
|
||||||
kb.threadContinue = False
|
kb.threadContinue = False
|
||||||
kb.threadException = True
|
kb.threadException = True
|
||||||
|
|
||||||
|
if conf.hashDB:
|
||||||
|
conf.hashDB.flush(True)
|
||||||
|
|
||||||
# Reference: http://stackoverflow.com/questions/1635080/terminate-a-multi-thread-python-program
|
# Reference: http://stackoverflow.com/questions/1635080/terminate-a-multi-thread-python-program
|
||||||
if hasattr(conf, "threads") and conf.threads > 1:
|
if hasattr(conf, "threads") and conf.threads > 1:
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
|
|
@ -414,4 +414,7 @@ COMMON_USER_COLUMNS = ('user', 'username', 'user_name', 'benutzername', 'benutze
|
||||||
DEFAULT_GET_POST_DELIMITER = '&'
|
DEFAULT_GET_POST_DELIMITER = '&'
|
||||||
|
|
||||||
# Default delimiter in cookie values
|
# Default delimiter in cookie values
|
||||||
DEFAULT_COOKIE_DELIMITER = ';'
|
DEFAULT_COOKIE_DELIMITER = ';'
|
||||||
|
|
||||||
|
# Skip unforced HashDB flush requests below the threshold number of cached items
|
||||||
|
HASHDB_FLUSH_THRESHOLD = 10
|
||||||
|
|
|
@ -181,7 +181,7 @@ def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardExceptio
|
||||||
kb.threadContinue = True
|
kb.threadContinue = True
|
||||||
kb.threadException = False
|
kb.threadException = False
|
||||||
|
|
||||||
conf.hashDB.flush()
|
conf.hashDB.flush(True)
|
||||||
|
|
||||||
if cleanupFunction:
|
if cleanupFunction:
|
||||||
cleanupFunction()
|
cleanupFunction()
|
||||||
|
|
|
@ -12,6 +12,7 @@ import sqlite3
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
from lib.core.data import conf
|
from lib.core.data import conf
|
||||||
|
from lib.core.settings import HASHDB_FLUSH_THRESHOLD
|
||||||
from lib.core.settings import UNICODE_ENCODING
|
from lib.core.settings import UNICODE_ENCODING
|
||||||
from lib.core.threads import getCurrentThreadData
|
from lib.core.threads import getCurrentThreadData
|
||||||
from lib.core.threads import getCurrentThreadName
|
from lib.core.threads import getCurrentThreadName
|
||||||
|
@ -54,15 +55,17 @@ class HashDB(object):
|
||||||
retVal = None
|
retVal = None
|
||||||
if key:
|
if key:
|
||||||
hash_ = HashDB.hashKey(key)
|
hash_ = HashDB.hashKey(key)
|
||||||
while True:
|
retVal = self._write_cache.get(hash_, None)
|
||||||
try:
|
if not retVal:
|
||||||
for row in self.cursor.execute("SELECT value FROM storage WHERE id=?", (hash_,)):
|
while True:
|
||||||
retVal = row[0]
|
try:
|
||||||
except sqlite3.OperationalError, ex:
|
for row in self.cursor.execute("SELECT value FROM storage WHERE id=?", (hash_,)):
|
||||||
if not 'locked' in ex.message:
|
retVal = row[0]
|
||||||
raise
|
except sqlite3.OperationalError, ex:
|
||||||
else:
|
if not 'locked' in ex.message:
|
||||||
break
|
raise
|
||||||
|
else:
|
||||||
|
break
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
def write(self, key, value):
|
def write(self, key, value):
|
||||||
|
@ -75,10 +78,13 @@ class HashDB(object):
|
||||||
if getCurrentThreadName() in ('0', 'MainThread'):
|
if getCurrentThreadName() in ('0', 'MainThread'):
|
||||||
self.flush()
|
self.flush()
|
||||||
|
|
||||||
def flush(self):
|
def flush(self, forced=False):
|
||||||
if not self._write_cache:
|
if not self._write_cache:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if not forced and len(self._write_cache) < HASHDB_FLUSH_THRESHOLD:
|
||||||
|
return
|
||||||
|
|
||||||
self._cache_lock.acquire()
|
self._cache_lock.acquire()
|
||||||
items = self._write_cache.items()
|
items = self._write_cache.items()
|
||||||
self._write_cache.clear()
|
self._write_cache.clear()
|
||||||
|
|
|
@ -1564,7 +1564,6 @@ class Enumeration:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
kb.dumpMode = True
|
kb.dumpMode = True
|
||||||
#conf.hashDB.beginTransaction()
|
|
||||||
|
|
||||||
if not safeSQLIdentificatorNaming(conf.db) in kb.data.cachedColumns \
|
if not safeSQLIdentificatorNaming(conf.db) in kb.data.cachedColumns \
|
||||||
or safeSQLIdentificatorNaming(tbl, True) not in \
|
or safeSQLIdentificatorNaming(tbl, True) not in \
|
||||||
|
@ -1789,7 +1788,6 @@ class Enumeration:
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
kb.dumpMode = False
|
kb.dumpMode = False
|
||||||
#conf.hashDB.endTransaction()
|
|
||||||
|
|
||||||
def dumpAll(self):
|
def dumpAll(self):
|
||||||
if conf.db is not None and conf.tbl is None:
|
if conf.db is not None and conf.tbl is None:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user