Get a unique computer ID in Python on windows and linux

前端 未结 12 963
野趣味
野趣味 2020-11-29 02:27

I\'d like to get an id unique to a computer with Python on Windows and Linux. It could be the CPU ID, the motherboard serial, ... or anything else.

I looked at sever

12条回答
  •  野性不改
    2020-11-29 03:04

    for Windows you need DmiDecode for Windows (link) :

    subprocess.Popen('dmidecode.exe -s system-uuid'.split())
    

    for Linux (non root):

    subprocess.Popen('hal-get-property --udi /org/freedesktop/Hal/devices/computer --key system.hardware.uuid'.split())
    

提交回复
热议问题