mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-01-24 08:14:24 +03:00
Another update for an Issue #28
This commit is contained in:
parent
6ffc5665d0
commit
1669c6bdb4
|
@ -591,26 +591,18 @@ def __setMetasploit():
|
||||||
if not conf.msfPath:
|
if not conf.msfPath:
|
||||||
def _(key, value):
|
def _(key, value):
|
||||||
retVal = None
|
retVal = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from _winreg import ConnectRegistry, OpenKey, QueryValueEx, HKEY_LOCAL_MACHINE
|
from _winreg import ConnectRegistry, OpenKey, QueryValueEx, HKEY_LOCAL_MACHINE
|
||||||
_ = ConnectRegistry(None, HKEY_LOCAL_MACHINE)
|
_ = ConnectRegistry(None, HKEY_LOCAL_MACHINE)
|
||||||
_ = OpenKey(_, key)
|
_ = OpenKey(_, key)
|
||||||
retval = QueryValueEx(_, value)[0]
|
retVal = QueryValueEx(_, value)[0]
|
||||||
except:
|
except Exception, ex:
|
||||||
pass
|
print ex
|
||||||
|
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
conf.msfPath = _(r"SOFTWARE\Rapid7\Metasploit", "Location")
|
conf.msfPath = _(r"SOFTWARE\Rapid7\Metasploit", "Location")
|
||||||
|
if conf.msfPath:
|
||||||
warnMsg = "some sqlmap takeover functionalities are not yet "
|
conf.msfPath = os.path.join(conf.msfPath, "msf3")
|
||||||
warnMsg += "supported on Windows. Please use Linux in a virtual "
|
|
||||||
warnMsg += "machine for out-of-band features."
|
|
||||||
|
|
||||||
logger.critical(warnMsg)
|
|
||||||
|
|
||||||
raise sqlmapSilentQuitException
|
|
||||||
|
|
||||||
if conf.osSmb:
|
if conf.osSmb:
|
||||||
isAdmin = runningAsAdmin()
|
isAdmin = runningAsAdmin()
|
||||||
|
|
|
@ -61,9 +61,9 @@ class Metasploit:
|
||||||
|
|
||||||
if IS_WIN:
|
if IS_WIN:
|
||||||
_ = normalizePath(os.path.join(conf.msfPath, "..", "scripts", "setenv.bat"))
|
_ = normalizePath(os.path.join(conf.msfPath, "..", "scripts", "setenv.bat"))
|
||||||
for attr in dir(self):
|
self.__msfCli = "%s & ruby %s" % (_, self.__msfCli)
|
||||||
if "__msf" in attr:
|
self.__msfEncode = "ruby %s" % self.__msfEncode
|
||||||
setattr(self, attr, "%s & %s" % (_, getattr(self, attr)))
|
self.__msfPayload = "%s & ruby %s" % (_, self.__msfPayload)
|
||||||
|
|
||||||
self.__msfPayloadsList = {
|
self.__msfPayloadsList = {
|
||||||
"windows": {
|
"windows": {
|
||||||
|
@ -360,12 +360,12 @@ class Metasploit:
|
||||||
self.__payloadCmd += " PrependChrootBreak=true PrependSetuid=true"
|
self.__payloadCmd += " PrependChrootBreak=true PrependSetuid=true"
|
||||||
|
|
||||||
if extra == "BufferRegister=EAX":
|
if extra == "BufferRegister=EAX":
|
||||||
self.__payloadCmd += " R | %s -a x86 -e %s -o %s -t %s" % (self.__msfEncode, self.encoderStr, outFile, format)
|
self.__payloadCmd += " R | %s -a x86 -e %s -o \"%s\" -t %s" % (self.__msfEncode, self.encoderStr, outFile, format)
|
||||||
|
|
||||||
if extra is not None:
|
if extra is not None:
|
||||||
self.__payloadCmd += " %s" % extra
|
self.__payloadCmd += " %s" % extra
|
||||||
else:
|
else:
|
||||||
self.__payloadCmd += " X > %s" % outFile
|
self.__payloadCmd += " X > \"%s\"" % outFile
|
||||||
|
|
||||||
def __runMsfCliSmbrelay(self):
|
def __runMsfCliSmbrelay(self):
|
||||||
self.__forgeMsfCliCmdForSmbrelay()
|
self.__forgeMsfCliCmdForSmbrelay()
|
||||||
|
@ -528,7 +528,7 @@ class Metasploit:
|
||||||
debugMsg = "the shellcode size is %d bytes" % payloadSize
|
debugMsg = "the shellcode size is %d bytes" % payloadSize
|
||||||
logger.debug(debugMsg)
|
logger.debug(debugMsg)
|
||||||
else:
|
else:
|
||||||
errMsg = "failed to create the shellcode (%s)" % payloadStderr.replace("\n", "")
|
errMsg = "failed to create the shellcode (%s)" % payloadStderr.replace("\n", " ").replace("\r", "")
|
||||||
raise sqlmapFilePathException, errMsg
|
raise sqlmapFilePathException, errMsg
|
||||||
|
|
||||||
self.__shellcodeFP = codecs.open(self.__shellcodeFilePath, "rb")
|
self.__shellcodeFP = codecs.open(self.__shellcodeFilePath, "rb")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user