mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-20 14:39:02 +00:00
Minor style update (for the sake of consistency over the code and our PEP8 adaptation)
This commit is contained in:
@@ -41,7 +41,7 @@ class Abstraction(Web, UDF, Xp_cmdshell):
|
||||
if self.webBackdoorUrl and not isTechniqueAvailable(PAYLOAD.TECHNIQUE.STACKED):
|
||||
self.webBackdoorRunCmd(cmd)
|
||||
|
||||
elif Backend.getIdentifiedDbms() in ( DBMS.MYSQL, DBMS.PGSQL ):
|
||||
elif Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.PGSQL):
|
||||
self.udfExecCmd(cmd, silent=silent)
|
||||
|
||||
elif Backend.isDbms(DBMS.MSSQL):
|
||||
@@ -57,7 +57,7 @@ class Abstraction(Web, UDF, Xp_cmdshell):
|
||||
if self.webBackdoorUrl and not isTechniqueAvailable(PAYLOAD.TECHNIQUE.STACKED):
|
||||
retVal = self.webBackdoorRunCmd(cmd)
|
||||
|
||||
elif Backend.getIdentifiedDbms() in ( DBMS.MYSQL, DBMS.PGSQL ):
|
||||
elif Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.PGSQL):
|
||||
retVal = self.udfEvalCmd(cmd, first, last)
|
||||
|
||||
elif Backend.isDbms(DBMS.MSSQL):
|
||||
@@ -97,7 +97,7 @@ class Abstraction(Web, UDF, Xp_cmdshell):
|
||||
logger.info(infoMsg)
|
||||
|
||||
else:
|
||||
if Backend.getIdentifiedDbms() in ( DBMS.MYSQL, DBMS.PGSQL ):
|
||||
if Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.PGSQL):
|
||||
infoMsg = "going to use injected sys_eval and sys_exec "
|
||||
infoMsg += "user-defined functions for operating system "
|
||||
infoMsg += "command execution"
|
||||
@@ -136,7 +136,7 @@ class Abstraction(Web, UDF, Xp_cmdshell):
|
||||
if not command:
|
||||
continue
|
||||
|
||||
if command.lower() in ( "x", "q", "exit", "quit" ):
|
||||
if command.lower() in ("x", "q", "exit", "quit"):
|
||||
break
|
||||
|
||||
self.runCmd(command)
|
||||
@@ -186,7 +186,7 @@ class Abstraction(Web, UDF, Xp_cmdshell):
|
||||
warnMsg = "functionality requested probably does not work because "
|
||||
warnMsg += "the curent session user is not a database administrator"
|
||||
|
||||
if not conf.dbmsCred and Backend.getIdentifiedDbms() in ( DBMS.MSSQL, DBMS.PGSQL ):
|
||||
if not conf.dbmsCred and Backend.getIdentifiedDbms() in (DBMS.MSSQL, DBMS.PGSQL):
|
||||
warnMsg += ". You can try to use option '--dbms-cred' "
|
||||
warnMsg += "to execute statements as a DBA user if you "
|
||||
warnMsg += "were able to extract and crack a DBA "
|
||||
@@ -194,7 +194,7 @@ class Abstraction(Web, UDF, Xp_cmdshell):
|
||||
|
||||
logger.warn(warnMsg)
|
||||
|
||||
if Backend.getIdentifiedDbms() in ( DBMS.MYSQL, DBMS.PGSQL ):
|
||||
if Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.PGSQL):
|
||||
self.udfInjectSys()
|
||||
elif Backend.isDbms(DBMS.MSSQL):
|
||||
if mandatory:
|
||||
|
||||
@@ -66,52 +66,52 @@ class Metasploit:
|
||||
|
||||
self._msfPayloadsList = {
|
||||
"windows": {
|
||||
1: ( "Meterpreter (default)", "windows/meterpreter" ),
|
||||
2: ( "Shell", "windows/shell" ),
|
||||
3: ( "VNC", "windows/vncinject" ),
|
||||
1: ("Meterpreter (default)", "windows/meterpreter"),
|
||||
2: ("Shell", "windows/shell"),
|
||||
3: ("VNC", "windows/vncinject"),
|
||||
},
|
||||
"linux": {
|
||||
1: ( "Shell (default)", "linux/x86/shell" ),
|
||||
2: ( "Meterpreter (beta)", "linux/x86/meterpreter" ),
|
||||
1: ("Shell (default)", "linux/x86/shell"),
|
||||
2: ("Meterpreter (beta)", "linux/x86/meterpreter"),
|
||||
}
|
||||
}
|
||||
|
||||
self._msfConnectionsList = {
|
||||
"windows": {
|
||||
1: ( "Reverse TCP: Connect back from the database host to this machine (default)", "reverse_tcp" ),
|
||||
2: ( "Reverse TCP: Try to connect back from the database host to this machine, on all ports between the specified and 65535", "reverse_tcp_allports" ),
|
||||
3: ( "Reverse HTTP: Connect back from the database host to this machine tunnelling traffic over HTTP", "reverse_http" ),
|
||||
4: ( "Reverse HTTPS: Connect back from the database host to this machine tunnelling traffic over HTTPS", "reverse_https" ),
|
||||
5: ( "Bind TCP: Listen on the database host for a connection", "bind_tcp" )
|
||||
1: ("Reverse TCP: Connect back from the database host to this machine (default)", "reverse_tcp"),
|
||||
2: ("Reverse TCP: Try to connect back from the database host to this machine, on all ports between the specified and 65535", "reverse_tcp_allports"),
|
||||
3: ("Reverse HTTP: Connect back from the database host to this machine tunnelling traffic over HTTP", "reverse_http"),
|
||||
4: ("Reverse HTTPS: Connect back from the database host to this machine tunnelling traffic over HTTPS", "reverse_https"),
|
||||
5: ("Bind TCP: Listen on the database host for a connection", "bind_tcp")
|
||||
},
|
||||
"linux": {
|
||||
1: ( "Reverse TCP: Connect back from the database host to this machine (default)", "reverse_tcp" ),
|
||||
2: ( "Bind TCP: Listen on the database host for a connection", "bind_tcp" ),
|
||||
1: ("Reverse TCP: Connect back from the database host to this machine (default)", "reverse_tcp"),
|
||||
2: ("Bind TCP: Listen on the database host for a connection", "bind_tcp"),
|
||||
}
|
||||
}
|
||||
|
||||
self._msfEncodersList = {
|
||||
"windows": {
|
||||
1: ( "No Encoder", "generic/none" ),
|
||||
2: ( "Alpha2 Alphanumeric Mixedcase Encoder", "x86/alpha_mixed" ),
|
||||
3: ( "Alpha2 Alphanumeric Uppercase Encoder", "x86/alpha_upper" ),
|
||||
4: ( "Avoid UTF8/tolower", "x86/avoid_utf8_tolower" ),
|
||||
5: ( "Call+4 Dword XOR Encoder", "x86/call4_dword_xor" ),
|
||||
6: ( "Single-byte XOR Countdown Encoder", "x86/countdown" ),
|
||||
7: ( "Variable-length Fnstenv/mov Dword XOR Encoder", "x86/fnstenv_mov" ),
|
||||
8: ( "Polymorphic Jump/Call XOR Additive Feedback Encoder", "x86/jmp_call_additive" ),
|
||||
9: ( "Non-Alpha Encoder", "x86/nonalpha" ),
|
||||
10: ( "Non-Upper Encoder", "x86/nonupper" ),
|
||||
11: ( "Polymorphic XOR Additive Feedback Encoder (default)", "x86/shikata_ga_nai" ),
|
||||
12: ( "Alpha2 Alphanumeric Unicode Mixedcase Encoder", "x86/unicode_mixed" ),
|
||||
13: ( "Alpha2 Alphanumeric Unicode Uppercase Encoder", "x86/unicode_upper" ),
|
||||
1: ("No Encoder", "generic/none"),
|
||||
2: ("Alpha2 Alphanumeric Mixedcase Encoder", "x86/alpha_mixed"),
|
||||
3: ("Alpha2 Alphanumeric Uppercase Encoder", "x86/alpha_upper"),
|
||||
4: ("Avoid UTF8/tolower", "x86/avoid_utf8_tolower"),
|
||||
5: ("Call+4 Dword XOR Encoder", "x86/call4_dword_xor"),
|
||||
6: ("Single-byte XOR Countdown Encoder", "x86/countdown"),
|
||||
7: ("Variable-length Fnstenv/mov Dword XOR Encoder", "x86/fnstenv_mov"),
|
||||
8: ("Polymorphic Jump/Call XOR Additive Feedback Encoder", "x86/jmp_call_additive"),
|
||||
9: ("Non-Alpha Encoder", "x86/nonalpha"),
|
||||
10: ("Non-Upper Encoder", "x86/nonupper"),
|
||||
11: ("Polymorphic XOR Additive Feedback Encoder (default)", "x86/shikata_ga_nai"),
|
||||
12: ("Alpha2 Alphanumeric Unicode Mixedcase Encoder", "x86/unicode_mixed"),
|
||||
13: ("Alpha2 Alphanumeric Unicode Uppercase Encoder", "x86/unicode_upper"),
|
||||
}
|
||||
}
|
||||
|
||||
self._msfSMBPortsList = {
|
||||
"windows": {
|
||||
1: ( "139/TCP", "139" ),
|
||||
2: ( "445/TCP (default)", "445" ),
|
||||
1: ("139/TCP", "139"),
|
||||
2: ("445/TCP (default)", "445"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -584,7 +584,7 @@ class Metasploit:
|
||||
|
||||
self._runMsfCliSmbrelay()
|
||||
|
||||
if Backend.getIdentifiedDbms() in ( DBMS.MYSQL, DBMS.PGSQL ):
|
||||
if Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.PGSQL):
|
||||
self.uncPath = "\\\\\\\\%s\\\\%s" % (self.lhostStr, self._randFile)
|
||||
else:
|
||||
self.uncPath = "\\\\%s\\%s" % (self.lhostStr, self._randFile)
|
||||
|
||||
@@ -112,7 +112,7 @@ class UDF:
|
||||
return output
|
||||
|
||||
def udfCheckNeeded(self):
|
||||
if ( not conf.rFile or ( conf.rFile and not Backend.isDbms(DBMS.PGSQL) ) ) and "sys_fileread" in self.sysUdfs:
|
||||
if (not conf.rFile or (conf.rFile and not Backend.isDbms(DBMS.PGSQL))) and "sys_fileread" in self.sysUdfs:
|
||||
self.sysUdfs.pop("sys_fileread")
|
||||
|
||||
if not conf.osPwn:
|
||||
@@ -164,7 +164,7 @@ class UDF:
|
||||
self.udfInjectCore(self.sysUdfs)
|
||||
|
||||
def udfInjectCustom(self):
|
||||
if Backend.getIdentifiedDbms() not in ( DBMS.MYSQL, DBMS.PGSQL ):
|
||||
if Backend.getIdentifiedDbms() not in (DBMS.MYSQL, DBMS.PGSQL):
|
||||
errMsg = "UDF injection feature is not yet implemented on %s" % Backend.getIdentifiedDbms()
|
||||
raise SqlmapUnsupportedFeatureException(errMsg)
|
||||
|
||||
@@ -300,10 +300,10 @@ class UDF:
|
||||
msg += "functions now? [Y/n/q] "
|
||||
choice = readInput(msg, default="Y")
|
||||
|
||||
if choice[0] in ( "n", "N" ):
|
||||
if choice[0] in ("n", "N"):
|
||||
self.cleanup(udfDict=self.udfs)
|
||||
return
|
||||
elif choice[0] in ( "q", "Q" ):
|
||||
elif choice[0] in ("q", "Q"):
|
||||
self.cleanup(udfDict=self.udfs)
|
||||
raise SqlmapUserQuitException
|
||||
|
||||
@@ -320,7 +320,7 @@ class UDF:
|
||||
while True:
|
||||
choice = readInput(msg)
|
||||
|
||||
if choice and choice[0] in ( "q", "Q" ):
|
||||
if choice and choice[0] in ("q", "Q"):
|
||||
break
|
||||
elif isinstance(choice, basestring) and choice.isdigit() and int(choice) > 0 and int(choice) <= len(udfList):
|
||||
choice = int(choice)
|
||||
|
||||
Reference in New Issue
Block a user