diff --git a/plugins/dbms/mysql/takeover.py b/plugins/dbms/mysql/takeover.py index 0310a5743..b79c76562 100644 --- a/plugins/dbms/mysql/takeover.py +++ b/plugins/dbms/mysql/takeover.py @@ -14,6 +14,7 @@ from lib.core.common import isTechniqueAvailable from lib.core.common import normalizePath from lib.core.common import ntToPosixSlashes from lib.core.common import randomStr +from lib.core.common import readInput from lib.core.data import kb from lib.core.data import logger from lib.core.data import paths @@ -80,11 +81,29 @@ class Takeover(GenericTakeover): self.udfLocalFile = paths.SQLMAP_UDF_PATH self.udfSharedLibName = "libs%s" % randomStr(lowercase=True) + msg = "what is the back-end database management system architecture?" + msg += "\n[1] 32-bit (default)" + msg += "\n[2] 64-bit" + + while True: + arch = readInput(msg, default='1') + + if isinstance(arch, basestring) and arch.isdigit() and int(arch) in ( 1, 2 ): + if int(arch) == 1: + arch = 32 + else: + arch = 64 + + break + else: + warnMsg = "invalid value, valid values are 1 and 2" + logger.warn(warnMsg) + if kb.os == "Windows": - self.udfLocalFile += "/mysql/windows/32/lib_mysqludf_sys.dll" + self.udfLocalFile += "/mysql/windows/%d/lib_mysqludf_sys.dll" % arch self.udfSharedLibExt = "dll" else: - self.udfLocalFile += "/mysql/linux/32/lib_mysqludf_sys.so" + self.udfLocalFile += "/mysql/linux/%d/lib_mysqludf_sys.so" % arch self.udfSharedLibExt = "so" def udfCreateFromSharedLib(self, udf, inpRet): diff --git a/plugins/dbms/postgresql/takeover.py b/plugins/dbms/postgresql/takeover.py index 499c46dd7..7d22388de 100644 --- a/plugins/dbms/postgresql/takeover.py +++ b/plugins/dbms/postgresql/takeover.py @@ -8,6 +8,7 @@ See the file 'doc/COPYING' for copying permission """ from lib.core.common import randomStr +from lib.core.common import readInput from lib.core.data import kb from lib.core.data import logger from lib.core.data import paths @@ -54,11 +55,29 @@ class Takeover(GenericTakeover): errMsg = "unsupported feature on versions of PostgreSQL before 8.2" raise sqlmapUnsupportedFeatureException, errMsg + msg = "what is the back-end database management system architecture?" + msg += "\n[1] 32-bit (default)" + msg += "\n[2] 64-bit" + + while True: + arch = readInput(msg, default='1') + + if isinstance(arch, basestring) and arch.isdigit() and int(arch) in ( 1, 2 ): + if int(arch) == 1: + arch = 32 + else: + arch = 64 + + break + else: + warnMsg = "invalid value, valid values are 1 and 2" + logger.warn(warnMsg) + if kb.os == "Windows": - self.udfLocalFile += "/postgresql/windows/32/%s/lib_postgresqludf_sys.dll" % majorVer + self.udfLocalFile += "/postgresql/windows/%d/%s/lib_postgresqludf_sys.dll" % (arch, majorVer) self.udfSharedLibExt = "dll" else: - self.udfLocalFile += "/postgresql/linux/32/%s/lib_postgresqludf_sys.so" % majorVer + self.udfLocalFile += "/postgresql/linux/%d/%s/lib_postgresqludf_sys.so" % (arch, majorVer) self.udfSharedLibExt = "so" def udfCreateFromSharedLib(self, udf, inpRet):