Last active
September 14, 2023 10:27
-
-
Save tommelo/be8bc7d0a81a2bfbf56e330f19535189 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import ctypes | |
import _winreg | |
def is_running_as_admin(): | |
''' | |
Checks if the script is running with administrative privileges. | |
Returns True if is running as admin, False otherwise. | |
''' | |
try: | |
return ctypes.windll.shell32.IsUserAnAdmin() | |
except: | |
return False | |
def execute(): | |
if not is_running_as_admin(): | |
print '[!] The script is NOT running with administrative privileges' | |
else: | |
print '[+] The script is running with administrative privileges!' | |
if __name__ == '__main__': | |
execute() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks, helped a ton!!!