mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-03 05:04:11 +03:00
Minor refactoring
This commit is contained in:
parent
60ebb97915
commit
20a66567a3
|
@ -55,6 +55,7 @@ from lib.core.convert import htmlunescape
|
||||||
from lib.core.convert import unicodeencode
|
from lib.core.convert import unicodeencode
|
||||||
from lib.core.convert import urldecode
|
from lib.core.convert import urldecode
|
||||||
from lib.core.convert import urlencode
|
from lib.core.convert import urlencode
|
||||||
|
from lib.core.decorators import cachedmethod
|
||||||
from lib.core.enums import CHARSET_TYPE
|
from lib.core.enums import CHARSET_TYPE
|
||||||
from lib.core.enums import DBMS
|
from lib.core.enums import DBMS
|
||||||
from lib.core.enums import EXPECTED
|
from lib.core.enums import EXPECTED
|
||||||
|
@ -492,15 +493,6 @@ class Backend:
|
||||||
def isOs(os):
|
def isOs(os):
|
||||||
return Backend.getOs() is not None and Backend.getOs().lower() == os.lower()
|
return Backend.getOs() is not None and Backend.getOs().lower() == os.lower()
|
||||||
|
|
||||||
# Reference: http://code.activestate.com/recipes/325205-cache-decorator-in-python-24/
|
|
||||||
def cachedmethod(f, cache={}):
|
|
||||||
def _(*args, **kwargs):
|
|
||||||
key = (f, tuple(args), frozenset(kwargs.items()))
|
|
||||||
if key not in cache:
|
|
||||||
cache[key] = f(*args, **kwargs)
|
|
||||||
return cache[key]
|
|
||||||
return _
|
|
||||||
|
|
||||||
def paramToDict(place, parameters=None):
|
def paramToDict(place, parameters=None):
|
||||||
"""
|
"""
|
||||||
Split the parameters into names and values, check if these parameters
|
Split the parameters into names and values, check if these parameters
|
||||||
|
|
8
lib/core/decorators.py
Normal file
8
lib/core/decorators.py
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Reference: http://code.activestate.com/recipes/325205-cache-decorator-in-python-24/
|
||||||
|
def cachedmethod(f, cache={}):
|
||||||
|
def _(*args, **kwargs):
|
||||||
|
key = (f, tuple(args), frozenset(kwargs.items()))
|
||||||
|
if key not in cache:
|
||||||
|
cache[key] = f(*args, **kwargs)
|
||||||
|
return cache[key]
|
||||||
|
return _
|
|
@ -294,7 +294,6 @@ class Users:
|
||||||
else:
|
else:
|
||||||
for user in kb.data.cachedUsersPasswords:
|
for user in kb.data.cachedUsersPasswords:
|
||||||
kb.data.cachedUsersPasswords[user] = list(set(kb.data.cachedUsersPasswords[user]))
|
kb.data.cachedUsersPasswords[user] = list(set(kb.data.cachedUsersPasswords[user]))
|
||||||
|
|
||||||
|
|
||||||
message = "do you want to perform a dictionary-based attack "
|
message = "do you want to perform a dictionary-based attack "
|
||||||
message += "against retrieved password hashes? [Y/n/q]"
|
message += "against retrieved password hashes? [Y/n/q]"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user