mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-09 06:01:29 +00:00
Doing some more style updating (capitalization of exception classes; using _ is enough for private members - __ is used in Python specific methods)
This commit is contained in:
@@ -9,8 +9,8 @@ import os
|
||||
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import logger
|
||||
from lib.core.exception import sqlmapFilePathException
|
||||
from lib.core.exception import sqlmapUndefinedMethod
|
||||
from lib.core.exception import SqlmapFilePathException
|
||||
from lib.core.exception import SqlmapUndefinedMethod
|
||||
|
||||
class Connector:
|
||||
"""
|
||||
@@ -59,24 +59,24 @@ class Connector:
|
||||
def checkFileDb(self):
|
||||
if not os.path.exists(self.db):
|
||||
errMsg = "the provided database file '%s' does not exist" % self.db
|
||||
raise sqlmapFilePathException, errMsg
|
||||
raise SqlmapFilePathException, errMsg
|
||||
|
||||
def connect(self):
|
||||
errMsg = "'connect' method must be defined "
|
||||
errMsg += "into the specific DBMS plugin"
|
||||
raise sqlmapUndefinedMethod, errMsg
|
||||
raise SqlmapUndefinedMethod, errMsg
|
||||
|
||||
def fetchall(self):
|
||||
errMsg = "'fetchall' method must be defined "
|
||||
errMsg += "into the specific DBMS plugin"
|
||||
raise sqlmapUndefinedMethod, errMsg
|
||||
raise SqlmapUndefinedMethod, errMsg
|
||||
|
||||
def execute(self, query):
|
||||
errMsg = "'execute' method must be defined "
|
||||
errMsg += "into the specific DBMS plugin"
|
||||
raise sqlmapUndefinedMethod, errMsg
|
||||
raise SqlmapUndefinedMethod, errMsg
|
||||
|
||||
def select(self, query):
|
||||
errMsg = "'select' method must be defined "
|
||||
errMsg += "into the specific DBMS plugin"
|
||||
raise sqlmapUndefinedMethod, errMsg
|
||||
raise SqlmapUndefinedMethod, errMsg
|
||||
|
||||
@@ -32,9 +32,9 @@ from lib.core.enums import CHARSET_TYPE
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.enums import EXPECTED
|
||||
from lib.core.enums import PAYLOAD
|
||||
from lib.core.exception import sqlmapMissingMandatoryOptionException
|
||||
from lib.core.exception import sqlmapNoneDataException
|
||||
from lib.core.exception import sqlmapUserQuitException
|
||||
from lib.core.exception import SqlmapMissingMandatoryOptionException
|
||||
from lib.core.exception import SqlmapNoneDataException
|
||||
from lib.core.exception import SqlmapUserQuitException
|
||||
from lib.core.settings import CURRENT_DB
|
||||
from lib.request import inject
|
||||
from lib.techniques.brute.use import columnExists
|
||||
@@ -166,7 +166,7 @@ class Databases:
|
||||
kb.data.cachedDbs = [kb.data.currentDb]
|
||||
else:
|
||||
errMsg = "unable to retrieve the database names"
|
||||
raise sqlmapNoneDataException, errMsg
|
||||
raise SqlmapNoneDataException, errMsg
|
||||
else:
|
||||
kb.data.cachedDbs.sort()
|
||||
|
||||
@@ -188,7 +188,7 @@ class Databases:
|
||||
elif Backend.isDbms(DBMS.ACCESS):
|
||||
try:
|
||||
tables = self.getTables(False)
|
||||
except sqlmapNoneDataException:
|
||||
except SqlmapNoneDataException:
|
||||
tables = None
|
||||
|
||||
if not tables:
|
||||
@@ -239,7 +239,7 @@ class Databases:
|
||||
if test[0] in ("n", "N"):
|
||||
return
|
||||
elif test[0] in ("q", "Q"):
|
||||
raise sqlmapUserQuitException
|
||||
raise SqlmapUserQuitException
|
||||
else:
|
||||
return tableExists(paths.COMMON_TABLES)
|
||||
|
||||
@@ -351,7 +351,7 @@ class Databases:
|
||||
logger.error(errMsg)
|
||||
return self.getTables(bruteForce=True)
|
||||
else:
|
||||
raise sqlmapNoneDataException, errMsg
|
||||
raise SqlmapNoneDataException, errMsg
|
||||
else:
|
||||
for db, tables in kb.data.cachedTables.items():
|
||||
kb.data.cachedTables[db] = sorted(tables) if tables else tables
|
||||
@@ -377,7 +377,7 @@ class Databases:
|
||||
if ',' in conf.db:
|
||||
errMsg = "only one database name is allowed when enumerating "
|
||||
errMsg += "the tables' columns"
|
||||
raise sqlmapMissingMandatoryOptionException, errMsg
|
||||
raise SqlmapMissingMandatoryOptionException, errMsg
|
||||
|
||||
conf.db = safeSQLIdentificatorNaming(conf.db)
|
||||
|
||||
@@ -415,7 +415,7 @@ class Databases:
|
||||
else:
|
||||
errMsg = "unable to retrieve the tables "
|
||||
errMsg += "in database '%s'" % unsafeSQLIdentificatorNaming(conf.db)
|
||||
raise sqlmapNoneDataException, errMsg
|
||||
raise SqlmapNoneDataException, errMsg
|
||||
|
||||
for tbl in tblList:
|
||||
tblList[tblList.index(tbl)] = safeSQLIdentificatorNaming(tbl, True)
|
||||
@@ -466,7 +466,7 @@ class Databases:
|
||||
if test[0] in ("n", "N"):
|
||||
return
|
||||
elif test[0] in ("q", "Q"):
|
||||
raise sqlmapUserQuitException
|
||||
raise SqlmapUserQuitException
|
||||
else:
|
||||
return columnExists(paths.COMMON_COLUMNS)
|
||||
|
||||
@@ -708,7 +708,7 @@ class Databases:
|
||||
|
||||
return kb.data.cachedColumns
|
||||
|
||||
def __tableGetCount(self, db, table):
|
||||
def _tableGetCount(self, db, table):
|
||||
if Backend.isDbms(DBMS.DB2):
|
||||
query = "SELECT %s FROM %s.%s--" % (queries[Backend.getIdentifiedDbms()].count.query % '*', safeSQLIdentificatorNaming(db.upper()), safeSQLIdentificatorNaming(table.upper(), True))
|
||||
else:
|
||||
@@ -748,12 +748,12 @@ class Databases:
|
||||
|
||||
if conf.tbl:
|
||||
for table in conf.tbl.split(","):
|
||||
self.__tableGetCount(conf.db, table)
|
||||
self._tableGetCount(conf.db, table)
|
||||
else:
|
||||
self.getTables()
|
||||
|
||||
for db, tables in kb.data.cachedTables.items():
|
||||
for table in tables:
|
||||
self.__tableGetCount(db, table)
|
||||
self._tableGetCount(db, table)
|
||||
|
||||
return kb.data.cachedCounts
|
||||
|
||||
@@ -29,10 +29,10 @@ from lib.core.enums import CHARSET_TYPE
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.enums import EXPECTED
|
||||
from lib.core.enums import PAYLOAD
|
||||
from lib.core.exception import sqlmapConnectionException
|
||||
from lib.core.exception import sqlmapMissingMandatoryOptionException
|
||||
from lib.core.exception import sqlmapNoneDataException
|
||||
from lib.core.exception import sqlmapUnsupportedFeatureException
|
||||
from lib.core.exception import SqlmapConnectionException
|
||||
from lib.core.exception import SqlmapMissingMandatoryOptionException
|
||||
from lib.core.exception import SqlmapNoneDataException
|
||||
from lib.core.exception import SqlmapUnsupportedFeatureException
|
||||
from lib.core.settings import CHECK_ZERO_COLUMNS_THRESHOLD
|
||||
from lib.core.settings import CURRENT_DB
|
||||
from lib.core.settings import NULL
|
||||
@@ -67,7 +67,7 @@ class Entries:
|
||||
if ',' in conf.db:
|
||||
errMsg = "only one database name is allowed when enumerating "
|
||||
errMsg += "the tables' columns"
|
||||
raise sqlmapMissingMandatoryOptionException, errMsg
|
||||
raise SqlmapMissingMandatoryOptionException, errMsg
|
||||
|
||||
conf.db = safeSQLIdentificatorNaming(conf.db)
|
||||
|
||||
@@ -87,7 +87,7 @@ class Entries:
|
||||
else:
|
||||
errMsg = "unable to retrieve the tables "
|
||||
errMsg += "in database '%s'" % unsafeSQLIdentificatorNaming(conf.db)
|
||||
raise sqlmapNoneDataException, errMsg
|
||||
raise SqlmapNoneDataException, errMsg
|
||||
|
||||
for tbl in tblList:
|
||||
tblList[tblList.index(tbl)] = safeSQLIdentificatorNaming(tbl, True)
|
||||
@@ -313,7 +313,7 @@ class Entries:
|
||||
attackDumpedTable()
|
||||
conf.dumper.dbTableValues(kb.data.dumpedTable)
|
||||
|
||||
except sqlmapConnectionException, e:
|
||||
except SqlmapConnectionException, e:
|
||||
errMsg = "connection exception detected in dumping phase: "
|
||||
errMsg += "'%s'" % e
|
||||
logger.critical(errMsg)
|
||||
@@ -329,7 +329,7 @@ class Entries:
|
||||
if Backend.isDbms(DBMS.MYSQL) and not kb.data.has_information_schema:
|
||||
errMsg = "information_schema not available, "
|
||||
errMsg += "back-end DBMS is MySQL < 5.0"
|
||||
raise sqlmapUnsupportedFeatureException, errMsg
|
||||
raise SqlmapUnsupportedFeatureException, errMsg
|
||||
|
||||
infoMsg = "sqlmap will dump entries of all tables from all databases now"
|
||||
logger.info(infoMsg)
|
||||
@@ -353,7 +353,7 @@ class Entries:
|
||||
kb.data.dumpedTable = {}
|
||||
|
||||
self.dumpTable()
|
||||
except sqlmapNoneDataException:
|
||||
except SqlmapNoneDataException:
|
||||
infoMsg = "skipping table '%s'" % table
|
||||
logger.info(infoMsg)
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ from lib.core.enums import DBMS
|
||||
from lib.core.enums import CHARSET_TYPE
|
||||
from lib.core.enums import EXPECTED
|
||||
from lib.core.enums import PAYLOAD
|
||||
from lib.core.exception import sqlmapUndefinedMethod
|
||||
from lib.core.exception import SqlmapUndefinedMethod
|
||||
from lib.request import inject
|
||||
|
||||
class Filesystem:
|
||||
@@ -36,7 +36,7 @@ class Filesystem:
|
||||
self.fileTblName = "sqlmapfile"
|
||||
self.tblField = "data"
|
||||
|
||||
def __unhexString(self, hexStr):
|
||||
def _unhexString(self, hexStr):
|
||||
if len(hexStr) % 2 != 0:
|
||||
errMsg = "for some reason(s) sqlmap retrieved an odd-length "
|
||||
errMsg += "hexadecimal string which it is not able to convert "
|
||||
@@ -53,7 +53,7 @@ class Filesystem:
|
||||
|
||||
return cleanStr
|
||||
|
||||
def __checkWrittenFile(self, wFile, dFile, fileType):
|
||||
def _checkWrittenFile(self, wFile, dFile, fileType):
|
||||
if Backend.isDbms(DBMS.MYSQL):
|
||||
lengthQuery = "SELECT LENGTH(LOAD_FILE('%s'))" % dFile
|
||||
|
||||
@@ -157,29 +157,29 @@ class Filesystem:
|
||||
output = readInput(message, default="Y")
|
||||
|
||||
if not output or output in ("y", "Y"):
|
||||
return self.__checkWrittenFile(wFile, dFile, fileType)
|
||||
return self._checkWrittenFile(wFile, dFile, fileType)
|
||||
|
||||
return True
|
||||
|
||||
def nonStackedReadFile(self, rFile):
|
||||
errMsg = "'nonStackedReadFile' method must be defined "
|
||||
errMsg += "into the specific DBMS plugin"
|
||||
raise sqlmapUndefinedMethod, errMsg
|
||||
raise SqlmapUndefinedMethod, errMsg
|
||||
|
||||
def stackedReadFile(self, rFile):
|
||||
errMsg = "'stackedReadFile' method must be defined "
|
||||
errMsg += "into the specific DBMS plugin"
|
||||
raise sqlmapUndefinedMethod, errMsg
|
||||
raise SqlmapUndefinedMethod, errMsg
|
||||
|
||||
def unionWriteFile(self, wFile, dFile, fileType):
|
||||
errMsg = "'unionWriteFile' method must be defined "
|
||||
errMsg += "into the specific DBMS plugin"
|
||||
raise sqlmapUndefinedMethod, errMsg
|
||||
raise SqlmapUndefinedMethod, errMsg
|
||||
|
||||
def stackedWriteFile(self, wFile, dFile, fileType):
|
||||
errMsg = "'stackedWriteFile' method must be defined "
|
||||
errMsg += "into the specific DBMS plugin"
|
||||
raise sqlmapUndefinedMethod, errMsg
|
||||
raise SqlmapUndefinedMethod, errMsg
|
||||
|
||||
def readFile(self, rFile):
|
||||
fileContent = None
|
||||
@@ -230,7 +230,7 @@ class Filesystem:
|
||||
|
||||
fileContent = newFileContent
|
||||
|
||||
fileContent = self.__unhexString(fileContent)
|
||||
fileContent = self._unhexString(fileContent)
|
||||
rFilePath = dataToOutFile(fileContent)
|
||||
|
||||
if not Backend.isDbms(DBMS.PGSQL):
|
||||
|
||||
@@ -9,7 +9,7 @@ from lib.core.common import Backend
|
||||
from lib.core.common import readInput
|
||||
from lib.core.data import logger
|
||||
from lib.core.enums import OS
|
||||
from lib.core.exception import sqlmapUndefinedMethod
|
||||
from lib.core.exception import SqlmapUndefinedMethod
|
||||
|
||||
class Fingerprint:
|
||||
"""
|
||||
@@ -22,17 +22,17 @@ class Fingerprint:
|
||||
def getFingerprint(self):
|
||||
errMsg = "'getFingerprint' method must be defined "
|
||||
errMsg += "into the specific DBMS plugin"
|
||||
raise sqlmapUndefinedMethod, errMsg
|
||||
raise SqlmapUndefinedMethod, errMsg
|
||||
|
||||
def checkDbms(self):
|
||||
errMsg = "'checkDbms' method must be defined "
|
||||
errMsg += "into the specific DBMS plugin"
|
||||
raise sqlmapUndefinedMethod, errMsg
|
||||
raise SqlmapUndefinedMethod, errMsg
|
||||
|
||||
def checkDbmsOs(self, detailed=False):
|
||||
errMsg = "'checkDbmsOs' method must be defined "
|
||||
errMsg += "into the specific DBMS plugin"
|
||||
raise sqlmapUndefinedMethod, errMsg
|
||||
raise SqlmapUndefinedMethod, errMsg
|
||||
|
||||
def forceDbmsEnum(self):
|
||||
pass
|
||||
|
||||
@@ -23,8 +23,8 @@ from lib.core.enums import DBMS
|
||||
from lib.core.enums import HASHDB_KEYS
|
||||
from lib.core.enums import OS
|
||||
from lib.core.enums import PAYLOAD
|
||||
from lib.core.exception import sqlmapNoneDataException
|
||||
from lib.core.exception import sqlmapUnsupportedFeatureException
|
||||
from lib.core.exception import SqlmapNoneDataException
|
||||
from lib.core.exception import SqlmapUnsupportedFeatureException
|
||||
from lib.request import inject
|
||||
|
||||
class Miscellaneous:
|
||||
@@ -79,7 +79,7 @@ class Miscellaneous:
|
||||
first, last = 29, 9
|
||||
|
||||
else:
|
||||
raise sqlmapUnsupportedFeatureException, "unsupported DBMS"
|
||||
raise SqlmapUnsupportedFeatureException, "unsupported DBMS"
|
||||
|
||||
query = queries[Backend.getIdentifiedDbms()].substring.query % (queries[Backend.getIdentifiedDbms()].banner.query, first, last)
|
||||
|
||||
@@ -189,6 +189,6 @@ class Miscellaneous:
|
||||
condParam = "='%s'"
|
||||
else:
|
||||
errMsg = "invalid value"
|
||||
raise sqlmapNoneDataException, errMsg
|
||||
raise SqlmapNoneDataException, errMsg
|
||||
|
||||
return choice, condParam
|
||||
|
||||
@@ -25,8 +25,8 @@ from lib.core.enums import CHARSET_TYPE
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.enums import EXPECTED
|
||||
from lib.core.enums import PAYLOAD
|
||||
from lib.core.exception import sqlmapMissingMandatoryOptionException
|
||||
from lib.core.exception import sqlmapUserQuitException
|
||||
from lib.core.exception import SqlmapMissingMandatoryOptionException
|
||||
from lib.core.exception import SqlmapUserQuitException
|
||||
from lib.core.settings import CURRENT_DB
|
||||
from lib.request import inject
|
||||
from lib.techniques.brute.use import columnExists
|
||||
@@ -148,7 +148,7 @@ class Search:
|
||||
if test[0] in ("n", "N"):
|
||||
return
|
||||
elif test[0] in ("q", "Q"):
|
||||
raise sqlmapUserQuitException
|
||||
raise SqlmapUserQuitException
|
||||
else:
|
||||
regex = "|".join(conf.tbl.split(","))
|
||||
return tableExists(paths.COMMON_TABLES, regex)
|
||||
@@ -306,7 +306,7 @@ class Search:
|
||||
if test[0] in ("n", "N"):
|
||||
return
|
||||
elif test[0] in ("q", "Q"):
|
||||
raise sqlmapUserQuitException
|
||||
raise SqlmapUserQuitException
|
||||
else:
|
||||
regex = "|".join(conf.col.split(","))
|
||||
conf.dumper.dbTableColumns(columnExists(paths.COMMON_COLUMNS, regex))
|
||||
@@ -558,4 +558,4 @@ class Search:
|
||||
else:
|
||||
errMsg = "missing parameter, provide -D, -T or -C along "
|
||||
errMsg += "with --search"
|
||||
raise sqlmapMissingMandatoryOptionException, errMsg
|
||||
raise SqlmapMissingMandatoryOptionException, errMsg
|
||||
|
||||
@@ -5,7 +5,7 @@ Copyright (c) 2006-2012 sqlmap developers (http://sqlmap.org/)
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
from lib.core.exception import sqlmapUndefinedMethod
|
||||
from lib.core.exception import SqlmapUndefinedMethod
|
||||
|
||||
class Syntax:
|
||||
"""
|
||||
@@ -19,10 +19,10 @@ class Syntax:
|
||||
def unescape(expression, quote=True):
|
||||
errMsg = "'unescape' method must be defined "
|
||||
errMsg += "into the specific DBMS plugin"
|
||||
raise sqlmapUndefinedMethod, errMsg
|
||||
raise SqlmapUndefinedMethod, errMsg
|
||||
|
||||
@staticmethod
|
||||
def escape(expression):
|
||||
errMsg = "'escape' method must be defined "
|
||||
errMsg += "into the specific DBMS plugin"
|
||||
raise sqlmapUndefinedMethod, errMsg
|
||||
raise SqlmapUndefinedMethod, errMsg
|
||||
|
||||
@@ -16,12 +16,12 @@ from lib.core.data import logger
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.enums import OS
|
||||
from lib.core.enums import PAYLOAD
|
||||
from lib.core.exception import sqlmapMissingDependence
|
||||
from lib.core.exception import sqlmapMissingMandatoryOptionException
|
||||
from lib.core.exception import sqlmapMissingPrivileges
|
||||
from lib.core.exception import sqlmapNotVulnerableException
|
||||
from lib.core.exception import sqlmapUndefinedMethod
|
||||
from lib.core.exception import sqlmapUnsupportedDBMSException
|
||||
from lib.core.exception import SqlmapMissingDependence
|
||||
from lib.core.exception import SqlmapMissingMandatoryOptionException
|
||||
from lib.core.exception import SqlmapMissingPrivileges
|
||||
from lib.core.exception import SqlmapNotVulnerableException
|
||||
from lib.core.exception import SqlmapUndefinedMethod
|
||||
from lib.core.exception import SqlmapUnsupportedDBMSException
|
||||
from lib.takeover.abstraction import Abstraction
|
||||
from lib.takeover.icmpsh import ICMPsh
|
||||
from lib.takeover.metasploit import Metasploit
|
||||
@@ -51,7 +51,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous):
|
||||
else:
|
||||
errMsg = "unable to execute operating system commands via "
|
||||
errMsg += "the back-end DBMS"
|
||||
raise sqlmapNotVulnerableException(errMsg)
|
||||
raise SqlmapNotVulnerableException(errMsg)
|
||||
|
||||
self.getRemoteTempPath()
|
||||
self.initEnv(web=web)
|
||||
@@ -74,7 +74,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous):
|
||||
errMsg = "unable to prompt for an interactive operating "
|
||||
errMsg += "system shell via the back-end DBMS because "
|
||||
errMsg += "stacked queries SQL injection is not supported"
|
||||
raise sqlmapNotVulnerableException(errMsg)
|
||||
raise SqlmapNotVulnerableException(errMsg)
|
||||
|
||||
self.getRemoteTempPath()
|
||||
self.initEnv(web=web)
|
||||
@@ -124,7 +124,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous):
|
||||
errMsg += "if you want to establish an out-of-band ICMP "
|
||||
errMsg += "tunnel because icmpsh uses raw sockets to "
|
||||
errMsg += "sniff and craft ICMP packets"
|
||||
raise sqlmapMissingPrivileges, errMsg
|
||||
raise SqlmapMissingPrivileges, errMsg
|
||||
|
||||
try:
|
||||
from impacket import ImpactDecoder
|
||||
@@ -133,7 +133,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous):
|
||||
errMsg = "sqlmap requires 'impacket' third-party library "
|
||||
errMsg += "in order to run icmpsh master. Download from "
|
||||
errMsg += "http://oss.coresecurity.com/projects/impacket.html"
|
||||
raise sqlmapMissingDependence, errMsg
|
||||
raise SqlmapMissingDependence, errMsg
|
||||
|
||||
sysIgnoreIcmp = "/proc/sys/net/ipv4/icmp_echo_ignore_all"
|
||||
|
||||
@@ -232,7 +232,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous):
|
||||
else:
|
||||
errMsg = "unable to prompt for an out-of-band session because "
|
||||
errMsg += "stacked queries SQL injection is not supported"
|
||||
raise sqlmapNotVulnerableException(errMsg)
|
||||
raise SqlmapNotVulnerableException(errMsg)
|
||||
|
||||
if tunnel == 1:
|
||||
if not web or (web and self.webBackdoorUrl is not None):
|
||||
@@ -248,14 +248,14 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous):
|
||||
errMsg = "the back-end DBMS underlying operating system is "
|
||||
errMsg += "not Windows: it is not possible to perform the SMB "
|
||||
errMsg += "relay attack"
|
||||
raise sqlmapUnsupportedDBMSException(errMsg)
|
||||
raise SqlmapUnsupportedDBMSException(errMsg)
|
||||
|
||||
if not isTechniqueAvailable(PAYLOAD.TECHNIQUE.STACKED) and not conf.direct:
|
||||
if Backend.getIdentifiedDbms() in ( DBMS.PGSQL, DBMS.MSSQL ):
|
||||
errMsg = "on this back-end DBMS it is only possible to "
|
||||
errMsg += "perform the SMB relay attack if stacked "
|
||||
errMsg += "queries are supported"
|
||||
raise sqlmapUnsupportedDBMSException(errMsg)
|
||||
raise SqlmapUnsupportedDBMSException(errMsg)
|
||||
|
||||
elif Backend.isDbms(DBMS.MYSQL):
|
||||
debugMsg = "since stacked queries are not supported, "
|
||||
@@ -300,7 +300,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous):
|
||||
errMsg += "2000 or 2005 to be able to exploit the heap-based "
|
||||
errMsg += "buffer overflow in the 'sp_replwritetovarbin' "
|
||||
errMsg += "stored procedure (MS09-004)"
|
||||
raise sqlmapUnsupportedDBMSException(errMsg)
|
||||
raise SqlmapUnsupportedDBMSException(errMsg)
|
||||
|
||||
infoMsg = "going to exploit the Microsoft SQL Server %s " % Backend.getVersion()
|
||||
infoMsg += "'sp_replwritetovarbin' stored procedure heap-based "
|
||||
@@ -325,9 +325,9 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous):
|
||||
def uncPathRequest(self):
|
||||
errMsg = "'uncPathRequest' method must be defined "
|
||||
errMsg += "into the specific DBMS plugin"
|
||||
raise sqlmapUndefinedMethod, errMsg
|
||||
raise SqlmapUndefinedMethod, errMsg
|
||||
|
||||
def __regInit(self):
|
||||
def _regInit(self):
|
||||
if not isTechniqueAvailable(PAYLOAD.TECHNIQUE.STACKED) and not conf.direct:
|
||||
return
|
||||
|
||||
@@ -336,13 +336,13 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous):
|
||||
if not Backend.isOs(OS.WINDOWS):
|
||||
errMsg = "the back-end DBMS underlying operating system is "
|
||||
errMsg += "not Windows"
|
||||
raise sqlmapUnsupportedDBMSException(errMsg)
|
||||
raise SqlmapUnsupportedDBMSException(errMsg)
|
||||
|
||||
self.initEnv()
|
||||
self.getRemoteTempPath()
|
||||
|
||||
def regRead(self):
|
||||
self.__regInit()
|
||||
self._regInit()
|
||||
|
||||
if not conf.regKey:
|
||||
default = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
|
||||
@@ -364,7 +364,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous):
|
||||
return self.readRegKey(regKey, regVal, True)
|
||||
|
||||
def regAdd(self):
|
||||
self.__regInit()
|
||||
self._regInit()
|
||||
|
||||
errMsg = "missing mandatory option"
|
||||
|
||||
@@ -373,7 +373,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous):
|
||||
regKey = readInput(msg)
|
||||
|
||||
if not regKey:
|
||||
raise sqlmapMissingMandatoryOptionException(errMsg)
|
||||
raise SqlmapMissingMandatoryOptionException(errMsg)
|
||||
else:
|
||||
regKey = conf.regKey
|
||||
|
||||
@@ -382,7 +382,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous):
|
||||
regVal = readInput(msg)
|
||||
|
||||
if not regVal:
|
||||
raise sqlmapMissingMandatoryOptionException(errMsg)
|
||||
raise SqlmapMissingMandatoryOptionException(errMsg)
|
||||
else:
|
||||
regVal = conf.regVal
|
||||
|
||||
@@ -391,7 +391,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous):
|
||||
regData = readInput(msg)
|
||||
|
||||
if not regData:
|
||||
raise sqlmapMissingMandatoryOptionException(errMsg)
|
||||
raise SqlmapMissingMandatoryOptionException(errMsg)
|
||||
else:
|
||||
regData = conf.regData
|
||||
|
||||
@@ -412,7 +412,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous):
|
||||
self.addRegKey(regKey, regVal, regType, regData)
|
||||
|
||||
def regDel(self):
|
||||
self.__regInit()
|
||||
self._regInit()
|
||||
|
||||
errMsg = "missing mandatory option"
|
||||
|
||||
@@ -421,7 +421,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous):
|
||||
regKey = readInput(msg)
|
||||
|
||||
if not regKey:
|
||||
raise sqlmapMissingMandatoryOptionException(errMsg)
|
||||
raise SqlmapMissingMandatoryOptionException(errMsg)
|
||||
else:
|
||||
regKey = conf.regKey
|
||||
|
||||
@@ -430,7 +430,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous):
|
||||
regVal = readInput(msg)
|
||||
|
||||
if not regVal:
|
||||
raise sqlmapMissingMandatoryOptionException(errMsg)
|
||||
raise SqlmapMissingMandatoryOptionException(errMsg)
|
||||
else:
|
||||
regVal = conf.regVal
|
||||
|
||||
|
||||
@@ -35,8 +35,8 @@ from lib.core.enums import CHARSET_TYPE
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.enums import EXPECTED
|
||||
from lib.core.enums import PAYLOAD
|
||||
from lib.core.exception import sqlmapNoneDataException
|
||||
from lib.core.exception import sqlmapUserQuitException
|
||||
from lib.core.exception import SqlmapNoneDataException
|
||||
from lib.core.exception import SqlmapUserQuitException
|
||||
from lib.core.threads import getCurrentThreadData
|
||||
from lib.request import inject
|
||||
from lib.utils.hash import attackCachedUsersPasswords
|
||||
@@ -116,7 +116,7 @@ class Users:
|
||||
|
||||
if not isNumPosStrValue(count):
|
||||
errMsg = "unable to retrieve the number of database users"
|
||||
raise sqlmapNoneDataException, errMsg
|
||||
raise SqlmapNoneDataException, errMsg
|
||||
|
||||
plusOne = Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2)
|
||||
indexRange = getLimitRange(count, plusOne=plusOne)
|
||||
@@ -135,7 +135,7 @@ class Users:
|
||||
|
||||
if not kb.data.cachedUsers:
|
||||
errMsg = "unable to retrieve the database users"
|
||||
raise sqlmapNoneDataException, errMsg
|
||||
raise SqlmapNoneDataException, errMsg
|
||||
|
||||
return kb.data.cachedUsers
|
||||
|
||||
@@ -296,7 +296,7 @@ class Users:
|
||||
errMsg += "database users (most probably because the session "
|
||||
errMsg += "user has no read privileges over the relevant "
|
||||
errMsg += "system database table)"
|
||||
raise sqlmapNoneDataException, errMsg
|
||||
raise SqlmapNoneDataException, errMsg
|
||||
else:
|
||||
for user in kb.data.cachedUsersPasswords:
|
||||
kb.data.cachedUsersPasswords[user] = list(set(kb.data.cachedUsersPasswords[user]))
|
||||
@@ -310,7 +310,7 @@ class Users:
|
||||
if test[0] in ("n", "N"):
|
||||
pass
|
||||
elif test[0] in ("q", "Q"):
|
||||
raise sqlmapUserQuitException
|
||||
raise SqlmapUserQuitException
|
||||
else:
|
||||
attackCachedUsersPasswords()
|
||||
|
||||
@@ -584,7 +584,7 @@ class Users:
|
||||
if not kb.data.cachedUsersPrivileges:
|
||||
errMsg = "unable to retrieve the privileges "
|
||||
errMsg += "for the database users"
|
||||
raise sqlmapNoneDataException, errMsg
|
||||
raise SqlmapNoneDataException, errMsg
|
||||
|
||||
return (kb.data.cachedUsersPrivileges, areAdmins)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user