-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhwidinfo.py
70 lines (56 loc) · 1.86 KB
/
hwidinfo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import subprocess
import requests
import time
import sys
def get_hwid():
"""
Obtiene el HWID de la máquina utilizando el comando 'wmic csproduct get uuid'.
"""
output = subprocess.check_output('wmic csproduct get uuid').decode().strip()
hwid = output.split('\n')[1].strip()
return hwid
def check_device_authorization(auth_url, hwid):
"""
Verifica si el dispositivo está autorizado mediante una solicitud GET al enlace de autorización.
Devuelve True si el dispositivo está autorizado y False si no lo está.
"""
try:
response = requests.get(auth_url, timeout=5)
response.raise_for_status()
except requests.exceptions.RequestException as e:
print('[ERROR] Failed to fetch authorization data:', str(e))
time.sleep(5)
sys.exit(1)
if hwid in response.text:
print('[SUCCESS] Device authorized.')
print('[LOGS] Welcome!')
return True
else:
print('[ERROR] Device not authorized.')
print('[LOGS] HWID:', hwid)
time.sleep(5)
sys.exit(1)
def set_terminal_title(title):
"""
Establece el título de la ventana del terminal.
"""
if sys.platform.startswith('win32'):
os.system(f'title {title}')
else:
sys.stdout.write(f'\x1b]2;{title}\x07')
def main():
# Obtener el HWID de la máquina
hwid = get_hwid()
# Realizar la verificación de autorización
auth_url = 'yourpastebinrawlink'
is_authorized = check_device_authorization(auth_url, hwid)
# Establecer el título de la ventana del terminal
set_terminal_title('Device Authorization')
# Esperar a que el usuario presione una tecla para salir
if is_authorized:
input('[INFO] Press any key to exit.')
else:
print('[INFO] Exiting...')
time.sleep(5)
if __name__ == '__main__':
main()