Skip to content

Commit a9cd93b

Browse files
author
6nz
authored

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

keyauth.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import win32security #get sid
12
import json as jsond # json
23

34
import time # sleep before exit
@@ -456,19 +457,16 @@ def __load_user_data(self, data):
456457
class others:
457458
@staticmethod
458459
def get_hwid():
460+
winuser = os.getlogin()
459461
if platform.system() != "Windows":
460462
with open("/etc/machine-id") as f:
461463
hwid = f.read()
462464
return hwid
463465

464-
cmd = subprocess.Popen(
465-
"wmic useraccount where name='%username%' get sid", stdout=subprocess.PIPE, shell=True)
466+
sid = win32security.LookupAccountName(None, winuser)[0]
467+
sidstr = win32security.ConvertSidToStringSid(sid)
466468

467-
(suppost_sid, error) = cmd.communicate()
468-
469-
suppost_sid = suppost_sid.split(b'\n')[1].strip()
470-
471-
return suppost_sid.decode()
469+
return sidstr
472470

473471

474472
class encryption:
@@ -514,4 +512,4 @@ def decrypt(message, enc_key, iv):
514512
return encryption.decrypt_string(message.encode(), _key.encode(), _iv.encode()).decode()
515513
except:
516514
print("Invalid Application Information. Long text is secret short text is ownerid. Name is supposed to be app name not username")
517-
sys.exit()
515+
sys.exit()

0 commit comments

Comments
 (0)