mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-08-04 06:50:14 +00:00
code refactoring regarding charsetType inside inference/bisection
This commit is contained in:
parent
f6f98f1b41
commit
8b9c5c66cc
10 changed files with 47 additions and 31 deletions
|
|
@ -57,6 +57,7 @@ from lib.core.convert import htmlunescape
|
|||
from lib.core.convert import unicodeencode
|
||||
from lib.core.convert import urldecode
|
||||
from lib.core.convert import urlencode
|
||||
from lib.core.enums import CHARSET_TYPE
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.enums import EXPECTED
|
||||
from lib.core.enums import HTTPHEADER
|
||||
|
|
@ -1312,30 +1313,30 @@ def getCharset(charsetType=None):
|
|||
asciiTbl.extend(xrange(0, 128))
|
||||
|
||||
# 0 or 1
|
||||
elif charsetType == 1:
|
||||
elif charsetType == CHARSET_TYPE.BINARY:
|
||||
asciiTbl.extend([0, 1])
|
||||
asciiTbl.extend(xrange(47, 50))
|
||||
|
||||
# Digits
|
||||
elif charsetType == 2:
|
||||
elif charsetType == CHARSET_TYPE.DIGITS:
|
||||
asciiTbl.extend([0, 1])
|
||||
asciiTbl.extend(xrange(47, 58))
|
||||
|
||||
# Hexadecimal
|
||||
elif charsetType == 3:
|
||||
elif charsetType == CHARSET_TYPE.HEXADECIMAL:
|
||||
asciiTbl.extend([0, 1])
|
||||
asciiTbl.extend(xrange(47, 58))
|
||||
asciiTbl.extend(xrange(64, 71))
|
||||
asciiTbl.extend(xrange(96, 103))
|
||||
|
||||
# Characters
|
||||
elif charsetType == 4:
|
||||
elif charsetType == CHARSET_TYPE.ALPHA:
|
||||
asciiTbl.extend([0, 1])
|
||||
asciiTbl.extend(xrange(64, 91))
|
||||
asciiTbl.extend(xrange(96, 123))
|
||||
|
||||
# Characters and digits
|
||||
elif charsetType == 5:
|
||||
elif charsetType == CHARSET_TYPE.ALPHANUM:
|
||||
asciiTbl.extend([0, 1])
|
||||
asciiTbl.extend(xrange(47, 58))
|
||||
asciiTbl.extend(xrange(64, 91))
|
||||
|
|
|
|||
|
|
@ -80,6 +80,13 @@ class REFLECTIVE_COUNTER:
|
|||
MISS = "MISS"
|
||||
HIT = "HIT"
|
||||
|
||||
class CHARSET_TYPE:
|
||||
BINARY = 1,
|
||||
DIGITS = 2,
|
||||
HEXADECIMAL = 3,
|
||||
ALPHA = 4,
|
||||
ALPHANUM = 5
|
||||
|
||||
class HASH:
|
||||
MYSQL = r'(?i)\A\*[0-9a-f]{40}\Z'
|
||||
MYSQL_OLD = r'(?i)\A(?![0-9]+\Z)[0-9a-f]{16}\Z'
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ from lib.core.data import conf
|
|||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
from lib.core.data import queries
|
||||
from lib.core.enums import CHARSET_TYPE
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.enums import OS
|
||||
from lib.core.enums import PAYLOAD
|
||||
|
|
@ -53,7 +54,7 @@ class UDF:
|
|||
logger.info("checking if UDF '%s' already exist" % udf)
|
||||
|
||||
query = agent.forgeCaseStatement(queries[Backend.getIdentifiedDbms()].check_udf.query % (udf, udf))
|
||||
exists = inject.getValue(query, resumeValue=False, charsetType=2)
|
||||
exists = inject.getValue(query, resumeValue=False, charsetType=CHARSET_TYPE.DIGITS)
|
||||
|
||||
if exists == "1":
|
||||
return True
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ from lib.core.data import conf
|
|||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
from lib.core.data import queries
|
||||
from lib.core.enums import CHARSET_TYPE
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.unescaper import unescaper
|
||||
from lib.techniques.blind.inference import bisection
|
||||
|
|
@ -70,7 +71,7 @@ def queryOutputLength(expression, payload):
|
|||
|
||||
start = time.time()
|
||||
lengthExprUnescaped = unescaper.unescape(lengthExpr)
|
||||
count, length = bisection(payload, lengthExprUnescaped, charsetType=2)
|
||||
count, length = bisection(payload, lengthExprUnescaped, charsetType=CHARSET_TYPE.DIGITS)
|
||||
|
||||
debugMsg = "performed %d queries in %d seconds" % (count, calculateDeltaSeconds(start))
|
||||
logger.debug(debugMsg)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue