Interface ComputerSystem
- All Known Implementing Classes:
AbstractComputerSystem, MacComputerSystem, WindowsComputerSystem
Docker/container note: OSHI reports the host operating system and hardware information, not the container's. Serial numbers and UUIDs may return "unknown" inside containers.
Unique machine identifier: The getHardwareUUID() value can be combined with other fields (such as
processor ID and serial number) to construct a machine fingerprint. Note that the UUID value
03000200-0400-0500-0006-000700080009 is a known placeholder that is not unique. See the ComputerID
class in the oshi-demo module for an example approach.
VM detection: Virtual machine environments can often be identified by examining the
getManufacturer(), getModel(), and Firmware values. See the DetectVM class in the
oshi-demo module for an example.
-
Method Summary
Modifier and TypeMethodDescriptionGet the computer system baseboard/motherboard.Get the computer system firmware/BIOS.Get the computer system hardware UUID, if available.Get the computer system manufacturer.getModel()Get the computer system model.Get the computer system serial number, if available.
-
Method Details
-
getManufacturer
-
getModel
-
getSerialNumber
String getSerialNumber()Get the computer system serial number, if available.Performs a best-effort attempt to retrieve a unique serial number from the computer system. This may originate from the baseboard, BIOS, processor, etc.
This value is provided for information only. Caution should be exercised if using this result to "fingerprint" a system for licensing or other purposes, as the result may change based on program permissions or installation of software packages. Specifically, on Linux and FreeBSD, this requires either root permissions, or installation of the (deprecated) HAL library (lshal command). Linux also attempts to read the dmi/id serial number files in sysfs, which are read-only root by default but may have permissions altered by the user.
- Returns:
- the System Serial Number, if available, otherwise returns "unknown"
-
getHardwareUUID
String getHardwareUUID()Get the computer system hardware UUID, if available.Performs a best-effort attempt to retrieve the hardware UUID.
- Returns:
- the Hardware UUID, if available, otherwise returns "unknown"
-
getFirmware
-
getBaseboard
-