MCPcopy Create free account
hub / github.com/corpnewt/gibMacOS / check_admin

Method check_admin

Scripts/utils.py:24–30  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

22 os.chdir(cwd)
23
24 def check_admin(self):
25 # Returns whether or not we're admin
26 try:
27 is_admin = os.getuid() == 0
28 except AttributeError:
29 is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
30 return is_admin
31
32 def elevate(self, file):
33 # Runs the passed file as admin

Callers 2

elevateMethod · 0.95
__init__Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected