Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 70f6eab

Browse files
committed
minor update
1 parent 685a8e7 commit 70f6eab

9 files changed

Lines changed: 27 additions & 26 deletions

File tree

lib/core/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ def limitQuery(self, num, query, field=None):
528528
fromFrom = limitedQuery[fromIndex+1:]
529529
orderBy = False
530530

531-
if kb.dbms in ( "MySQL", "PostgreSQL", "SQLite" ):
531+
if kb.dbms in ( DBMS.MYSQL, DBMS.POSTGRESQL, DBMS.SQLITE ):
532532
limitStr = queries[kb.dbms].limit.query % (num, 1)
533533
limitedQuery += " %s" % limitStr
534534

lib/core/common.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -711,18 +711,18 @@ def parseTargetDirect():
711711
errMsg += "or 'access://DATABASE_FILEPATH'"
712712
raise sqlmapSyntaxException, errMsg
713713

714-
dbmsDict = { "Microsoft SQL Server": [MSSQL_ALIASES, "python-pymssql", "http://pymssql.sourceforge.net/"],
715-
"MySQL": [MYSQL_ALIASES, "python-mysqldb", "http://mysql-python.sourceforge.net/"],
716-
"PostgreSQL": [PGSQL_ALIASES, "python-psycopg2", "http://initd.org/psycopg/"],
717-
"Oracle": [ORACLE_ALIASES, "python cx_Oracle", "http://cx-oracle.sourceforge.net/"],
718-
"SQLite": [SQLITE_ALIASES, "python-pysqlite2", "http://pysqlite.googlecode.com/"],
719-
"Access": [ACCESS_ALIASES, "python-pyodbc", "http://pyodbc.googlecode.com/"],
720-
"Firebird": [FIREBIRD_ALIASES, "python-kinterbasdb", "http://kinterbasdb.sourceforge.net/"] }
714+
dbmsDict = { DBMS.MSSQL: [MSSQL_ALIASES, "python-pymssql", "http://pymssql.sourceforge.net/"],
715+
DBMS.MYSQL: [MYSQL_ALIASES, "python-mysqldb", "http://mysql-python.sourceforge.net/"],
716+
DBMS.POSTGRESQL: [PGSQL_ALIASES, "python-psycopg2", "http://initd.org/psycopg/"],
717+
DBMS.ORACLE: [ORACLE_ALIASES, "python cx_Oracle", "http://cx-oracle.sourceforge.net/"],
718+
DBMS.SQLITE: [SQLITE_ALIASES, "python-pysqlite2", "http://pysqlite.googlecode.com/"],
719+
DBMS.ACCESS: [ACCESS_ALIASES, "python-pyodbc", "http://pyodbc.googlecode.com/"],
720+
DBMS.FIREBIRD: [FIREBIRD_ALIASES, "python-kinterbasdb", "http://kinterbasdb.sourceforge.net/"] }
721721

722722
for dbmsName, data in dbmsDict.items():
723723
if conf.dbms in data[0]:
724724
try:
725-
if dbmsName in ('Access', 'SQLite', 'Firebird'):
725+
if dbmsName in (DBMS.ACCESS, DBMS.SQLITE, DBMS.FIREBIRD):
726726
if remote:
727727
warnMsg = "direct connection over the network for "
728728
warnMsg += "%s DBMS is not supported" % dbmsName
@@ -734,7 +734,7 @@ def parseTargetDirect():
734734
errMsg = "missing remote connection details"
735735
raise sqlmapSyntaxException, errMsg
736736

737-
if dbmsName == "Microsoft SQL Server":
737+
if dbmsName == DBMS.MSSQL:
738738
import _mssql
739739
import pymssql
740740

@@ -744,17 +744,17 @@ def parseTargetDirect():
744744
errMsg += "http://sourceforge.net/projects/pymssql/files/pymssql/1.0.2/"
745745
raise sqlmapMissingDependence, errMsg
746746

