获取CPU或主板序列号?

发布于 2024-10-02 18:52:33 字数 141 浏览 5 评论 0原文

我正在尝试使用 CPython 获取 CPU 序列号主板序列号 以获得许可。是否可以?

我正在使用Linux

I'm trying to get the CPU serial or motherboard serial using C or Python for licensing purposes. Is it possible?

I'm using Linux.

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

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

发布评论

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

评论(5

小嗲 2024-10-09 18:52:33

在 Linux 下,您可以使用“lshw -quiet -xml”并解析其输出。您将在这里找到大量系统信息:cpuid、主板 ID 等等。

Under Linux, you could use "lshw -quiet -xml" and parse its output. You'll find plenty of system information here: cpuid, motherboard id and much more.

鸢与 2024-10-09 18:52:33

您需要使用CPUID指令。

CPUID

大多数 C 编译器对内联汇编有一定的支持,但您需要知道自己在做什么。

You need to use the CPUID instruction.

CPUID

Most C compilers have some support for inline assembly, but you will need to know what you are doing.

恋竹姑娘 2024-10-09 18:52:33

就可以获取CPUID了。
也许linux命令'dmidecode'可以帮助你。
您可以执行此命令,或加载“dmidecode”的源代码。
接下来是“dmidecode -t 处理器”的输出:

>dmidecode -t processor
# dmidecode 2.7
SMBIOS 2.2 present.

Handle 0x0004, DMI type 4, 32 bytes.
Processor Information
        Socket Designation: Socket 478
        Type: Central Processor
        Family: Pentium 4
        Manufacturer: Intel
        ID: 27 0F 00 00 FF FB EB BF
        Signature: Type 0, Family 15, Model 2, Stepping 7
        Flags:
                FPU (Floating-point unit on-chip)
                VME (Virtual mode extension)
                DE (Debugging extension)
                PSE (Page size extension)
                TSC (Time stamp counter)
                MSR (Model specific registers)
                PAE (Physical address extension)
                MCE (Machine check exception)
                CX8 (CMPXCHG8 instruction supported)
                APIC (On-chip APIC hardware supported)
                SEP (Fast system call)
                MTRR (Memory type range registers)
                PGE (Page global enable)
                MCA (Machine check architecture)
                CMOV (Conditional move instruction supported)
                PAT (Page attribute table)
                PSE-36 (36-bit page size extension)
                CLFSH (CLFLUSH instruction supported)
                DS (Debug store)
                ACPI (ACPI supported)
                MMX (MMX technology supported)
                FXSR (Fast floating-point save and restore)
                SSE (Streaming SIMD extensions)
                SSE2 (Streaming SIMD extensions 2)
                SS (Self-snoop)
                HTT (Hyper-threading technology)
                TM (Thermal monitor supported)
                PBE (Pending break enabled)
        Version: Intel(R) Pentium(R) 4 CPU
        Voltage: 1.5 V
        External Clock: 133 MHz
        Max Speed: 3066 MHz
        Current Speed: 2800 MHz
        Status: Populated, Enabled
        Upgrade: ZIF Socket
        L1 Cache Handle: 0x0008
        L2 Cache Handle: 0x0009
        L3 Cache Handle: No L3 Cache

You can get the CPUID.
Maybe linux command 'dmidecode' can help you.
You can exec this command,or load the source code of "dmidecode".
Next is the output of "dmidecode -t processor":

>dmidecode -t processor
# dmidecode 2.7
SMBIOS 2.2 present.

Handle 0x0004, DMI type 4, 32 bytes.
Processor Information
        Socket Designation: Socket 478
        Type: Central Processor
        Family: Pentium 4
        Manufacturer: Intel
        ID: 27 0F 00 00 FF FB EB BF
        Signature: Type 0, Family 15, Model 2, Stepping 7
        Flags:
                FPU (Floating-point unit on-chip)
                VME (Virtual mode extension)
                DE (Debugging extension)
                PSE (Page size extension)
                TSC (Time stamp counter)
                MSR (Model specific registers)
                PAE (Physical address extension)
                MCE (Machine check exception)
                CX8 (CMPXCHG8 instruction supported)
                APIC (On-chip APIC hardware supported)
                SEP (Fast system call)
                MTRR (Memory type range registers)
                PGE (Page global enable)
                MCA (Machine check architecture)
                CMOV (Conditional move instruction supported)
                PAT (Page attribute table)
                PSE-36 (36-bit page size extension)
                CLFSH (CLFLUSH instruction supported)
                DS (Debug store)
                ACPI (ACPI supported)
                MMX (MMX technology supported)
                FXSR (Fast floating-point save and restore)
                SSE (Streaming SIMD extensions)
                SSE2 (Streaming SIMD extensions 2)
                SS (Self-snoop)
                HTT (Hyper-threading technology)
                TM (Thermal monitor supported)
                PBE (Pending break enabled)
        Version: Intel(R) Pentium(R) 4 CPU
        Voltage: 1.5 V
        External Clock: 133 MHz
        Max Speed: 3066 MHz
        Current Speed: 2800 MHz
        Status: Populated, Enabled
        Upgrade: ZIF Socket
        L1 Cache Handle: 0x0008
        L2 Cache Handle: 0x0009
        L3 Cache Handle: No L3 Cache
烟─花易冷 2024-10-09 18:52:33

在 Linux 中,主板信息可以在 /sys/class/dmi 下找到,例如

$ sudo grep '' /sys/class/dmi/id/board_*
/sys/class/dmi/id/board_asset_tag:
/sys/class/dmi/id/board_name:30AD
/sys/class/dmi/id/board_serial:
/sys/class/dmi/id/board_vendor:Hewlett-Packard
/sys/class/dmi/id/board_version:KBC Version 56.34

...但并非所有主板都通过 dmi 提供序列号...正如您在此处看到的。

In Linux, motherboard information may be found under /sys/class/dmi eg

$ sudo grep '' /sys/class/dmi/id/board_*
/sys/class/dmi/id/board_asset_tag:
/sys/class/dmi/id/board_name:30AD
/sys/class/dmi/id/board_serial:
/sys/class/dmi/id/board_vendor:Hewlett-Packard
/sys/class/dmi/id/board_version:KBC Version 56.34

...but not all motherboards provide serial number through dmi...as you can see here.

一梦等七年七年为一梦 2024-10-09 18:52:33

CPU 不再获得序列号,这种情况已经有一段时间了。对于 CPUID - 每个 CPU 型号都是唯一的,因此它对许可没有帮助。

CPUs no longer obtain a serial number and it's been like that for a while now. For the CPUID - it's unique per CPU model therefore it doesn't help with licensing.

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