I have a process that requires me to identify different machines, and I\'m not sure what\'s the best way to do it. I do not want to save that ID on a text file or something,
For windows this seems to get same uuid every time por each device based on the MAC address:
str(uuid.uuid1(uuid.getnode(),0))[24:]
But it does not seem to keep same ID on Android 4.4.2.
or use bios serialnr
wmic bios get serialnumber
The ideal approach which I resorted to was this. It is quite fast and efficient.
hwid = str(subprocess.check_output(
'wmic csproduct get uuid')).split('\\r\\n')[1].strip('\\r').strip()
data = requests.get(
'https://gist.githubusercontent.com/rishav394/z/raw/x')
if hwid in data.text:
print('Authenticated!')
auth = True
else:
print(hwid + ' was not found on the server.\nNot authorised!')
Please note that you can get the same UUID from Windows without installing any additional software with the following command:
C:\> wmic csproduct get uuid
You could use dmidecode
.
Linux:
import subprocess
def get_id():
return subprocess.Popen('hal-get-property --udi /org/freedesktop/Hal/devices/computer --key system.hardware.uuid'.split())
Windows:
NOTE: Requires dmidecode for Windows
import subprocess
def get_id():
return subprocess.Popen('dmidecode.exe -s system-uuid'.split())
Cross-platform:
NOTE: Requires dmidecode for Windows
import subprocess
import os
def get_id():
if 'nt' in os.name:
return subprocess.Popen('dmidecode.exe -s system-uuid'.split())
else:
return subprocess.Popen('hal-get-property --udi /org/freedesktop/Hal/devices/computer --key system.hardware.uuid'.split())