mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-03-03 19:55:47 +03:00
code refactoring regarding dictionary attack
This commit is contained in:
parent
ba4ea32603
commit
3cae76627c
|
@ -26,6 +26,7 @@ from ConfigParser import DEFAULTSECT
|
||||||
from ConfigParser import RawConfigParser
|
from ConfigParser import RawConfigParser
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
from difflib import SequenceMatcher
|
from difflib import SequenceMatcher
|
||||||
|
from inspect import getmembers
|
||||||
from subprocess import PIPE
|
from subprocess import PIPE
|
||||||
from subprocess import Popen as execute
|
from subprocess import Popen as execute
|
||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
|
@ -1604,3 +1605,12 @@ def logHTTPTraffic(requestLogMsg, responseLogMsg):
|
||||||
dataToTrafficFile("\n%s\n\n" % (76 * '#'))
|
dataToTrafficFile("\n%s\n\n" % (76 * '#'))
|
||||||
|
|
||||||
kb.locks.reqLock.release()
|
kb.locks.reqLock.release()
|
||||||
|
|
||||||
|
def getPublicTypeMembers(type_):
|
||||||
|
retVal = []
|
||||||
|
|
||||||
|
for name, value in getmembers(type_):
|
||||||
|
if not name.startswith('__'):
|
||||||
|
retVal.append((name, value))
|
||||||
|
|
||||||
|
return retVal
|
|
@ -53,4 +53,3 @@ class HASH:
|
||||||
ORACLE_OLD = r'(?i)\A[0-9a-f]{16}\Z'
|
ORACLE_OLD = r'(?i)\A[0-9a-f]{16}\Z'
|
||||||
MD5_GENERIC = r'(?i)\A[0-9a-f]{32}\Z'
|
MD5_GENERIC = r'(?i)\A[0-9a-f]{32}\Z'
|
||||||
SHA1_GENERIC = r'(?i)\A[0-9a-f]{40}\Z'
|
SHA1_GENERIC = r'(?i)\A[0-9a-f]{40}\Z'
|
||||||
__all__ = (MYSQL, MYSQL_OLD, POSTGRES, MSSQL, MSSQL_OLD, ORACLE, ORACLE_OLD, MD5_GENERIC, SHA1_GENERIC)
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ from extra.pydes.pyDes import CBC
|
||||||
from lib.core.common import conf
|
from lib.core.common import conf
|
||||||
from lib.core.common import dataToStdout
|
from lib.core.common import dataToStdout
|
||||||
from lib.core.common import getFileItems
|
from lib.core.common import getFileItems
|
||||||
|
from lib.core.common import getPublicTypeMembers
|
||||||
from lib.core.common import paths
|
from lib.core.common import paths
|
||||||
from lib.core.common import readInput
|
from lib.core.common import readInput
|
||||||
from lib.core.convert import hexdecode
|
from lib.core.convert import hexdecode
|
||||||
|
@ -190,7 +191,7 @@ def dictionaryAttack():
|
||||||
|
|
||||||
hash_ = hash_.split()[0]
|
hash_ = hash_.split()[0]
|
||||||
|
|
||||||
for regex in HASH.__all__:
|
for _, regex in getPublicTypeMembers(HASH):
|
||||||
if re.match(regex, hash_):
|
if re.match(regex, hash_):
|
||||||
rehash = regex
|
rehash = regex
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue
Block a user