mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 09:36:35 +03:00
Some more dict refactorings
This commit is contained in:
parent
01f481c332
commit
1bcf5a6b88
|
@ -19,7 +19,7 @@ from lib.core.settings import MAXDB_ALIASES
|
|||
from lib.core.settings import SYBASE_ALIASES
|
||||
from lib.core.settings import DB2_ALIASES
|
||||
|
||||
firebirdTypes = {
|
||||
FIREBIRD_TYPES = {
|
||||
"261":"BLOB",
|
||||
"14":"CHAR",
|
||||
"40":"CSTRING",
|
||||
|
@ -36,7 +36,7 @@ firebirdTypes = {
|
|||
"37":"VARCHAR"
|
||||
}
|
||||
|
||||
sybaseTypes = {
|
||||
SYBASE_TYPES = {
|
||||
"14":"floatn",
|
||||
"8":"float",
|
||||
"15":"datetimn",
|
||||
|
@ -67,7 +67,7 @@ sybaseTypes = {
|
|||
"20":"image",
|
||||
}
|
||||
|
||||
mysqlPrivs = {
|
||||
MYSQL_PRIVS = {
|
||||
1:"select_priv",
|
||||
2:"insert_priv",
|
||||
3:"update_priv",
|
||||
|
@ -96,13 +96,13 @@ mysqlPrivs = {
|
|||
26:"create_user_priv",
|
||||
}
|
||||
|
||||
pgsqlPrivs = {
|
||||
PGSQL_PRIVS = {
|
||||
1:"createdb",
|
||||
2:"super",
|
||||
3:"catupd",
|
||||
}
|
||||
|
||||
firebirdPrivs = {
|
||||
FIREBIRD_PRIVS = {
|
||||
"S": "SELECT",
|
||||
"I": "INSERT",
|
||||
"U": "UPDATE",
|
||||
|
@ -111,7 +111,7 @@ firebirdPrivs = {
|
|||
"E": "EXECUTE"
|
||||
}
|
||||
|
||||
db2Privs = {
|
||||
DB2_PRIVS = {
|
||||
1: "CONTROLAUTH",
|
||||
2: "ALTERAUTH",
|
||||
3: "DELETEAUTH",
|
||||
|
@ -122,7 +122,7 @@ db2Privs = {
|
|||
8: "UPDATEAUTH"
|
||||
}
|
||||
|
||||
dumpReplacements = {" ": NULL, "": BLANK}
|
||||
DUMP_REPLACEMENTS = {" ": NULL, "": BLANK}
|
||||
|
||||
DBMS_DICT = {
|
||||
DBMS.MSSQL: (MSSQL_ALIASES, "python-pymssql", "http://pymssql.sourceforge.net/"),
|
||||
|
|
|
@ -24,7 +24,7 @@ from lib.core.common import unsafeSQLIdentificatorNaming
|
|||
from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
from lib.core.dicts import dumpReplacements
|
||||
from lib.core.dicts import DUMP_REPLACEMENTS
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.exception import sqlmapGenericException
|
||||
from lib.core.exception import sqlmapValueException
|
||||
|
@ -444,7 +444,7 @@ class Dump:
|
|||
value = u''
|
||||
else:
|
||||
value = getUnicode(info["values"][i])
|
||||
value = dumpReplacements.get(value, value)
|
||||
value = DUMP_REPLACEMENTS.get(value, value)
|
||||
|
||||
values.append(value)
|
||||
maxlength = int(info["length"])
|
||||
|
|
|
@ -15,7 +15,7 @@ from lib.core.data import conf
|
|||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
from lib.core.data import queries
|
||||
from lib.core.dicts import sybaseTypes
|
||||
from lib.core.dicts import SYBASE_TYPES
|
||||
from lib.core.enums import PAYLOAD
|
||||
from lib.core.exception import sqlmapMissingMandatoryOptionException
|
||||
from lib.core.exception import sqlmapNoneDataException
|
||||
|
|
|
@ -27,7 +27,7 @@ from lib.core.data import kb
|
|||
from lib.core.data import logger
|
||||
from lib.core.data import paths
|
||||
from lib.core.data import queries
|
||||
from lib.core.dicts import firebirdTypes
|
||||
from lib.core.dicts import FIREBIRD_TYPES
|
||||
from lib.core.enums import CHARSET_TYPE
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.enums import EXPECTED
|
||||
|
|
|
@ -27,7 +27,7 @@ from lib.core.data import conf
|
|||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
from lib.core.data import queries
|
||||
from lib.core.dicts import dumpReplacements
|
||||
from lib.core.dicts import DUMP_REPLACEMENTS
|
||||
from lib.core.enums import CHARSET_TYPE
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.enums import EXPECTED
|
||||
|
@ -306,7 +306,7 @@ class Entries:
|
|||
else:
|
||||
colEntry = unArrayizeValue(entry[index]) if index < len(entry) else u''
|
||||
|
||||
_ = len(dumpReplacements.get(getUnicode(colEntry), getUnicode(colEntry)))
|
||||
_ = len(DUMP_REPLACEMENTS.get(getUnicode(colEntry), getUnicode(colEntry)))
|
||||
maxLen = max(len(column), _)
|
||||
|
||||
if maxLen > kb.data.dumpedTable[column]["length"]:
|
||||
|
@ -408,7 +408,7 @@ class Entries:
|
|||
|
||||
value = NULL if column in emptyColumns else inject.getValue(query, inband=False, error=False, dump=True)
|
||||
|
||||
_ = dumpReplacements.get(getUnicode(value), getUnicode(value))
|
||||
_ = DUMP_REPLACEMENTS.get(getUnicode(value), getUnicode(value))
|
||||
lengths[column] = max(lengths[column], len(_))
|
||||
entries[column].append(value)
|
||||
|
||||
|
|
|
@ -26,10 +26,10 @@ from lib.core.data import conf
|
|||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
from lib.core.data import queries
|
||||
from lib.core.dicts import mysqlPrivs
|
||||
from lib.core.dicts import pgsqlPrivs
|
||||
from lib.core.dicts import firebirdPrivs
|
||||
from lib.core.dicts import db2Privs
|
||||
from lib.core.dicts import MYSQL_PRIVS
|
||||
from lib.core.dicts import PGSQL_PRIVS
|
||||
from lib.core.dicts import FIREBIRD_PRIVS
|
||||
from lib.core.dicts import DB2_PRIVS
|
||||
from lib.core.enums import CHARSET_TYPE
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.enums import EXPECTED
|
||||
|
@ -408,7 +408,7 @@ class Users:
|
|||
# True, 0 otherwise
|
||||
if Backend.isDbms(DBMS.PGSQL) and getUnicode(privilege).isdigit():
|
||||
if int(privilege) == 1:
|
||||
privileges.add(pgsqlPrivs[count])
|
||||
privileges.add(PGSQL_PRIVS[count])
|
||||
|
||||
# In MySQL >= 5.0 and Oracle we get the list
|
||||
# of privileges as string
|
||||
|
@ -419,7 +419,7 @@ class Users:
|
|||
# True, N otherwise
|
||||
elif Backend.isDbms(DBMS.MYSQL) and not kb.data.has_information_schema:
|
||||
if privilege.upper() == "Y":
|
||||
privileges.add(mysqlPrivs[count])
|
||||
privileges.add(MYSQL_PRIVS[count])
|
||||
|
||||
# In DB2 we get Y or G if the privilege is
|
||||
# True, N otherwise
|
||||
|
@ -432,7 +432,7 @@ class Users:
|
|||
|
||||
for priv in privs:
|
||||
if priv.upper() in ("Y", "G"):
|
||||
for position, db2Priv in db2Privs.items():
|
||||
for position, db2Priv in DB2_PRIVS.items():
|
||||
if position == i:
|
||||
privilege += ", " + db2Priv
|
||||
|
||||
|
@ -529,7 +529,7 @@ class Users:
|
|||
|
||||
for priv in privs:
|
||||
if priv.isdigit() and int(priv) == 1:
|
||||
for position, pgsqlPriv in pgsqlPrivs.items():
|
||||
for position, pgsqlPriv in PGSQL_PRIVS.items():
|
||||
if position == i:
|
||||
privileges.add(pgsqlPriv)
|
||||
|
||||
|
@ -549,7 +549,7 @@ class Users:
|
|||
|
||||
for priv in privs:
|
||||
if priv.upper() == "Y":
|
||||
for position, mysqlPriv in mysqlPrivs.items():
|
||||
for position, mysqlPriv in MYSQL_PRIVS.items():
|
||||
if position == i:
|
||||
privileges.add(mysqlPriv)
|
||||
|
||||
|
@ -557,7 +557,7 @@ class Users:
|
|||
|
||||
# In Firebird we get one letter for each privilege
|
||||
elif Backend.isDbms(DBMS.FIREBIRD):
|
||||
privileges.add(firebirdPrivs[privilege.strip()])
|
||||
privileges.add(FIREBIRD_PRIVS[privilege.strip()])
|
||||
|
||||
# In DB2 we get Y or G if the privilege is
|
||||
# True, N otherwise
|
||||
|
@ -570,7 +570,7 @@ class Users:
|
|||
|
||||
for priv in privs:
|
||||
if priv.upper() in ("Y", "G"):
|
||||
for position, db2Priv in db2Privs.items():
|
||||
for position, db2Priv in DB2_PRIVS.items():
|
||||
if position == i:
|
||||
privilege += ", " + db2Priv
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user