From 8be9cd4ac4761225e94cd8e30fa7e88840f9c0e0 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Sat, 31 Mar 2012 10:22:50 +0000 Subject: [PATCH] bug fix (on Linux machine when os.geteuid() returns an integer value !=0 it was then returned and interpreted as TRUE value) --- lib/core/common.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/core/common.py b/lib/core/common.py index 6b774a5cc..6447b7fc5 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -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. "