Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8be9cd4

Browse files
committed
bug fix (on Linux machine when os.geteuid() returns an integer value !=0 it was then returned and interpreted as TRUE value)
1 parent 40a7232 commit 8be9cd4

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

lib/core/common.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2077,18 +2077,16 @@ def runningAsAdmin():
20772077
Returns True if the current process is run under admin privileges
20782078
"""
20792079

2080-
isAdmin = False
2080+
isAdmin = None
20812081

20822082
if PLATFORM in ("posix", "mac"):
2083-
isAdmin = os.geteuid()
2083+
_ = os.geteuid()
20842084

2085-
if isinstance(isAdmin, (int, float, long)) and isAdmin == 0:
2086-
isAdmin = True
2085+
isAdmin = isinstance(_, (int, float, long)) and _ == 0
20872086
elif IS_WIN:
2088-
isAdmin = ctypes.windll.shell32.IsUserAnAdmin()
2087+
_ = ctypes.windll.shell32.IsUserAnAdmin()
20892088

2090-
if isinstance(isAdmin, (int, float, long)) and isAdmin == 1:
2091-
isAdmin = True
2089+
isAdmin = isinstance(_, (int, float, long)) and _ == 1
20922090
else:
20932091
errMsg = "sqlmap is not able to check if you are running it "
20942092
errMsg += "as an administrator account on this platform. "

0 commit comments

Comments
 (0)