https://github.com/borud/hwid
Hardware ID based on the primary network adapter.
https://github.com/borud/hwid
Last synced: over 1 year ago
JSON representation
Hardware ID based on the primary network adapter.
- Host: GitHub
- URL: https://github.com/borud/hwid
- Owner: borud
- License: apache-2.0
- Created: 2022-03-29T15:25:50.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-04-01T12:52:20.000Z (about 4 years ago)
- Last Synced: 2023-07-27T21:58:05.837Z (almost 3 years ago)
- Language: Go
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hwid
Quick hack to determine the hardware id of a machine. This uses the MAC address of the primary network interface and expresses it as a string containing the address in base36. This isn't particularly robust, but it comes in handly in some cases.
To install the command line utility just to a
```shell
go install github.com/borud/hwid/cmd/hwid@latest
```
If you want to use it in your application as a library, the following is the source of `cmd/hwid` (just because I know you are too lazy to click 😃)
```go
package main
import (
"flag"
"fmt"
"log"
"github.com/borud/hwid"
)
var intf string
func init() {
flag.StringVar(&intf, "i", "", "network interface")
flag.Parse()
}
func main() {
id, err := hwid.ID(intf)
if err != nil {
log.Fatal(err)
}
fmt.Println(id)
}
```