mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-04-25 03:13:46 +03:00
Fixes #3823
This commit is contained in:
parent
34ed2c51ac
commit
3c4aadf995
|
@ -526,22 +526,10 @@ def _setMetasploit():
|
||||||
raise SqlmapMissingDependence(errMsg)
|
raise SqlmapMissingDependence(errMsg)
|
||||||
|
|
||||||
if not conf.msfPath:
|
if not conf.msfPath:
|
||||||
def _(key, value):
|
for candidate in os.environ.get("PATH", "").split(';'):
|
||||||
retVal = None
|
if all(_ in candidate for _ in ("metasploit", "bin")):
|
||||||
|
conf.msfPath = os.path.dirname(candidate.rstrip('\\'))
|
||||||
try:
|
break
|
||||||
from six.moves.winreg import ConnectRegistry, OpenKey, QueryValueEx, HKEY_LOCAL_MACHINE
|
|
||||||
_ = ConnectRegistry(None, HKEY_LOCAL_MACHINE)
|
|
||||||
_ = OpenKey(_, key)
|
|
||||||
retVal = QueryValueEx(_, value)[0]
|
|
||||||
except:
|
|
||||||
logger.debug("unable to identify Metasploit installation path via registry key")
|
|
||||||
|
|
||||||
return retVal
|
|
||||||
|
|
||||||
conf.msfPath = _(r"SOFTWARE\Rapid7\Metasploit", "Location")
|
|
||||||
if conf.msfPath:
|
|
||||||
conf.msfPath = os.path.join(conf.msfPath, "msf3")
|
|
||||||
|
|
||||||
if conf.osSmb:
|
if conf.osSmb:
|
||||||
isAdmin = runningAsAdmin()
|
isAdmin = runningAsAdmin()
|
||||||
|
|
|
@ -18,7 +18,7 @@ from lib.core.enums import OS
|
||||||
from thirdparty.six import unichr as _unichr
|
from thirdparty.six import unichr as _unichr
|
||||||
|
|
||||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||||
VERSION = "1.3.7.22"
|
VERSION = "1.3.7.23"
|
||||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
||||||
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||||
|
|
|
@ -68,29 +68,11 @@ class Metasploit(object):
|
||||||
self.payloadConnStr = None
|
self.payloadConnStr = None
|
||||||
self.localIP = getLocalIP()
|
self.localIP = getLocalIP()
|
||||||
self.remoteIP = getRemoteIP() or conf.hostname
|
self.remoteIP = getRemoteIP() or conf.hostname
|
||||||
self._msfCli = normalizePath(os.path.join(conf.msfPath, "msfcli"))
|
self._msfCli = normalizePath(os.path.join(conf.msfPath, "msfcli%s" % (".bat" if IS_WIN else "")))
|
||||||
self._msfConsole = normalizePath(os.path.join(conf.msfPath, "msfconsole"))
|
self._msfConsole = normalizePath(os.path.join(conf.msfPath, "msfconsole%s" % (".bat" if IS_WIN else "")))
|
||||||
self._msfEncode = normalizePath(os.path.join(conf.msfPath, "msfencode"))
|
self._msfEncode = normalizePath(os.path.join(conf.msfPath, "msfencode%s" % (".bat" if IS_WIN else "")))
|
||||||
self._msfPayload = normalizePath(os.path.join(conf.msfPath, "msfpayload"))
|
self._msfPayload = normalizePath(os.path.join(conf.msfPath, "msfpayload%s" % (".bat" if IS_WIN else "")))
|
||||||
self._msfVenom = normalizePath(os.path.join(conf.msfPath, "msfvenom"))
|
self._msfVenom = normalizePath(os.path.join(conf.msfPath, "msfvenom%s" % (".bat" if IS_WIN else "")))
|
||||||
|
|
||||||
if IS_WIN:
|
|
||||||
_ = conf.msfPath
|
|
||||||
while _:
|
|
||||||
if os.path.exists(os.path.join(_, "scripts")):
|
|
||||||
_ = os.path.join(_, "scripts", "setenv.bat")
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
old = _
|
|
||||||
_ = 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
|
|
||||||
self._msfPayload = "%s & ruby %s" % (_, self._msfPayload)
|
|
||||||
self._msfVenom = "%s & ruby %s" % (_, self._msfVenom)
|
|
||||||
|
|
||||||
self._msfPayloadsList = {
|
self._msfPayloadsList = {
|
||||||
"windows": {
|
"windows": {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user