我正在用Python搜索一种方法来“标记”一台计算机,以便以后给程序一个识别计算机的选项。
正如你所知,我需要的东西是独特的电脑或制造复杂的东西,不能真正被操纵。
更好理解的:
实际上,我试图阻止使用相同数据的程序(我将在另一台计算机上放置这个独特的东西或有关计算机的信息)。
发布于 2020-09-30 09:44:39
为此,它将使用MAC地址或主板UUID。但是,每个计算机的MAC地址不是唯一的,而是每个网络接口的唯一地址。例如,当您更改网卡时,MAC地址将发生更改。在Python中获取MAC地址的更多方法可以找到这里。
from getmac import get_mac_address as gma
print(gma())另一种看待这一点的方法是:是什么使计算机独一无二?是网络设备、主板还是硬盘?或者是所有这些的组合?一个获得主板系列的示例:
import os
import sys
os_type = sys.platform.lower()
if os_type.startswith('win'):
command = "wmic bios get serialnumber"
elif "linux" in os_type:
command = "hal-get-property --udi /org/freedesktop/Hal/devices/computer --key system.hardware.uuid"
elif "darwin" in os_type:
command = "ioreg -l | grep IOPlatformSerialNumber"
print(os.popen(command).read())发布于 2020-09-30 09:43:37
https://stackoverflow.com/questions/64134864
复制相似问题