Skip to content

Commit 9d30c38

Browse files
committed
replace getnode with machineid
1 parent 9487fca commit 9d30c38

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ KEYGEN_PUBLIC_KEY='e8601e48b69383ba520245fd07971e983d06d22c4257cfd82304601479cee
4040

4141
The following will happen:
4242

43-
1. The current device will be fingerprinted, using a SHA-256 digest of the
44-
device's MAC address. You may want to look into alternative fingerprinting,
45-
depending on your expected environment.
43+
1. The current device will be fingerprinted, using a SHA256-HAMC digest of the
44+
device's [machineid](https://github.com/keygen-sh/py-machineid). You may
45+
want to look into alternative fingerprinting, depending on your expected
46+
run environment.
4647
1. The machine file's authenticity will be verified using Ed25519, by verifing
4748
its signature using the public key.
4849
1. The machine file will be decrypted using the license key and fingerprint

main.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,19 @@
33
from cryptography.hazmat.backends import default_backend
44
from cryptography.exceptions import InvalidKey, InvalidTag
55
from ed25519 import BadSignatureError
6-
from uuid import getnode as get_mac
6+
import machineid
77
import argparse
88
import ed25519
99
import base64
1010
import json
1111
import sys
1212
import os
1313

14-
def fingerprint():
15-
"""
16-
fingerprint returns a hex-encoded SHA-256 digest of the current MAC address.
17-
"""
18-
mac = str(get_mac())
19-
digest = hashes.Hash(hashes.SHA256())
20-
digest.update(mac.encode())
21-
return digest.finalize().hex()
22-
2314
parser = argparse.ArgumentParser()
2415

25-
parser.add_argument('-p', '--path', dest='path', required=True, help='Path to machine file (required)')
26-
parser.add_argument('-l', '--license', dest='license', required=True, help='License key (required)')
27-
parser.add_argument('-f', '--fingerprint', dest='fingerprint', default=fingerprint(), help='Machine fingerprint')
16+
parser.add_argument('-p', '--path', dest='path', required=True, help='Path to machine file (required)')
17+
parser.add_argument('-l', '--license', dest='license', required=True, help='License key (required)')
18+
parser.add_argument('-f', '--fingerprint', dest='fingerprint', default=machineid.hashed_id('example-app'), help='Machine fingerprint')
2819

2920
args = parser.parse_args()
3021

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1+
py-machineid
12
argparse
23
cryptography
34
ed25519
4-
uuid

0 commit comments

Comments
 (0)