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

Skip to content

Commit 5764816

Browse files
committed
minor cosmetics
1 parent 5d37df6 commit 5764816

16 files changed

Lines changed: 45 additions & 45 deletions

File tree

lib/core/agent.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ def simpleConcatQuery(self, query1, query2):
371371
if kb.dbms == DBMS.MYSQL:
372372
concatenatedQuery = "CONCAT(%s,%s)" % (query1, query2)
373373

374-
elif kb.dbms in ( DBMS.POSTGRESQL, DBMS.ORACLE, DBMS.SQLITE ):
374+
elif kb.dbms in ( DBMS.PGSQL, DBMS.ORACLE, DBMS.SQLITE ):
375375
concatenatedQuery = "%s||%s" % (query1, query2)
376376

377377
elif kb.dbms == DBMS.MSSQL:
@@ -429,7 +429,7 @@ def concatQuery(self, query, unpack=True):
429429
elif fieldsNoSelect:
430430
concatenatedQuery = "CONCAT('%s',%s,'%s')" % (kb.misc.start, concatenatedQuery, kb.misc.stop)
431431

432-
elif kb.dbms in ( DBMS.POSTGRESQL, DBMS.ORACLE, DBMS.SQLITE ):
432+
elif kb.dbms in ( DBMS.PGSQL, DBMS.ORACLE, DBMS.SQLITE ):
433433
if fieldsSelectCase:
434434
concatenatedQuery = concatenatedQuery.replace("SELECT ", "'%s'||" % kb.misc.start, 1)
435435
concatenatedQuery += "||'%s'" % kb.misc.stop
@@ -580,7 +580,7 @@ def limitQuery(self, num, query, field=None):
580580
fromFrom = limitedQuery[fromIndex+1:]
581581
orderBy = False
582582

583-
if kb.dbms in ( DBMS.MYSQL, DBMS.POSTGRESQL, DBMS.SQLITE ):
583+
if kb.dbms in ( DBMS.MYSQL, DBMS.PGSQL, DBMS.SQLITE ):
584584
limitStr = queries[kb.dbms].limit.query % (num, 1)
585585
limitedQuery += " %s" % limitStr
586586

lib/core/common.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ def parseTargetDirect():
735735

