mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-05-12 03:33:44 +03:00
minor improvement (resuming of already cracked values)
This commit is contained in:
parent
c0cd29f01c
commit
f9bb762d1d
|
@ -50,6 +50,7 @@ from lib.core.common import Wordlist
|
||||||
from lib.core.convert import hexdecode
|
from lib.core.convert import hexdecode
|
||||||
from lib.core.convert import hexencode
|
from lib.core.convert import hexencode
|
||||||
from lib.core.convert import utf8encode
|
from lib.core.convert import utf8encode
|
||||||
|
from lib.core.data import conf
|
||||||
from lib.core.data import kb
|
from lib.core.data import kb
|
||||||
from lib.core.data import logger
|
from lib.core.data import logger
|
||||||
from lib.core.enums import DBMS
|
from lib.core.enums import DBMS
|
||||||
|
@ -500,7 +501,15 @@ def dictionaryAttack(attack_dict):
|
||||||
|
|
||||||
key = hash(repr(item))
|
key = hash(repr(item))
|
||||||
if item and key not in keys:
|
if item and key not in keys:
|
||||||
|
resumed = conf.hashDB.retrieve(hash_)
|
||||||
|
if not resumed:
|
||||||
attack_info.append(item)
|
attack_info.append(item)
|
||||||
|
else:
|
||||||
|
infoMsg = "resuming found '%s' ('%s')" % (resumed, hash_)
|
||||||
|
if user and not user.startswith(DUMMY_USER_PREFIX):
|
||||||
|
infoMsg += " for user '%s'" % user
|
||||||
|
logger.info(infoMsg)
|
||||||
|
results.append((user, hash_, resumed))
|
||||||
keys.add(key)
|
keys.add(key)
|
||||||
|
|
||||||
if not attack_info:
|
if not attack_info:
|
||||||
|
@ -615,7 +624,9 @@ def dictionaryAttack(attack_dict):
|
||||||
process.join()
|
process.join()
|
||||||
|
|
||||||
while not retVal.empty():
|
while not retVal.empty():
|
||||||
results.append(retVal.get(block=False))
|
_, hash_, word = item = retVal.get(block=False)
|
||||||
|
conf.hashDB.write(hash_, word)
|
||||||
|
results.append(item)
|
||||||
|
|
||||||
clearConsoleLine()
|
clearConsoleLine()
|
||||||
|
|
||||||
|
@ -689,7 +700,9 @@ def dictionaryAttack(attack_dict):
|
||||||
process.join()
|
process.join()
|
||||||
|
|
||||||
while not retVal.empty():
|
while not retVal.empty():
|
||||||
results.append(retVal.get(block=False))
|
_, hash_, word = item = retVal.get(block=False)
|
||||||
|
conf.hashDB.write(hash_, word)
|
||||||
|
results.append(item)
|
||||||
|
|
||||||
clearConsoleLine()
|
clearConsoleLine()
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,8 @@ class HashDB(object):
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def hashKey(self, key):
|
@staticmethod
|
||||||
|
def hashKey(key):
|
||||||
key = key.encode(UNICODE_ENCODING) if isinstance(key, unicode) else repr(key)
|
key = key.encode(UNICODE_ENCODING) if isinstance(key, unicode) else repr(key)
|
||||||
retVal = int(hashlib.md5(key).hexdigest()[:8], 16)
|
retVal = int(hashlib.md5(key).hexdigest()[:8], 16)
|
||||||
return retVal
|
return retVal
|
||||||
|
@ -48,7 +49,7 @@ class HashDB(object):
|
||||||
def retrieve(self, key):
|
def retrieve(self, key):
|
||||||
retVal = None
|
retVal = None
|
||||||
if key:
|
if key:
|
||||||
hash_ = self.hashKey(key)
|
hash_ = HashDB.hashKey(key)
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
for row in self.cursor.execute("SELECT value FROM storage WHERE id=?", (hash_,)):
|
for row in self.cursor.execute("SELECT value FROM storage WHERE id=?", (hash_,)):
|
||||||
|
@ -62,7 +63,7 @@ class HashDB(object):
|
||||||
|
|
||||||
def write(self, key, value):
|
def write(self, key, value):
|
||||||
if key:
|
if key:
|
||||||
hash_ = self.hashKey(key)
|
hash_ = HashDB.hashKey(key)
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user