获取CPU或主板的序列号?
-
26-09-2019 - |
题
我试图让CPU serial
或使用motherboard serial
或C
用于许可目的Python
。这可能吗?
我使用Linux
。
解决方案
其他提示
在Linux下,你可以使用 “lshw -quiet -xml”,并解析其输出。你会发现很多的系统信息在这里:CPUID,主板ID等等。
您可以得到的CPUID。 或许linux命令“的dmidecode”可以帮助你。 你可以Exec的这个命令,或者加载“的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
在Linux中,主板信息可以在/ sys /类/ 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提供的序列号为......你可以在这里看到。
的CPU不再获得序列号,并一直这样有一段时间了。对于CPUID - 这是每因此CPU型号不与许可的帮助
独特。不隶属于 StackOverflow