MCPcopy Index your code
hub / github.com/sshuttle/sshuttle / is_admin_user

Function is_admin_user

sshuttle/helpers.py:263–273  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

261
262
263def is_admin_user():
264 if sys.platform == 'win32':
265 # https://stackoverflow.com/questions/130763/request-uac-elevation-from-within-a-python-script/41930586#41930586
266 import ctypes
267 try:
268 return ctypes.windll.shell32.IsUserAnAdmin()
269 except Exception:
270 return False
271
272 # TODO(nom3ad): for sys.platform == 'linux', check capabilities for non-root users. (CAP_NET_ADMIN might be enough?)
273 return os.getuid() == 0
274
275
276def set_non_blocking_io(fd):

Callers 3

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected