mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-08 05:31:32 +00:00
Couple of DREI updates
This commit is contained in:
@@ -28,6 +28,8 @@ from lib.core.common import pollProcess
|
||||
from lib.core.common import randomRange
|
||||
from lib.core.common import randomStr
|
||||
from lib.core.common import readInput
|
||||
from lib.core.convert import getBytes
|
||||
from lib.core.convert import getText
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
@@ -555,14 +557,14 @@ class Metasploit:
|
||||
pass
|
||||
|
||||
out = recv_some(proc, t=.1, e=0)
|
||||
blockingWriteToFD(sys.stdout.fileno(), out)
|
||||
blockingWriteToFD(sys.stdout.fileno(), getBytes(out))
|
||||
|
||||
# For --os-pwn and --os-bof
|
||||
pwnBofCond = self.connectionStr.startswith("reverse")
|
||||
pwnBofCond &= any(_ in out for _ in ("Starting the payload handler", "Started reverse"))
|
||||
pwnBofCond &= any(_ in out for _ in (b"Starting the payload handler", b"Started reverse"))
|
||||
|
||||
# For --os-smbrelay
|
||||
smbRelayCond = "Server started" in out
|
||||
smbRelayCond = b"Server started" in out
|
||||
|
||||
if pwnBofCond or smbRelayCond:
|
||||
func()
|
||||
@@ -570,7 +572,7 @@ class Metasploit:
|
||||
timeout = time.time() - start_time > METASPLOIT_SESSION_TIMEOUT
|
||||
|
||||
if not initialized:
|
||||
match = re.search(r"Meterpreter session ([\d]+) opened", out)
|
||||
match = re.search(b"Meterpreter session ([\d]+) opened", out)
|
||||
|
||||
if match:
|
||||
self._loadMetExtensions(proc, match.group(1))
|
||||
@@ -616,7 +618,7 @@ class Metasploit:
|
||||
pollProcess(process)
|
||||
payloadStderr = process.communicate()[1]
|
||||
|
||||
match = re.search(r"(Total size:|Length:|succeeded with size|Final size of exe file:) ([\d]+)", payloadStderr)
|
||||
match = re.search(b"(Total size:|Length:|succeeded with size|Final size of exe file:) ([\d]+)", payloadStderr)
|
||||
|
||||
if match:
|
||||
payloadSize = int(match.group(2))
|
||||
@@ -627,7 +629,7 @@ class Metasploit:
|
||||
debugMsg = "the shellcode size is %d bytes" % payloadSize
|
||||
logger.debug(debugMsg)
|
||||
else:
|
||||
errMsg = "failed to create the shellcode (%s)" % payloadStderr.replace("\n", " ").replace("\r", "")
|
||||
errMsg = "failed to create the shellcode ('%s')" % getText(payloadStderr).replace("\n", " ").replace("\r", "")
|
||||
raise SqlmapFilePathException(errMsg)
|
||||
|
||||
self._shellcodeFP = open(self._shellcodeFilePath, "rb")
|
||||
|
||||
Reference in New Issue
Block a user