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
"""
isAdmin = False
isAdmin = None
if PLATFORM in ("posix", "mac"):
isAdmin = os.geteuid()
_ = os.geteuid()
if isinstance(isAdmin, (int, float, long)) and isAdmin == 0:
isAdmin = True
isAdmin = isinstance(_, (int, float, long)) and _ == 0
elif IS_WIN:
isAdmin = ctypes.windll.shell32.IsUserAnAdmin()
_ = ctypes.windll.shell32.IsUserAnAdmin()
if isinstance(isAdmin, (int, float, long)) and isAdmin == 1:
isAdmin = True
isAdmin = isinstance(_, (int, float, long)) and _ == 1
else:
errMsg = "sqlmap is not able to check if you are running it "
errMsg += "as an administrator account on this platform. "