mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 01:26:42 +03:00
Minor refactoring
This commit is contained in:
parent
f8e9f9c87d
commit
257fa3e9e4
|
@ -18,7 +18,7 @@ from lib.core.enums import OS
|
||||||
from thirdparty.six import unichr as _unichr
|
from thirdparty.six import unichr as _unichr
|
||||||
|
|
||||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||||
VERSION = "1.3.5.155"
|
VERSION = "1.3.5.156"
|
||||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
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)
|
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Enumeration(GenericEnumeration):
|
||||||
warnMsg = "on Microsoft Access it is not possible to get name of the current database"
|
warnMsg = "on Microsoft Access it is not possible to get name of the current database"
|
||||||
logger.warn(warnMsg)
|
logger.warn(warnMsg)
|
||||||
|
|
||||||
def isDba(self):
|
def isDba(self, *args, **kwargs):
|
||||||
warnMsg = "on Microsoft Access it is not possible to test if current user is DBA"
|
warnMsg = "on Microsoft Access it is not possible to test if current user is DBA"
|
||||||
logger.warn(warnMsg)
|
logger.warn(warnMsg)
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class Enumeration(GenericEnumeration):
|
||||||
|
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def getPrivileges(self, *args):
|
def getPrivileges(self, *args, **kwargs):
|
||||||
warnMsg = "on Microsoft Access it is not possible to enumerate the user privileges"
|
warnMsg = "on Microsoft Access it is not possible to enumerate the user privileges"
|
||||||
logger.warn(warnMsg)
|
logger.warn(warnMsg)
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Enumeration(GenericEnumeration):
|
||||||
|
|
||||||
return kb.data.banner
|
return kb.data.banner
|
||||||
|
|
||||||
def getPrivileges(self, *args):
|
def getPrivileges(self, *args, **kwargs):
|
||||||
warnMsg = "on H2 it is not possible to enumerate the user privileges"
|
warnMsg = "on H2 it is not possible to enumerate the user privileges"
|
||||||
logger.warn(warnMsg)
|
logger.warn(warnMsg)
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Enumeration(GenericEnumeration):
|
||||||
|
|
||||||
return kb.data.banner
|
return kb.data.banner
|
||||||
|
|
||||||
def getPrivileges(self, *args):
|
def getPrivileges(self, *args, **kwargs):
|
||||||
warnMsg = "on HSQLDB it is not possible to enumerate the user privileges"
|
warnMsg = "on HSQLDB it is not possible to enumerate the user privileges"
|
||||||
logger.warn(warnMsg)
|
logger.warn(warnMsg)
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ class Enumeration(GenericEnumeration):
|
||||||
|
|
||||||
return kb.data.cachedColumns
|
return kb.data.cachedColumns
|
||||||
|
|
||||||
def getPrivileges(self, *args):
|
def getPrivileges(self, *args, **kwargs):
|
||||||
warnMsg = "on SAP MaxDB it is not possible to enumerate the user privileges"
|
warnMsg = "on SAP MaxDB it is not possible to enumerate the user privileges"
|
||||||
logger.warn(warnMsg)
|
logger.warn(warnMsg)
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ from plugins.generic.enumeration import Enumeration as GenericEnumeration
|
||||||
from thirdparty import six
|
from thirdparty import six
|
||||||
|
|
||||||
class Enumeration(GenericEnumeration):
|
class Enumeration(GenericEnumeration):
|
||||||
def getPrivileges(self, *args):
|
def getPrivileges(self, *args, **kwargs):
|
||||||
warnMsg = "on Microsoft SQL Server it is not possible to fetch "
|
warnMsg = "on Microsoft SQL Server it is not possible to fetch "
|
||||||
warnMsg += "database users privileges, sqlmap will check whether "
|
warnMsg += "database users privileges, sqlmap will check whether "
|
||||||
warnMsg += "or not the database users are database administrators"
|
warnMsg += "or not the database users are database administrators"
|
||||||
|
|
|
@ -18,7 +18,7 @@ class Enumeration(GenericEnumeration):
|
||||||
warnMsg = "on SQLite it is not possible to get name of the current database"
|
warnMsg = "on SQLite it is not possible to get name of the current database"
|
||||||
logger.warn(warnMsg)
|
logger.warn(warnMsg)
|
||||||
|
|
||||||
def isDba(self):
|
def isDba(self, *args, **kwargs):
|
||||||
warnMsg = "on SQLite the current user has all privileges"
|
warnMsg = "on SQLite the current user has all privileges"
|
||||||
logger.warn(warnMsg)
|
logger.warn(warnMsg)
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class Enumeration(GenericEnumeration):
|
||||||
|
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def getPrivileges(self, *args):
|
def getPrivileges(self, *args, **kwargs):
|
||||||
warnMsg = "on SQLite it is not possible to enumerate the user privileges"
|
warnMsg = "on SQLite it is not possible to enumerate the user privileges"
|
||||||
logger.warn(warnMsg)
|
logger.warn(warnMsg)
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ class Enumeration(GenericEnumeration):
|
||||||
|
|
||||||
return kb.data.cachedUsers
|
return kb.data.cachedUsers
|
||||||
|
|
||||||
def getPrivileges(self, *args):
|
def getPrivileges(self, *args, **kwargs):
|
||||||
warnMsg = "on Sybase it is not possible to fetch "
|
warnMsg = "on Sybase it is not possible to fetch "
|
||||||
warnMsg += "database users privileges, sqlmap will check whether "
|
warnMsg += "database users privileges, sqlmap will check whether "
|
||||||
warnMsg += "or not the database users are database administrators"
|
warnMsg += "or not the database users are database administrators"
|
||||||
|
|
|
@ -54,11 +54,11 @@ class Custom(object):
|
||||||
|
|
||||||
return output
|
return output
|
||||||
elif not isStackingAvailable() and not conf.direct:
|
elif not isStackingAvailable() and not conf.direct:
|
||||||
warnMsg = "execution of non-query SQL statements is only "
|
warnMsg = "execution of non-query SQL statements is only "
|
||||||
warnMsg += "available when stacked queries are supported"
|
warnMsg += "available when stacked queries are supported"
|
||||||
logger.warn(warnMsg)
|
logger.warn(warnMsg)
|
||||||
|
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
if sqlType:
|
if sqlType:
|
||||||
debugMsg = "executing %s query: '%s'" % (sqlType if sqlType is not None else "SQL", query)
|
debugMsg = "executing %s query: '%s'" % (sqlType if sqlType is not None else "SQL", query)
|
||||||
|
|
|
@ -43,7 +43,7 @@ def tamper(payload, **kwargs):
|
||||||
retVal = payload
|
retVal = payload
|
||||||
|
|
||||||
if payload:
|
if payload:
|
||||||
retVal = re.sub(r"\b(?P<word>[A-Z_]+)(?=[^\w(]|\Z)", lambda match: process(match), retVal)
|
retVal = re.sub(r"\b(?P<word>[A-Z_]+)(?=[^\w(]|\Z)", process, retVal)
|
||||||
retVal = re.sub(r"\s*=\s*", " LIKE ", retVal)
|
retVal = re.sub(r"\s*=\s*", " LIKE ", retVal)
|
||||||
retVal = retVal.replace("%09 ", "%09")
|
retVal = retVal.replace("%09 ", "%09")
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ def tamper(payload, **kwargs):
|
||||||
retVal = payload
|
retVal = payload
|
||||||
|
|
||||||
if payload:
|
if payload:
|
||||||
retVal = re.sub(r"(?<=\W)(?P<word>[A-Za-z_]+)(?=\W|\Z)", lambda match: process(match), retVal)
|
retVal = re.sub(r"(?<=\W)(?P<word>[A-Za-z_]+)(?=\W|\Z)", process, retVal)
|
||||||
retVal = retVal.replace(" /*!0", "/*!0")
|
retVal = retVal.replace(" /*!0", "/*!0")
|
||||||
|
|
||||||
return retVal
|
return retVal
|
||||||
|
|
|
@ -54,7 +54,7 @@ def tamper(payload, **kwargs):
|
||||||
retVal = ""
|
retVal = ""
|
||||||
|
|
||||||
if payload:
|
if payload:
|
||||||
payload = re.sub(r"(?<=\W)(?P<word>[A-Za-z_]+)(?=\W|\Z)", lambda match: process(match), payload)
|
payload = re.sub(r"(?<=\W)(?P<word>[A-Za-z_]+)(?=\W|\Z)", process, payload)
|
||||||
|
|
||||||
for i in xrange(len(payload)):
|
for i in xrange(len(payload)):
|
||||||
if payload[i].isspace():
|
if payload[i].isspace():
|
||||||
|
|
|
@ -46,7 +46,7 @@ def tamper(payload, **kwargs):
|
||||||
retVal = payload
|
retVal = payload
|
||||||
|
|
||||||
if payload:
|
if payload:
|
||||||
retVal = re.sub(r"(?<=\W)(?P<word>[A-Za-z_]+)(?=[^\w(]|\Z)", lambda match: process(match), retVal)
|
retVal = re.sub(r"(?<=\W)(?P<word>[A-Za-z_]+)(?=[^\w(]|\Z)", process, retVal)
|
||||||
retVal = retVal.replace(" /*!", "/*!").replace("*/ ", "*/")
|
retVal = retVal.replace(" /*!", "/*!").replace("*/ ", "*/")
|
||||||
|
|
||||||
return retVal
|
return retVal
|
||||||
|
|
|
@ -47,7 +47,7 @@ def tamper(payload, **kwargs):
|
||||||
retVal = payload
|
retVal = payload
|
||||||
|
|
||||||
if payload:
|
if payload:
|
||||||
retVal = re.sub(r"(?<=\W)(?P<word>[A-Za-z_]+)(?=\W|\Z)", lambda match: process(match), retVal)
|
retVal = re.sub(r"(?<=\W)(?P<word>[A-Za-z_]+)(?=\W|\Z)", process, retVal)
|
||||||
retVal = retVal.replace(" /*!", "/*!").replace("*/ ", "*/")
|
retVal = retVal.replace(" /*!", "/*!").replace("*/ ", "*/")
|
||||||
|
|
||||||
return retVal
|
return retVal
|
||||||
|
|
Loading…
Reference in New Issue
Block a user