736736
dbmsDict = { DBMS.MSSQL: [MSSQL_ALIASES, "python-pymssql", "http://pymssql.sourceforge.net/"],
737737
DBMS.MYSQL: [MYSQL_ALIASES, "python-mysqldb", "http://mysql-python.sourceforge.net/"],
738-
DBMS.POSTGRESQL: [PGSQL_ALIASES, "python-psycopg2", "http://initd.org/psycopg/"],
738+
DBMS.PGSQL: [PGSQL_ALIASES, "python-psycopg2", "http://initd.org/psycopg/"],
739739
DBMS.ORACLE: [ORACLE_ALIASES, "python cx_Oracle", "http://cx-oracle.sourceforge.net/"],
740740
DBMS.SQLITE: [SQLITE_ALIASES, "python-pysqlite2", "http://pysqlite.googlecode.com/"],
741741
DBMS.ACCESS: [ACCESS_ALIASES, "python-pyodbc", "http://pyodbc.googlecode.com/"],
@@ -768,7 +768,7 @@ def parseTargetDirect():
768768

769769
elif dbmsName == DBMS.MYSQL:
770770
import MySQLdb
771-
elif dbmsName == DBMS.POSTGRESQL:
771+
elif dbmsName == DBMS.PGSQL:
772772
import psycopg2
773773
elif dbmsName == DBMS.ORACLE:
774774
import cx_Oracle
@@ -926,13 +926,13 @@ def parseUnionPage(output, expression, partial=False, condition=None, sort=True)
926926
def getDelayQuery(andCond=False):
927927
query = None
928928

929-
if kb.dbms in (DBMS.MYSQL, DBMS.POSTGRESQL):
929+
if kb.dbms in (DBMS.MYSQL, DBMS.PGSQL):
930930
if not kb.data.banner:
931931
conf.dbmsHandler.getVersionFromBanner()
932932

933933
banVer = kb.bannerFp["dbmsVersion"] if 'dbmsVersion' in kb.bannerFp else None
934934

935-
if banVer is None or (kb.dbms == DBMS.MYSQL and banVer >= "5.0.12") or (kb.dbms == DBMS.POSTGRESQL and banVer >= "8.2"):
935+
if banVer is None or (kb.dbms == DBMS.MYSQL and banVer >= "5.0.12") or (kb.dbms == DBMS.PGSQL and banVer >= "8.2"):
936936
query = queries[kb.dbms].timedelay.query % conf.timeSec
937937
else:
938938
query = queries[kb.dbms].timedelay.query2 % conf.timeSec

lib/core/enums.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class DBMS:
2323
MSSQL = "Microsoft SQL Server"
2424
MYSQL = "MySQL"
2525
ORACLE = "Oracle"
26-
POSTGRESQL = "PostgreSQL"
26+
PGSQL = "PostgreSQL"
2727
SQLITE = "SQLite"
2828
SYBASE = "Sybase"
2929

lib/parse/banner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def bannerParser(banner):
100100
xmlfile = paths.MYSQL_XML
101101
elif kb.dbms == DBMS.ORACLE:
102102
xmlfile = paths.ORACLE_XML
103-
elif kb.dbms == DBMS.POSTGRESQL:
103+
elif kb.dbms == DBMS.PGSQL:
104104
xmlfile = paths.PGSQL_XML
105105

106106
if not xmlfile:

lib/request/inject.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def __goInferenceProxy(expression, fromUser=False, expected=None, batch=False, r
149149
topLimit = re.search("TOP\s+([\d]+)\s+", expression, re.I)
150150

151151
if limitRegExp or ( kb.dbms == DBMS.MSSQL and topLimit ):
152-
if kb.dbms in ( DBMS.MYSQL, DBMS.POSTGRESQL ):
152+
if kb.dbms in ( DBMS.MYSQL, DBMS.PGSQL ):
153153
limitGroupStart = queries[kb.dbms].limitgroupstart.query
154154
limitGroupStop = queries[kb.dbms].limitgroupstop.query
155155

@@ -188,7 +188,7 @@ def __goInferenceProxy(expression, fromUser=False, expected=None, batch=False, r
188188

189189
# From now on we need only the expression until the " LIMIT "
190190
# (or similar, depending on the back-end DBMS) word
191-
if kb.dbms in ( DBMS.MYSQL, DBMS.POSTGRESQL ):
191+
if kb.dbms in ( DBMS.MYSQL, DBMS.PGSQL ):
192192
stopLimit += startLimit
193193
untilLimitChar = expression.index(queries[kb.dbms].limitstring.query)
194194
expression = expression[:untilLimitChar]

lib/takeover/abstraction.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def execCmd(self, cmd, silent=False):
3838
if self.webBackdoorUrl and not kb.stackedTest:
3939
self.webBackdoorRunCmd(cmd)
4040

41-
elif kb.dbms in ( DBMS.MYSQL, DBMS.POSTGRESQL ):
41+
elif kb.dbms in ( DBMS.MYSQL, DBMS.PGSQL ):
4242
self.udfExecCmd(cmd, silent=silent)
4343

4444
elif kb.dbms == DBMS.MSSQL:
@@ -52,7 +52,7 @@ def evalCmd(self, cmd, first=None, last=None):
5252
if self.webBackdoorUrl and not kb.stackedTest:
5353
return self.webBackdoorRunCmd(cmd)
5454

55-
elif kb.dbms in ( DBMS.MYSQL, DBMS.POSTGRESQL ):
55+
elif kb.dbms in ( DBMS.MYSQL, DBMS.PGSQL ):
5656
return self.udfEvalCmd(cmd, first, last)
5757

5858
elif kb.dbms == DBMS.MSSQL:
@@ -90,7 +90,7 @@ def shell(self):
9090
logger.info(infoMsg)
9191

9292
else:
93-
if kb.dbms in ( DBMS.MYSQL, DBMS.POSTGRESQL ):
93+
if kb.dbms in ( DBMS.MYSQL, DBMS.PGSQL ):
9494
infoMsg = "going to use injected sys_eval and sys_exec "
9595
infoMsg += "user-defined functions for operating system "
9696
infoMsg += "command execution"
@@ -148,7 +148,7 @@ def initEnv(self, mandatory=True, detailed=False, web=False):
148148
warnMsg += "the session user is not a database administrator"
149149
logger.warn(warnMsg)
150150

151-
if kb.dbms in ( DBMS.MYSQL, DBMS.POSTGRESQL ):
151+
if kb.dbms in ( DBMS.MYSQL, DBMS.PGSQL ):
152152
self.udfInjectSys()
153153
elif kb.dbms == DBMS.MSSQL:
154154
if mandatory:

lib/takeover/metasploit.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def __selectPayload(self):
192192
debugMsg += "injection will be successful"
193193
logger.debug(debugMsg)
194194

195-
elif kb.dbms == DBMS.POSTGRESQL:
195+
elif kb.dbms == DBMS.PGSQL:
196196
choose = True
197197

198198
warnMsg = "by default PostgreSQL on Windows runs as "
@@ -229,7 +229,7 @@ def __selectPayload(self):
229229
break
230230

231231
elif choice == "1":
232-
if kb.dbms == DBMS.POSTGRESQL:
232+
if kb.dbms == DBMS.PGSQL:
233233
logger.warn("beware that the VNC injection might not work")
234234

235235
break
@@ -554,7 +554,7 @@ def createMsfPayloadStager(self, initialize=True):
554554
# This is useful for sqlmap because on PostgreSQL it is not
555555
# possible to write files bigger than 8192 bytes abusing the
556556
# lo_export() feature implemented in sqlmap.
557-
if kb.dbms == DBMS.POSTGRESQL:
557+
if kb.dbms == DBMS.PGSQL:
558558
self.__fileFormat = "exe-small"
559559
else:
560560
self.__fileFormat = "exe"
@@ -656,7 +656,7 @@ def smb(self):
656656
self.__forgeMsfConsoleResource()
657657
self.__forgeMsfConsoleCmd()
658658

659-
if kb.dbms in ( DBMS.MYSQL, DBMS.POSTGRESQL ):
659+
if kb.dbms in ( DBMS.MYSQL, DBMS.PGSQL ):
660660
self.uncPath = "\\\\\\\\%s\\\\%s" % (self.lhostStr, self.__randFile)
661661
else:
662662
self.uncPath = "\\\\%s\\%s" % (self.lhostStr, self.__randFile)

lib/takeover/udf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def udfEvalCmd(self, cmd, first=None, last=None, udfName=None):
101101
return output
102102

103103
def udfCheckNeeded(self):
104-
if ( not conf.rFile or ( conf.rFile and kb.dbms != DBMS.POSTGRESQL ) ) and "sys_fileread" in self.sysUdfs:
104+
if ( not conf.rFile or ( conf.rFile and kb.dbms != DBMS.PGSQL ) ) and "sys_fileread" in self.sysUdfs:
105105
self.sysUdfs.pop("sys_fileread")
106106

107107
if not conf.osPwn:
@@ -142,7 +142,7 @@ def udfInjectCore(self, udfDict):
142142

143143
if kb.dbms == DBMS.MYSQL:
144144
supportTblType = "longtext"
145-
elif kb.dbms == DBMS.POSTGRESQL:
145+
elif kb.dbms == DBMS.PGSQL:
146146
supportTblType = "text"
147147

148148
self.udfCreateSupportTbl(supportTblType)
@@ -153,7 +153,7 @@ def udfInjectSys(self):
153153
self.udfInjectCore(self.sysUdfs)
154154

155155
def udfInjectCustom(self):
156-
if kb.dbms not in ( DBMS.MYSQL, DBMS.POSTGRESQL ):
156+
if kb.dbms not in ( DBMS.MYSQL, DBMS.PGSQL ):
157157
errMsg = "UDF injection feature is not yet implemented on %s" % kb.dbms
158158
raise sqlmapUnsupportedFeatureException(errMsg)
159159

@@ -235,7 +235,7 @@ def udfInjectCustom(self):
235235

236236
if kb.dbms == DBMS.MYSQL:
237237
defaultType = "string"
238-
elif kb.dbms == DBMS.POSTGRESQL:
238+
elif kb.dbms == DBMS.PGSQL:
239239
defaultType = "text"
240240

241241
self.udfs[udfName]["input"] = []

lib/techniques/inband/union/use.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def unionUse(expression, direct=False, unescape=True, resetCounter=False, nullCh
6969
limitRegExp = re.search(queries[kb.dbms].limitregexp.query, expression, re.I)
7070

7171
if limitRegExp:
72-
if kb.dbms in ( DBMS.MYSQL, DBMS.POSTGRESQL ):
72+
if kb.dbms in ( DBMS.MYSQL, DBMS.PGSQL ):
7373
limitGroupStart = queries[kb.dbms].limitgroupstart.query
7474
limitGroupStop = queries[kb.dbms].limitgroupstop.query
7575

@@ -103,7 +103,7 @@ def unionUse(expression, direct=False, unescape=True, resetCounter=False, nullCh
103103

104104
# From now on we need only the expression until the " LIMIT "
105105
# (or similar, depending on the back-end DBMS) word
106-
if kb.dbms in ( DBMS.MYSQL, DBMS.POSTGRESQL ):
106+
if kb.dbms in ( DBMS.MYSQL, DBMS.PGSQL ):
107107
stopLimit += startLimit
108108
untilLimitChar = expression.index(queries[kb.dbms].limitstring.query)
109109
expression = expression[:untilLimitChar]

lib/utils/resume.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def queryOutputLength(expression, payload):
5959
if selectDistinctExpr:
6060
lengthExpr = "SELECT %s FROM (%s)" % (lengthQuery % regExpr, expression)
6161

62-
if kb.dbms in ( DBMS.MYSQL, DBMS.POSTGRESQL ):
62+
if kb.dbms in ( DBMS.MYSQL, DBMS.PGSQL ):
6363
lengthExpr += " AS %s" % randomStr(lowercase=True)
6464
elif select:
6565
lengthExpr = expression.replace(regExpr, lengthQuery % regExpr, 1)

0 commit comments

Comments
 (0)