0.5.4 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform
Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.
MIT - MIT LicenseGet os native machine id without root permission.
In Linux, machine id is a single newline-terminated, hexadecimal, 32-character, lowercase ID. When decoded from hexadecimal, this corresponds to a 16-byte/128-bit value. This ID may not be all zeros. This ID uniquely identifies the host. It should be considered "confidential", and must not be exposed in untrusted environments. And do note that the machine id can be re-generated by root.
Please note that on *nix platforms, this library does not require any dependencies,
but on Windows, it requires the winreg dependency. So if you only need to build the *nix version,
you can use version 0.3.0.
use machine_uid;
fn main() {
let id: String = machine_uid::get().unwrap();
println!("{}", id);
}It get machine id from following source:
Linux or who use systemd:
cat /var/lib/dbus/machine-id # or /etc/machine-idBSD:
cat /etc/hostid # or kenv -q smbios.system.uuidOSX:
ioreg -rd1 -c IOPlatformExpertDevice | grep IOPlatformUUIDWindows:
(Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography).MachineGuidillumos:
gethostid(3C)I have tested in following platform:
MIT License Copyright (c) 2018, Hanaasagi