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

Method check_admin

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

Source from the content-addressed store, hash-verified

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

Callers 1

elevateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected