系统相关
首页 > 系统相关> > java – 系统调用以获取Linux中的机器序列号

java – 系统调用以获取Linux中的机器序列号

作者:互联网

我知道这是一个很长的镜头但是有没有办法在linux中获取序列号或唯一可识别的信息?

如果是这样,如何将其编程到Java程序中?

在上下文中,我需要构建一个锁定到一台计算机的许可证验证程序,如果您有任何其他建议,欢迎使用.

提前致谢

解决方法:

以下是Lennart Poeterring关于一般ID的blog post的摘录.它是关于唯一ID,不一定是与安全性相关的唯一ID:

  • /sys/class/dmi/id/product_uuid: The main board product UUID, as set by the
    board manufacturer and encoded in the
    BIOS DMI information. It may be used
    to identify a mainboard and only the
    mainboard. It changes when the user
    replaces the main board. Also, often
    enough BIOS manufacturers write bogus
    serials into it. In addition, it is
    x86-specific. Access for unprivileged
    users is forbidden. Hence it is of
    little general use.

  • CPUID/EAX=3 CPU serial number: A CPU UUID, as set by the CPU manufacturer
    and encoded on the CPU chip. It may be
    used to identify a CPU and only a CPU.
    It changes when the user replaces the
    CPU. Also, most modern CPUs don’t
    implement this feature anymore, and
    older computers tend to disable this
    option by default, controllable via a
    BIOS Setup option. In addition, it is
    x86-specific. Hence this too is of
    little general use.

所以/ sys / class / dmi / id / product_uuid似乎是一个很好的候选者,但需要你的验证代码作为特权用户运行.完整的博客文章真的很有价值!

标签:java,linux,uniqueidentifier,validation
来源: https://codeday.me/bug/20190621/1257758.html