bug fix (on Linux machine when os.geteuid() returns an integer value !=0 it was then returned and interpreted as TRUE value)

This commit is contained in:
Miroslav Stampar 2012-03-31 10:22:50 +00:00
parent 40a7232de6
commit 8be9cd4ac4

View File

@ -2077,18 +2077,16 @@ def runningAsAdmin():
Returns True if the current process is run under admin privileges Returns True if the current process is run under admin privileges
""" """
isAdmin = False isAdmin = None
if PLATFORM in ("posix", "mac"): if PLATFORM in ("posix", "mac"):
isAdmin = os.geteuid() _ = os.geteuid()
if isinstance(isAdmin, (int, float, long)) and isAdmin == 0: isAdmin = isinstance(_, (int, float, long)) and _ == 0
isAdmin = True
elif IS_WIN: elif IS_WIN:
isAdmin = ctypes.windll.shell32.IsUserAnAdmin() _ = ctypes.windll.shell32.IsUserAnAdmin()
if isinstance(isAdmin, (int, float, long)) and isAdmin == 1: isAdmin = isinstance(_, (int, float, long)) and _ == 1
isAdmin = True
else: else:
errMsg = "sqlmap is not able to check if you are running it " errMsg = "sqlmap is not able to check if you are running it "
errMsg += "as an administrator account on this platform. " errMsg += "as an administrator account on this platform. "