mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-08-04 14:55:40 +00:00
Code refactoring
This commit is contained in:
parent
7715ba778b
commit
43de8247ac
2 changed files with 36 additions and 34 deletions
|
|
@ -8,6 +8,7 @@ See the file 'doc/COPYING' for copying permission
|
|||
"""
|
||||
|
||||
import codecs
|
||||
import ctypes
|
||||
import inspect
|
||||
import os
|
||||
import random
|
||||
|
|
@ -1531,3 +1532,28 @@ def beep():
|
|||
|
||||
else:
|
||||
dataToStdout('\a', True)
|
||||
|
||||
def runningAsAdmin():
|
||||
isAdmin = False
|
||||
|
||||
if PLATFORM in ( "posix", "mac" ):
|
||||
isAdmin = os.geteuid()
|
||||
|
||||
if isinstance(isAdmin, (int, float, long)) and isAdmin == 0:
|
||||
isAdmin = True
|
||||
elif IS_WIN:
|
||||
isAdmin = ctypes.windll.shell32.IsUserAnAdmin()
|
||||
|
||||
if isinstance(isAdmin, (int, float, long)) and isAdmin == 1:
|
||||
isAdmin = True
|
||||
else:
|
||||
errMsg = "sqlmap is not able to check if you are running it "
|
||||
errMsg += "as an administrator accout on this platform. "
|
||||
errMsg += "sqlmap will assume that you are an administrator "
|
||||
errMsg += "which is mandatory for the requested takeover attack "
|
||||
errMsg += "to work properly"
|
||||
logger.error(errMsg)
|
||||
|
||||
isAdmin = True
|
||||
|
||||
return isAdmin
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue