Now it works also on Mac OS X

This commit is contained in:
Bernardo Damele 2009-04-30 10:46:50 +00:00
parent 722ca8bf2f
commit e8c115500d
5 changed files with 23 additions and 7 deletions

View File

@ -74,6 +74,9 @@ Will Holcomb <wholcomb@gmail.com>
for his MultipartPostHandler class to handle multipart POST forms and
permission to include it within sqlmap source code
Mounir Idrassi <mounir.idrassi@idrix.net>
for his compiled version of UPX for Mac OS X
Luke Jahnke <luke.jahnke@gmail.com>
for reporting a bug when running against MySQL < 5.0

View File

@ -63,8 +63,8 @@ class Magic:
def __del__(self):
try:
magic_close(self.cookie)
except Exception, e:
print "got this:", e
except Exception, _:
pass
_magic_mime = None

BIN
lib/contrib/upx/macosx/upx Executable file

Binary file not shown.

View File

@ -258,6 +258,12 @@ def __setMetasploit():
if conf.osSmb:
isAdmin = False
# TODO: add support for Mac OS X
#if "darwin" in PLATFORM:
# pass
#
#elif "win" in PLATFORM:
if "win" in PLATFORM:
isAdmin = ctypes.windll.shell32.IsUserAnAdmin()
@ -270,10 +276,6 @@ def __setMetasploit():
if isinstance(isAdmin, (int, float, long)) and isAdmin == 0:
isAdmin = True
# TODO: add support for Mac OS X
#elif "darwin" in PLATFORM:
# pass
else:
warnMsg = "sqlmap is not able to check if you are running it "
warnMsg += "as an Administrator accout on this platform. "

View File

@ -48,11 +48,22 @@ class UPX:
"""
def __initialize(self, srcFile, dstFile=None):
if "win" in PLATFORM:
if "darwin" in PLATFORM:
self.__upxPath = "%s/upx/macosx/upx" % paths.SQLMAP_CONTRIB_PATH
elif "win" in PLATFORM:
self.__upxPath = "%s/upx/windows/upx.exe" % paths.SQLMAP_CONTRIB_PATH
elif "linux" in PLATFORM:
self.__upxPath = "%s/upx/linux/upx" % paths.SQLMAP_CONTRIB_PATH
else:
warnMsg = "unsupported platform for the compression tool "
warnMsg += "(upx), sqlmap will continue anyway"
logger.warn(warnMsg)
self.__upxPath = "%s/upx/linux/upx" % paths.SQLMAP_CONTRIB_PATH
self.__upxCmd = "%s -9 -qq %s" % (self.__upxPath, srcFile)
if dstFile: