Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions keyauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,20 @@ def __do_request(self, post_data):
client_computed = hmac.new(key.encode('utf-8'), response.text.encode('utf-8'), hashlib.sha256).hexdigest()

signature = response.headers["signature"]

if not os.path.exists("C:\\ProgramData\\KeyAuth"):
os.makedirs("C:\\ProgramData\\KeyAuth")
os.makedirs("C:\\ProgramData\\KeyAuth\\Debug")

exe_name = os.path.basename(__file__)
if not os.path.exists(f"C:\\ProgramData\\KeyAuth\\Debug\\{exe_name}"):
os.makedirs(f"C:\\ProgramData\\KeyAuth\\Debug\\{exe_name}")

with open(f"C:\\ProgramData\\KeyAuth\\Debug\\{exe_name}\\log.txt", "a") as log_file:
if len(response.text) <= 200:
tampered = not hmac.compare_digest(client_computed, signature)
execution_time = time.strftime("%I:%M %p | %m/%d/%Y")
log_file.write(f"\n{execution_time} | {post_data['type']} \nResponse: {response.text}\n Was response tampered with? {tampered}\n")

if not hmac.compare_digest(client_computed, signature):
print("Signature checksum failed. Request was tampered with or session ended most likely.")
Expand Down Expand Up @@ -602,3 +616,4 @@ def get_hwid():
serial = output.decode().split('=', 1)[1].replace(' ', '')
hwid = serial[1:-2]
return hwid