代码之家  ›  专栏  ›  技术社区  ›  Forge Nand Parikh

正在获取CPU或主板序列号?

  •  4
  • Forge Nand Parikh  · 技术社区  · 14 年前

    我正试图得到 CPU serial motherboard serial 使用 C Python 用于许可目的。有可能吗?

    我在用 Linux .

    5 回复  |  直到 9 年前
        1
  •  3
  •   dicroce    14 年前

    您需要使用CPUID指令。

    CPUID

    大多数C编译器都支持内联程序集,但您需要知道自己在做什么。

        2
  •  7
  •   Simone    14 年前

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

        3
  •  3
  •   Tony    14 年前

    你可以得到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
    
        4
  •  2
  •   richardw    13 年前

    在Linux中,主板信息可以在/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
    

    …但并不是所有的主板都能通过dmi提供序列号…如图所示。

        5
  •  0
  •   Forge Nand Parikh    10 年前

    CPU不再获取序列号,现在已经有一段时间了。对于CPUID-它是每个CPU模型唯一的,因此它对许可没有帮助。

    推荐文章