关于如何唯一标识一台计算机的想法?

发布于 2024-09-26 00:33:28 字数 163 浏览 1 评论 0原文

我一直在想如何用 python 来唯一地识别一台计算机。首先,我考虑检查用户的 MAC 地址和硬盘空间,然后尝试根据许多这些变量计算某种评级。然而,这个解决方案感觉不太正确。运行需要很长时间,并且由于不可预见的错误,我不得不多次更改它。

想法??此外,如果它能够检测到虚拟机上的运行,那就太好了。

I have been thinking of ways I could uniquely identify a computer in python. First, I thought about checking the user's mac address and hard disk space, then I tried to compute some sort of rating from many of these variables. However, this solution doesn't feel right. It takes a long time to run and I had to change it many times already due to unforeseen errors.

Ideas?? Additionally, it would be very nice if it could detect running on a virtual machine.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

往事风中埋 2024-10-03 00:33:28

首先您需要定义“计算机”。如果换了机箱,电脑还是同一台电脑吗?硬盘?网卡?增加内存?升级内核?

(这让我想起了关于“我祖父​​的锤子”的说法——当然,我已经更换了五次头部和两次手柄,但它仍然是同一把锤子......)

这有助于退后一步并确定为什么你需要做这个。解决方案可能是将一个配置文件放在某个位置,其中包含一个随机密钥,然后如果用户出于某种原因需要彻底删除这个识别 cookie,他们就可以。 (或者也许你不希望这样......)

你可能会找到Python UUID模块也很有用。

First you need to define "computer." Is a computer the same computer if you change the case? The hard drive? The network card? Increase the RAM? Upgrade the kernel?

(It brings to mind the saying about "my grandfather's hammer" — sure, I've replaced the head five times and the handle twice, but it's still the same hammer...)

It helps to step back and identify why you need to do this. The solution might be to put a configuration file somewhere with a random key in it, and then if the user needs to absolutely nuke this identifying cookie for whatever reason, they can. (Or maybe you don't want that...)

You might find the Python UUID module useful too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文