Domanda

Sto cercando di ottenere il CPU serial o motherboard serial utilizzando C o Python per scopi di licenza. E 'possibile?

sto usando Linux.

È stato utile?

Soluzione

È necessario utilizzare l'istruzione CPUID.

CPUID

La maggior parte compilatori C hanno un supporto per la linea di assemblaggio, ma sarà necessario sapere cosa si sta facendo.

Altri suggerimenti

Sotto Linux, è possibile utilizzare "lshw -quiet -xml" e analizzare la sua produzione. Troverete un sacco di informazioni qui di seguito: CPUID, scheda madre id e molto altro ancora.

È possibile ottenere il CPUID. Forse comando di Linux 'dmidecode' ti può aiutare. È possibile exec questo comando, o caricare il codice sorgente di "dmidecode". Successivo è l'uscita di "dmidecode processore -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

In Linux, le informazioni della scheda madre può essere trovato sotto / sys / class / DMI ad esempio

$ 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

... ma non tutte le schede madri forniscono il numero di serie tramite DMI ... come si può vedere qui.

CPU ottenere non più di un numero di serie ed è stato così per un po 'di tempo. Per il CPUID - è univoco per ogni modello di CPU, pertanto non aiuta con la licenza

.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top