mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-24 16:39:04 +00:00
Implementing support for --file-read on Oracle (Issue #26)
This commit is contained in:
@@ -265,7 +265,7 @@ class Agent(object):
|
||||
|
||||
return query
|
||||
|
||||
def suffixQuery(self, expression, comment=None, suffix=None, where=None):
|
||||
def suffixQuery(self, expression, comment=None, suffix=None, where=None, trimEmpty=True):
|
||||
"""
|
||||
This method appends the DBMS comment to the
|
||||
SQL injection request
|
||||
@@ -303,7 +303,7 @@ class Agent(object):
|
||||
|
||||
expression += suffix.replace('\\', BOUNDARY_BACKSLASH_MARKER)
|
||||
|
||||
return re.sub(r";\W*;", ";", expression)
|
||||
return re.sub(r";\W*;", ";", expression) if trimEmpty else expression
|
||||
|
||||
def cleanupPayload(self, payload, origValue=None):
|
||||
if payload is None:
|
||||
|
||||
@@ -18,7 +18,7 @@ from lib.core.enums import OS
|
||||
from thirdparty.six import unichr as _unichr
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.3.6.6"
|
||||
VERSION = "1.3.6.7"
|
||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
||||
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||
|
||||
@@ -74,7 +74,7 @@ def _oneShotErrorUse(expression, field=None, chunkTest=False):
|
||||
|
||||
threadData.resumed = retVal is not None and not partialValue
|
||||
|
||||
if any(Backend.isDbms(dbms) for dbms in (DBMS.MYSQL, DBMS.MSSQL)) and kb.errorChunkLength is None and not chunkTest and not kb.testMode:
|
||||
if any(Backend.isDbms(dbms) for dbms in (DBMS.MYSQL, DBMS.MSSQL, DBMS.ORACLE)) and kb.errorChunkLength is None and not chunkTest and not kb.testMode:
|
||||
debugMsg = "searching for error chunk length..."
|
||||
logger.debug(debugMsg)
|
||||
|
||||
@@ -82,8 +82,11 @@ def _oneShotErrorUse(expression, field=None, chunkTest=False):
|
||||
while current >= MIN_ERROR_CHUNK_LENGTH:
|
||||
testChar = str(current % 10)
|
||||
|
||||
testQuery = "%s('%s',%d)" % ("REPEAT" if Backend.isDbms(DBMS.MYSQL) else "REPLICATE", testChar, current)
|
||||
testQuery = "SELECT %s" % (agent.hexConvertField(testQuery) if conf.hexConvert else testQuery)
|
||||
if Backend.isDbms(DBMS.ORACLE):
|
||||
testQuery = "RPAD('%s',%d,'%s')" % (testChar, current, testChar)
|
||||
else:
|
||||
testQuery = "%s('%s',%d)" % ("REPEAT" if Backend.isDbms(DBMS.MYSQL) else "REPLICATE", testChar, current)
|
||||
testQuery = "SELECT %s" % (agent.hexConvertField(testQuery) if conf.hexConvert else testQuery)
|
||||
|
||||
result = unArrayizeValue(_oneShotErrorUse(testQuery, chunkTest=True))
|
||||
|
||||
@@ -112,7 +115,7 @@ def _oneShotErrorUse(expression, field=None, chunkTest=False):
|
||||
if field:
|
||||
nulledCastedField = agent.nullAndCastField(field)
|
||||
|
||||
if any(Backend.isDbms(dbms) for dbms in (DBMS.MYSQL, DBMS.MSSQL)) and not any(_ in field for _ in ("COUNT", "CASE")) and kb.errorChunkLength and not chunkTest:
|
||||
if any(Backend.isDbms(dbms) for dbms in (DBMS.MYSQL, DBMS.MSSQL, DBMS.ORACLE)) and not any(_ in field for _ in ("COUNT", "CASE")) and kb.errorChunkLength and not chunkTest:
|
||||
extendedField = re.search(r"[^ ,]*%s[^ ,]*" % re.escape(field), expression).group(0)
|
||||
if extendedField != field: # e.g. MIN(surname)
|
||||
nulledCastedField = extendedField.replace(field, nulledCastedField)
|
||||
@@ -172,7 +175,7 @@ def _oneShotErrorUse(expression, field=None, chunkTest=False):
|
||||
else:
|
||||
output = output.rstrip()
|
||||
|
||||
if any(Backend.isDbms(dbms) for dbms in (DBMS.MYSQL, DBMS.MSSQL)):
|
||||
if any(Backend.isDbms(dbms) for dbms in (DBMS.MYSQL, DBMS.MSSQL, DBMS.ORACLE)):
|
||||
if offset == 1:
|
||||
retVal = output
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user