mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-09 22:21:30 +00:00
slightly faster and thread safer inference
This commit is contained in:
@@ -2080,10 +2080,11 @@ def getComparePageRatio(firstPage, secondPage, filtered=False):
|
||||
if filtered:
|
||||
(firstPage, secondPage) = map(getFilteredPageContent, (firstPage, secondPage))
|
||||
|
||||
conf.seqMatcher.set_seq1(firstPage)
|
||||
conf.seqMatcher.set_seq2(secondPage)
|
||||
seqMatcher = getCurrentThreadData().seqMatcher
|
||||
seqMatcher.set_seq1(firstPage)
|
||||
seqMatcher.set_seq2(secondPage)
|
||||
|
||||
return conf.seqMatcher.quick_ratio()
|
||||
return seqMatcher.quick_ratio()
|
||||
|
||||
def openFile(filename, mode='r'):
|
||||
"""
|
||||
|
||||
@@ -1077,8 +1077,6 @@ def __setConfAttributes():
|
||||
conf.port = None
|
||||
conf.redirectHandled = False
|
||||
conf.scheme = None
|
||||
#conf.seqMatcher = difflib.SequenceMatcher(lambda x: x in " \t")
|
||||
conf.seqMatcher = difflib.SequenceMatcher(None)
|
||||
conf.sessionFP = None
|
||||
conf.start = True
|
||||
conf.tests = []
|
||||
@@ -1135,7 +1133,6 @@ def __setKnowledgeBaseAttributes(flushAll=True):
|
||||
kb.locks = advancedDict()
|
||||
kb.locks.cacheLock = threading.Lock()
|
||||
kb.locks.logLock = threading.Lock()
|
||||
kb.locks.seqLock = None
|
||||
|
||||
kb.matchRatio = None
|
||||
kb.nullConnection = None
|
||||
|
||||
@@ -7,6 +7,7 @@ Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
import difflib
|
||||
import threading
|
||||
|
||||
from lib.core.data import kb
|
||||
@@ -17,12 +18,13 @@ class ThreadData():
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.disableStdOut = False
|
||||
self.lastErrorPage = None
|
||||
self.lastHTTPError = None
|
||||
self.lastQueryDuration = 0
|
||||
self.lastRequestUID = 0
|
||||
self.valueStack = []
|
||||
self.disableStdOut = False
|
||||
self.lastErrorPage = None
|
||||
self.lastHTTPError = None
|
||||
self.lastQueryDuration = 0
|
||||
self.lastRequestUID = 0
|
||||
self.seqMatcher = difflib.SequenceMatcher(None)
|
||||
self.valueStack = []
|
||||
|
||||
def getCurrentThreadUID():
|
||||
return hash(threading.currentThread())
|
||||
|
||||
Reference in New Issue
Block a user