mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-07 13:11:29 +00:00
Fixes #1379
This commit is contained in:
@@ -8,10 +8,13 @@ See the file 'doc/COPYING' for copying permission
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
from subprocess import PIPE
|
||||
|
||||
from extra.cloak.cloak import cloak
|
||||
from extra.cloak.cloak import decloak
|
||||
from lib.core.common import dataToStdout
|
||||
from lib.core.common import Backend
|
||||
from lib.core.common import getLocalIP
|
||||
@@ -34,6 +37,7 @@ from lib.core.exception import SqlmapFilePathException
|
||||
from lib.core.exception import SqlmapGenericException
|
||||
from lib.core.settings import IS_WIN
|
||||
from lib.core.settings import METASPLOIT_SESSION_TIMEOUT
|
||||
from lib.core.settings import SHELLCODEEXEC_RANDOM_STRING_MARKER
|
||||
from lib.core.settings import UNICODE_ENCODING
|
||||
from lib.core.subprocessng import blockingReadFromFD
|
||||
from lib.core.subprocessng import blockingWriteToFD
|
||||
@@ -640,6 +644,14 @@ class Metasploit:
|
||||
|
||||
if Backend.isOs(OS.WINDOWS):
|
||||
self.shellcodeexecLocal = os.path.join(self.shellcodeexecLocal, "windows", "shellcodeexec.x%s.exe_" % "32")
|
||||
content = decloak(self.shellcodeexecLocal)
|
||||
if SHELLCODEEXEC_RANDOM_STRING_MARKER in content:
|
||||
content = content.replace(SHELLCODEEXEC_RANDOM_STRING_MARKER, randomStr(len(SHELLCODEEXEC_RANDOM_STRING_MARKER)))
|
||||
_ = cloak(data=content)
|
||||
handle, self.shellcodeexecLocal = tempfile.mkstemp(suffix="%s.exe_" % "32")
|
||||
os.close(handle)
|
||||
with open(self.shellcodeexecLocal, "w+b") as f:
|
||||
f.write(_)
|
||||
else:
|
||||
self.shellcodeexecLocal = os.path.join(self.shellcodeexecLocal, "linux", "shellcodeexec.x%s_" % Backend.getArch())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user