基本上我计划将计算机UUID /序列号绑定到它运行的密钥,在Windows上我发现UUID足够容易,但是我很难为Mac获取任何东西.
有解决方案吗
解决方法:
以下是我通过Python获取Mac系列的方法:
<code>import subprocess
task = subprocess.Popen(
['system_profiler', 'SPHardwareDataType'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
out, err = task.communicate()
for l in out.split('n'):
if 'Serial Number (system)' in l:
serial_line = l.strip()
break
serial = serial_line.split(' ')[-1]
print(serial)
</code>
可以在这里找到pyobjc方式:https://gist.github.com/pudquick/c7dd1262bd81a32663f0
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!