Skip to content

Commit 2d4096a

Browse files
authored
Security Update - by VaultCord.com
Security update
2 parents 36499e3 + de20312 commit 2d4096a

File tree

3 files changed

+26
-30
lines changed

3 files changed

+26
-30
lines changed

keyauth.py

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
import json as jsond # json
33
import time # sleep before exit
44
import binascii # hex encoding
5-
from uuid import uuid4 # gen random guid
65
import platform # check platform
76
import subprocess # needed for mac device
8-
import hmac # signature checksum
9-
import hashlib # signature checksum
7+
from datetime import datetime
8+
from discord_interactions import verify_key # used for signature verification
109

1110
try:
1211
if os.name == 'nt':
@@ -28,20 +27,18 @@
2827

2928
class api:
3029

31-
name = ownerid = secret = version = hash_to_check = ""
30+
name = ownerid = version = hash_to_check = ""
3231

33-
def __init__(self, name, ownerid, secret, version, hash_to_check):
34-
if len(ownerid) != 10 and len(secret) != 64:
35-
print("Go to Manage Applications on dashboard, copy python code, and replace code in main.py with that")
32+
def __init__(self, name, ownerid, version, hash_to_check):
33+
if len(ownerid) != 10:
34+
print("Visit https://keyauth.cc/app/, copy Pthon code, and replace code in main.py with that")
3635
time.sleep(3)
3736
os._exit(1)
3837

3938
self.name = name
4039

4140
self.ownerid = ownerid
4241

43-
self.secret = secret
44-
4542
self.version = version
4643
self.hash_to_check = hash_to_check
4744
self.init()
@@ -54,16 +51,11 @@ def init(self):
5451
print("You've already initialized!")
5552
time.sleep(3)
5653
os._exit(1)
57-
58-
sent_key = str(uuid4())[:16]
59-
60-
self.enckey = sent_key + "-" + self.secret
6154

6255
post_data = {
6356
"type": "init",
6457
"ver": self.version,
6558
"hash": self.hash_to_check,
66-
"enckey": sent_key,
6759
"name": self.name,
6860
"ownerid": self.ownerid
6961
}
@@ -96,9 +88,6 @@ def init(self):
9688

9789
self.sessionid = json["sessionid"]
9890
self.initialized = True
99-
100-
if json["newSession"]:
101-
time.sleep(0.1)
10291

10392
def register(self, user, password, license, hwid=None):
10493
self.checkinit()
@@ -523,15 +512,23 @@ def logout(self):
523512
def __do_request(self, post_data):
524513
try:
525514
response = requests.post(
526-
"https://keyauth.win/api/1.2/", data=post_data, timeout=10
515+
"https://keyauth.win/api/1.3/", data=post_data, timeout=10
527516
)
528517

529-
key = self.secret if post_data["type"] == "init" else self.enckey
530-
if post_data["type"] == "log": return response.text
531-
532-
client_computed = hmac.new(key.encode('utf-8'), response.text.encode('utf-8'), hashlib.sha256).hexdigest()
518+
if post_data["type"] == "log" or post_data["type"] == "file": return response.text
533519

534-
signature = response.headers["signature"]
520+
signature = response.headers["x-signature-ed25519"]
521+
timestamp = response.headers["x-signature-timestamp"]
522+
523+
unix_timestamp = int(timestamp)
524+
# Get the current time
525+
current_time = datetime.now().timestamp()
526+
527+
# Check if the timestamp is older than 15 seconds
528+
if current_time - unix_timestamp > 15:
529+
print("Timestamp OLD")
530+
time.sleep(3)
531+
os._exit(1)
535532

536533
if not os.path.exists("C:\\ProgramData\\KeyAuth"):
537534
os.makedirs("C:\\ProgramData\\KeyAuth")
@@ -543,11 +540,10 @@ def __do_request(self, post_data):
543540

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

550-
if not hmac.compare_digest(client_computed, signature):
546+
if not verify_key(response.text.encode('utf-8'), signature, timestamp, '5586b4bc69c7a4b487e4563a4cd96afd39140f919bd31cea7d1c6a1e8439422b'):
551547
print("Signature checksum failed. Request was tampered with or session ended most likely.")
552548
print("Response: " + response.text)
553549
time.sleep(3)

main.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@ def getchecksum():
4646

4747

4848
keyauthapp = api(
49-
name = "",
50-
ownerid = "",
51-
secret = "",
52-
version = "1.0",
49+
name = "", # Application Name
50+
ownerid = "", # Owner ID
51+
version = "1.0", # Application Version
5352
hash_to_check = getchecksum()
5453
)
5554

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
requests
22
pywin32
3+
discord-interactions

0 commit comments

Comments
 (0)