Skip to content

Commit d5fb137

Browse files
committed
Gone unnoticed for way too long
1 parent 228cc68 commit d5fb137

File tree

2 files changed

+42
-4
lines changed

2 files changed

+42
-4
lines changed

plugins/dbms/mysql/takeover.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from lib.core.common import normalizePath
1515
from lib.core.common import ntToPosixSlashes
1616
from lib.core.common import randomStr
17+
from lib.core.common import readInput
1718
from lib.core.data import kb
1819
from lib.core.data import logger
1920
from lib.core.data import paths
@@ -80,11 +81,29 @@ def udfSetLocalPaths(self):
8081
self.udfLocalFile = paths.SQLMAP_UDF_PATH
8182
self.udfSharedLibName = "libs%s" % randomStr(lowercase=True)
8283

84+
msg = "what is the back-end database management system architecture?"
85+
msg += "\n[1] 32-bit (default)"
86+
msg += "\n[2] 64-bit"
87+
88+
while True:
89+
arch = readInput(msg, default='1')
90+
91+
if isinstance(arch, basestring) and arch.isdigit() and int(arch) in ( 1, 2 ):
92+
if int(arch) == 1:
93+
arch = 32
94+
else:
95+
arch = 64
96+
97+
break
98+
else:
99+
warnMsg = "invalid value, valid values are 1 and 2"
100+
logger.warn(warnMsg)
101+
83102
if kb.os == "Windows":
84-
self.udfLocalFile += "/mysql/windows/32/lib_mysqludf_sys.dll"
103+
self.udfLocalFile += "/mysql/windows/%d/lib_mysqludf_sys.dll" % arch
85104
self.udfSharedLibExt = "dll"
86105
else:
87-
self.udfLocalFile += "/mysql/linux/32/lib_mysqludf_sys.so"
106+
self.udfLocalFile += "/mysql/linux/%d/lib_mysqludf_sys.so" % arch
88107
self.udfSharedLibExt = "so"
89108

90109
def udfCreateFromSharedLib(self, udf, inpRet):

plugins/dbms/postgresql/takeover.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"""
99

1010
from lib.core.common import randomStr
11+
from lib.core.common import readInput
1112
from lib.core.data import kb
1213
from lib.core.data import logger
1314
from lib.core.data import paths
@@ -54,11 +55,29 @@ def udfSetLocalPaths(self):
5455
errMsg = "unsupported feature on versions of PostgreSQL before 8.2"
5556
raise sqlmapUnsupportedFeatureException, errMsg
5657

58+
msg = "what is the back-end database management system architecture?"
59+
msg += "\n[1] 32-bit (default)"
60+
msg += "\n[2] 64-bit"
61+
62+
while True:
63+
arch = readInput(msg, default='1')
64+
65+
if isinstance(arch, basestring) and arch.isdigit() and int(arch) in ( 1, 2 ):
66+
if int(arch) == 1:
67+
arch = 32
68+
else:
69+
arch = 64
70+
71+
break
72+
else:
73+
warnMsg = "invalid value, valid values are 1 and 2"
74+
logger.warn(warnMsg)
75+
5776
if kb.os == "Windows":
58-
self.udfLocalFile += "/postgresql/windows/32/%s/lib_postgresqludf_sys.dll" % majorVer
77+
self.udfLocalFile += "/postgresql/windows/%d/%s/lib_postgresqludf_sys.dll" % (arch, majorVer)
5978
self.udfSharedLibExt = "dll"
6079
else:
61-
self.udfLocalFile += "/postgresql/linux/32/%s/lib_postgresqludf_sys.so" % majorVer
80+
self.udfLocalFile += "/postgresql/linux/%d/%s/lib_postgresqludf_sys.so" % (arch, majorVer)
6281
self.udfSharedLibExt = "so"
6382

6483
def udfCreateFromSharedLib(self, udf, inpRet):

0 commit comments

Comments
 (0)