File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change 33import time # sleep before exit
44import binascii # hex encoding
55from uuid import uuid4 # gen random guid
6- import platform
6+ import platform # check platform
7+ import subprocess # needed for mac device
78
89try :
910 if os .name == 'nt' :
@@ -538,16 +539,21 @@ def __load_user_data(self, data):
538539class others :
539540 @staticmethod
540541 def get_hwid ():
541- winuser = os .getlogin ()
542- if platform .system () != "Windows" :
542+ if platform .system () == "Linux" :
543543 with open ("/etc/machine-id" ) as f :
544544 hwid = f .read ()
545545 return hwid
546+ elif platform .system () == 'Windows' :
547+ winuser = os .getlogin ()
548+ sid = win32security .LookupAccountName (None , winuser )[0 ]
549+ hwid = win32security .ConvertSidToStringSid (sid )
550+ return hwid
551+ elif platform .system () == 'Darwin' :
552+ output = subprocess .Popen ("ioreg -l | grep IOPlatformSerialNumber" , stdout = subprocess .PIPE , shell = True ).communicate ()[0 ]
553+ serial = output .decode ().split ('=' , 1 )[1 ].replace (' ' , '' )
554+ hwid = serial [1 :- 2 ]
555+ return hwid
546556
547- sid = win32security .LookupAccountName (None , winuser )[0 ]
548- sidstr = win32security .ConvertSidToStringSid (sid )
549-
550- return sidstr
551557
552558
553559class encryption :
You can’t perform that action at this time.
0 commit comments