747-
elif dbmsName == "MySQL":
747+
elif dbmsName == DBMS.MYSQL:
748748
import MySQLdb
749-
elif dbmsName == "PostgreSQL":
749+
elif dbmsName == DBMS.POSTGRESQL:
750750
import psycopg2
751-
elif dbmsName == "Oracle":
751+
elif dbmsName == DBMS.ORACLE:
752752
import cx_Oracle
753-
elif dbmsName == "SQLite":
753+
elif dbmsName == DBMS.SQLITE:
754754
import sqlite3
755-
elif dbmsName == "Access":
755+
elif dbmsName == DBMS.ACCESS:
756756
import pyodbc
757-
elif dbmsName == "Firebird":
757+
elif dbmsName == DBMS.FIREBIRD:
758758
import kinterbasdb
759759
except ImportError, _:
760760
errMsg = "sqlmap requires '%s' third-party library " % data[1]
@@ -904,7 +904,7 @@ def parseUnionPage(output, expression, partial=False, condition=None, sort=True)
904904
def getDelayQuery(andCond=False):
905905
query = None
906906

907-
if kb.dbms in ("MySQL", "PostgreSQL"):
907+
if kb.dbms in (DBMS.MYSQL, DBMS.POSTGRESQL):
908908
if not kb.data.banner:
909909
conf.dbmsHandler.getVersionFromBanner()
910910

lib/utils/resume.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from lib.core.data import queries
2323
from lib.core.unescaper import unescaper
2424
from lib.techniques.blind.inference import bisection
25+
from lib.core.settings import DBMS
2526
from lib.core.settings import DUMP_START_MARKER
2627
from lib.core.settings import DUMP_STOP_MARKER
2728
from lib.core.settings import DUMP_DEL_MARKER
@@ -58,7 +59,7 @@ def queryOutputLength(expression, payload):
5859
if selectDistinctExpr:
5960
lengthExpr = "SELECT %s FROM (%s)" % (lengthQuery % regExpr, expression)
6061

61-
if kb.dbms in ( "MySQL", "PostgreSQL" ):
62+
if kb.dbms in ( DBMS.MYSQL, DBMS.POSTGRESQL ):
6263
lengthExpr += " AS %s" % randomStr(lowercase=True)
6364
elif select:
6465
lengthExpr = expression.replace(regExpr, lengthQuery % regExpr, 1)

plugins/dbms/firebird/fingerprint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ def getFingerprint(self):
4444
value += "%s\n" % dbmsOsFp
4545

4646
value += "back-end DBMS: "
47-
47+
4848
if not conf.extensiveFp:
49-
value += "Firebird"
49+
value += DBMS.FIREBIRD
5050
return value
51-
51+
5252
actVer = formatDBMSfp() + " (%s)" % (self.__dialectCheck())
5353
blank = " " * 15
5454
value += "active fingerprint: %s" % actVer

plugins/dbms/maxdb/fingerprint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def getFingerprint(self):
8787
value += "back-end DBMS: "
8888

8989
if not conf.extensiveFp:
90-
value += "SAP MaxDB"
90+
value += DBMS.MAXDB
9191
return value
9292

9393
actVer = formatDBMSfp() + " (%s)" % self.__versionCheck()

plugins/dbms/oracle/fingerprint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def getFingerprint(self):
4444
value += "back-end DBMS: "
4545

4646
if not conf.extensiveFp:
47-
value += "Oracle"
47+
value += DBMS.ORACLE
4848
return value
4949

5050
actVer = formatDBMSfp()

plugins/dbms/postgresql/fingerprint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def getFingerprint(self):
4747
value += "back-end DBMS: "
4848

4949
if not conf.extensiveFp:
50-
value += "PostgreSQL"
50+
value += DBMS.POSTGRESQL
5151
return value
5252

5353
actVer = formatDBMSfp()

plugins/dbms/sqlite/fingerprint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def getFingerprint(self):
4242
value += "back-end DBMS: "
4343

4444
if not conf.extensiveFp:
45-
value += "SQLite"
45+
value += DBMS.SQLITE
4646
return value
4747

4848
actVer = formatDBMSfp()

plugins/dbms/sybase/fingerprint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def getFingerprint(self):
4343
value += "back-end DBMS: "
4444

4545
if not conf.extensiveFp:
46-
value += "Sybase"
46+
value += DBMS.SYBASE
4747
return value
4848

4949
actVer = formatDBMSfp()

0 commit comments

Comments
 (0)