mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-01-23 15:54:24 +03:00
code refactoring
This commit is contained in:
parent
7e2984b4b6
commit
0eb2c408a9
|
@ -44,31 +44,11 @@ from lib.core.exception import sqlmapSiteTooDynamic
|
||||||
from lib.core.exception import sqlmapUserQuitException
|
from lib.core.exception import sqlmapUserQuitException
|
||||||
from lib.core.session import setString
|
from lib.core.session import setString
|
||||||
from lib.core.session import setRegexp
|
from lib.core.session import setRegexp
|
||||||
|
from lib.core.unescaper import unescaper
|
||||||
from lib.request.connect import Connect as Request
|
from lib.request.connect import Connect as Request
|
||||||
from lib.request.templates import getPageTemplate
|
from lib.request.templates import getPageTemplate
|
||||||
from plugins.dbms.firebird.syntax import Syntax as Firebird
|
|
||||||
from plugins.dbms.postgresql.syntax import Syntax as PostgreSQL
|
|
||||||
from plugins.dbms.mssqlserver.syntax import Syntax as MSSQLServer
|
|
||||||
from plugins.dbms.oracle.syntax import Syntax as Oracle
|
|
||||||
from plugins.dbms.mysql.syntax import Syntax as MySQL
|
|
||||||
from plugins.dbms.access.syntax import Syntax as Access
|
|
||||||
from plugins.dbms.sybase.syntax import Syntax as Sybase
|
|
||||||
from plugins.dbms.sqlite.syntax import Syntax as SQLite
|
|
||||||
from plugins.dbms.maxdb.syntax import Syntax as MaxDB
|
|
||||||
|
|
||||||
def unescape(string, dbms):
|
def unescape(string, dbms):
|
||||||
unescaper = {
|
|
||||||
"Access": Access.unescape,
|
|
||||||
"Firebird": Firebird.unescape,
|
|
||||||
"MaxDB": MaxDB.unescape,
|
|
||||||
"Microsoft SQL Server": MSSQLServer.unescape,
|
|
||||||
"MySQL": MySQL.unescape,
|
|
||||||
"Oracle": Oracle.unescape,
|
|
||||||
"PostgreSQL": PostgreSQL.unescape,
|
|
||||||
"SQLite": SQLite.unescape,
|
|
||||||
"Sybase": Sybase.unescape
|
|
||||||
}
|
|
||||||
|
|
||||||
if dbms in unescaper and "WAITFOR DELAY " not in string:
|
if dbms in unescaper and "WAITFOR DELAY " not in string:
|
||||||
return unescaper[dbms](string)
|
return unescaper[dbms](string)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -7,7 +7,9 @@ Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||||
See the file 'doc/COPYING' for copying permission
|
See the file 'doc/COPYING' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class Unescaper:
|
from lib.core.datatype import advancedDict
|
||||||
|
|
||||||
|
class Unescaper(advancedDict):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.__unescaper = None
|
self.__unescaper = None
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||||
See the file 'doc/COPYING' for copying permission
|
See the file 'doc/COPYING' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from lib.core.enums import DBMS
|
||||||
from lib.core.settings import ACCESS_SYSTEM_DBS
|
from lib.core.settings import ACCESS_SYSTEM_DBS
|
||||||
from lib.core.unescaper import unescaper
|
from lib.core.unescaper import unescaper
|
||||||
|
|
||||||
|
@ -32,4 +33,5 @@ class AccessMap(Syntax, Fingerprint, Enumeration, Filesystem, Miscellaneous, Tak
|
||||||
Miscellaneous.__init__(self)
|
Miscellaneous.__init__(self)
|
||||||
Takeover.__init__(self)
|
Takeover.__init__(self)
|
||||||
|
|
||||||
|
unescaper[DBMS.ACCESS] = AccessMap.unescape
|
||||||
unescaper.setUnescape(AccessMap.unescape)
|
unescaper.setUnescape(AccessMap.unescape)
|
||||||
|
|
|
@ -7,6 +7,7 @@ Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||||
See the file 'doc/COPYING' for copying permission
|
See the file 'doc/COPYING' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from lib.core.enums import DBMS
|
||||||
from lib.core.settings import FIREBIRD_SYSTEM_DBS
|
from lib.core.settings import FIREBIRD_SYSTEM_DBS
|
||||||
from lib.core.unescaper import unescaper
|
from lib.core.unescaper import unescaper
|
||||||
|
|
||||||
|
@ -32,4 +33,5 @@ class FirebirdMap(Syntax, Fingerprint, Enumeration, Filesystem, Miscellaneous, T
|
||||||
Miscellaneous.__init__(self)
|
Miscellaneous.__init__(self)
|
||||||
Takeover.__init__(self)
|
Takeover.__init__(self)
|
||||||
|
|
||||||
|
unescaper[DBMS.FIREBIRD] = FirebirdMap.unescape
|
||||||
unescaper.setUnescape(FirebirdMap.unescape)
|
unescaper.setUnescape(FirebirdMap.unescape)
|
||||||
|
|
|
@ -7,6 +7,7 @@ Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||||
See the file 'doc/COPYING' for copying permission
|
See the file 'doc/COPYING' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from lib.core.enums import DBMS
|
||||||
from lib.core.settings import MAXDB_SYSTEM_DBS
|
from lib.core.settings import MAXDB_SYSTEM_DBS
|
||||||
from lib.core.unescaper import unescaper
|
from lib.core.unescaper import unescaper
|
||||||
|
|
||||||
|
@ -32,4 +33,5 @@ class MaxDBMap(Syntax, Fingerprint, Enumeration, Filesystem, Miscellaneous, Take
|
||||||
Miscellaneous.__init__(self)
|
Miscellaneous.__init__(self)
|
||||||
Takeover.__init__(self)
|
Takeover.__init__(self)
|
||||||
|
|
||||||
|
unescaper[DBMS.MAXDB] = MaxDBMap.unescape
|
||||||
unescaper.setUnescape(MaxDBMap.unescape)
|
unescaper.setUnescape(MaxDBMap.unescape)
|
||||||
|
|
|
@ -7,6 +7,7 @@ Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||||
See the file 'doc/COPYING' for copying permission
|
See the file 'doc/COPYING' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from lib.core.enums import DBMS
|
||||||
from lib.core.settings import MSSQL_SYSTEM_DBS
|
from lib.core.settings import MSSQL_SYSTEM_DBS
|
||||||
from lib.core.unescaper import unescaper
|
from lib.core.unescaper import unescaper
|
||||||
|
|
||||||
|
@ -33,4 +34,5 @@ class MSSQLServerMap(Syntax, Fingerprint, Enumeration, Filesystem, Miscellaneous
|
||||||
Miscellaneous.__init__(self)
|
Miscellaneous.__init__(self)
|
||||||
Takeover.__init__(self)
|
Takeover.__init__(self)
|
||||||
|
|
||||||
|
unescaper[DBMS.MSSQL] = MSSQLServerMap.unescape
|
||||||
unescaper.setUnescape(MSSQLServerMap.unescape)
|
unescaper.setUnescape(MSSQLServerMap.unescape)
|
||||||
|
|
|
@ -7,6 +7,7 @@ Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||||
See the file 'doc/COPYING' for copying permission
|
See the file 'doc/COPYING' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from lib.core.enums import DBMS
|
||||||
from lib.core.settings import MYSQL_SYSTEM_DBS
|
from lib.core.settings import MYSQL_SYSTEM_DBS
|
||||||
from lib.core.unescaper import unescaper
|
from lib.core.unescaper import unescaper
|
||||||
|
|
||||||
|
@ -38,4 +39,5 @@ class MySQLMap(Syntax, Fingerprint, Enumeration, Filesystem, Miscellaneous, Take
|
||||||
Miscellaneous.__init__(self)
|
Miscellaneous.__init__(self)
|
||||||
Takeover.__init__(self)
|
Takeover.__init__(self)
|
||||||
|
|
||||||
|
unescaper[DBMS.MYSQL] = MySQLMap.unescape
|
||||||
unescaper.setUnescape(MySQLMap.unescape)
|
unescaper.setUnescape(MySQLMap.unescape)
|
||||||
|
|
|
@ -7,6 +7,7 @@ Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||||
See the file 'doc/COPYING' for copying permission
|
See the file 'doc/COPYING' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from lib.core.enums import DBMS
|
||||||
from lib.core.settings import ORACLE_SYSTEM_DBS
|
from lib.core.settings import ORACLE_SYSTEM_DBS
|
||||||
from lib.core.unescaper import unescaper
|
from lib.core.unescaper import unescaper
|
||||||
|
|
||||||
|
@ -32,4 +33,5 @@ class OracleMap(Syntax, Fingerprint, Enumeration, Filesystem, Miscellaneous, Tak
|
||||||
Miscellaneous.__init__(self)
|
Miscellaneous.__init__(self)
|
||||||
Takeover.__init__(self)
|
Takeover.__init__(self)
|
||||||
|
|
||||||
|
unescaper[DBMS.ORACLE] = OracleMap.unescape
|
||||||
unescaper.setUnescape(OracleMap.unescape)
|
unescaper.setUnescape(OracleMap.unescape)
|
||||||
|
|
|
@ -7,6 +7,7 @@ Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||||
See the file 'doc/COPYING' for copying permission
|
See the file 'doc/COPYING' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from lib.core.enums import DBMS
|
||||||
from lib.core.settings import PGSQL_SYSTEM_DBS
|
from lib.core.settings import PGSQL_SYSTEM_DBS
|
||||||
from lib.core.unescaper import unescaper
|
from lib.core.unescaper import unescaper
|
||||||
|
|
||||||
|
@ -39,4 +40,5 @@ class PostgreSQLMap(Syntax, Fingerprint, Enumeration, Filesystem, Miscellaneous,
|
||||||
Miscellaneous.__init__(self)
|
Miscellaneous.__init__(self)
|
||||||
Takeover.__init__(self)
|
Takeover.__init__(self)
|
||||||
|
|
||||||
|
unescaper[DBMS.PGSQL] = PostgreSQLMap.unescape
|
||||||
unescaper.setUnescape(PostgreSQLMap.unescape)
|
unescaper.setUnescape(PostgreSQLMap.unescape)
|
||||||
|
|
|
@ -7,6 +7,7 @@ Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||||
See the file 'doc/COPYING' for copying permission
|
See the file 'doc/COPYING' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from lib.core.enums import DBMS
|
||||||
from lib.core.settings import SQLITE_SYSTEM_DBS
|
from lib.core.settings import SQLITE_SYSTEM_DBS
|
||||||
from lib.core.unescaper import unescaper
|
from lib.core.unescaper import unescaper
|
||||||
|
|
||||||
|
@ -32,4 +33,5 @@ class SQLiteMap(Syntax, Fingerprint, Enumeration, Filesystem, Miscellaneous, Tak
|
||||||
Miscellaneous.__init__(self)
|
Miscellaneous.__init__(self)
|
||||||
Takeover.__init__(self)
|
Takeover.__init__(self)
|
||||||
|
|
||||||
|
unescaper[DBMS.SQLITE] = SQLiteMap.unescape
|
||||||
unescaper.setUnescape(SQLiteMap.unescape)
|
unescaper.setUnescape(SQLiteMap.unescape)
|
||||||
|
|
|
@ -7,6 +7,7 @@ Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||||
See the file 'doc/COPYING' for copying permission
|
See the file 'doc/COPYING' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from lib.core.enums import DBMS
|
||||||
from lib.core.settings import SYBASE_SYSTEM_DBS
|
from lib.core.settings import SYBASE_SYSTEM_DBS
|
||||||
from lib.core.unescaper import unescaper
|
from lib.core.unescaper import unescaper
|
||||||
|
|
||||||
|
@ -32,4 +33,5 @@ class SybaseMap(Syntax, Fingerprint, Enumeration, Filesystem, Miscellaneous, Tak
|
||||||
Miscellaneous.__init__(self)
|
Miscellaneous.__init__(self)
|
||||||
Takeover.__init__(self)
|
Takeover.__init__(self)
|
||||||
|
|
||||||
|
unescaper[DBMS.SYBASE] = SybaseMap.unescape
|
||||||
unescaper.setUnescape(SybaseMap.unescape)
|
unescaper.setUnescape(SybaseMap.unescape)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user