Skip to content

Added Missing Features #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 14, 2022
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
138 changes: 120 additions & 18 deletions keyauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def __init__(self, name, ownerid, secret, version):
self.version = version

sessionid = enckey = ""
initialized = False

def init(self):

Expand All @@ -60,7 +61,7 @@ def init(self):

response = encryption.decrypt(response, self.secret, init_iv)
json = jsond.loads(response)

if json["message"] == "invalidver":
if json["download"] != "":
print("New Version Available")
Expand All @@ -76,8 +77,12 @@ def init(self):
sys.exit()

self.sessionid = json["sessionid"]
self.initialized = True



def register(self, user, password, license, hwid=None):
self.checkinit()
if hwid is None:
hwid = others.get_hwid()

Expand Down Expand Up @@ -108,7 +113,7 @@ def register(self, user, password, license, hwid=None):
sys.exit()

def upgrade(self, user, license):

self.checkinit()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()

post_data = {
Expand All @@ -134,6 +139,7 @@ def upgrade(self, user, license):
sys.exit()

def login(self, user, password, hwid=None):
self.checkinit()
if hwid is None:
hwid = others.get_hwid()

Expand Down Expand Up @@ -164,6 +170,7 @@ def login(self, user, password, hwid=None):
sys.exit()

def license(self, key, hwid=None):
self.checkinit()
if hwid is None:
hwid = others.get_hwid()

Expand Down Expand Up @@ -192,7 +199,7 @@ def license(self, key, hwid=None):
sys.exit()

def var(self, name):

self.checkinit()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()

post_data = {
Expand All @@ -217,51 +224,100 @@ def var(self, name):
time.sleep(5)
sys.exit()

def file(self, fileid):

def getvar(self, var_name):
self.checkinit()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()

post_data = {
"type": binascii.hexlify(("file").encode()),
"fileid": encryption.encrypt(fileid, self.enckey, init_iv),
"type": binascii.hexlify(("getvar").encode()),
"var": encryption.encrypt(var_name, self.enckey, init_iv),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}

response = self.__do_request(post_data)

response = encryption.decrypt(response, self.enckey, init_iv)

json = jsond.loads(response)

if not json["success"]:
if json["success"]:
return json["response"]
else:
print(json["message"])
time.sleep(5)
sys.exit()
return binascii.unhexlify(json["contents"])

def check(self):

def setvar(self, var_name, var_data):
self.checkinit()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
post_data = {
"type": binascii.hexlify(("check").encode()),
"type": binascii.hexlify(("setvar").encode()),
"var": encryption.encrypt(var_name, self.enckey, init_iv),
"data": encryption.encrypt(var_data, self.enckey, init_iv),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}
response = self.__do_request(post_data)
response = encryption.decrypt(response, self.enckey, init_iv)
json = jsond.loads(response)

if json["success"]:
return True
else:
print(json["message"])
time.sleep(5)
sys.exit()

def ban(self):
self.checkinit()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
post_data = {
"type": binascii.hexlify(("ban").encode()),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}
response = self.__do_request(post_data)
response = encryption.decrypt(response, self.enckey, init_iv)
json = jsond.loads(response)

if json["success"]:
return True
else:
return False
print(json["message"])
time.sleep(5)
sys.exit()

def webhook(self, webid, param):
def file(self, fileid):
self.checkinit()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()

post_data = {
"type": binascii.hexlify(("file").encode()),
"fileid": encryption.encrypt(fileid, self.enckey, init_iv),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}

response = self.__do_request(post_data)

response = encryption.decrypt(response, self.enckey, init_iv)

json = jsond.loads(response)

if not json["success"]:
print(json["message"])
time.sleep(5)
sys.exit()
return binascii.unhexlify(json["contents"])

def webhook(self, webid, param):
self.checkinit()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()

post_data = {
Expand All @@ -286,8 +342,48 @@ def webhook(self, webid, param):
time.sleep(5)
sys.exit()

def log(self, message):
def check(self):
self.checkinit()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
post_data = {
"type": binascii.hexlify(("check").encode()),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}
response = self.__do_request(post_data)

response = encryption.decrypt(response, self.enckey, init_iv)
json = jsond.loads(response)
if json["success"]:
return True
else:
return False

def checkblacklist(self):
self.checkinit()
hwid = others.get_hwid()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
post_data = {
"type": binascii.hexlify(("checkblacklist").encode()),
"hwid": encryption.encrypt(hwid, self.enckey, init_iv),
"sessionid": binascii.hexlify(self.sessionid.encode()),
"name": binascii.hexlify(self.name.encode()),
"ownerid": binascii.hexlify(self.ownerid.encode()),
"init_iv": init_iv
}
response = self.__do_request(post_data)

response = encryption.decrypt(response, self.enckey, init_iv)
json = jsond.loads(response)
if json["success"]:
return True
else:
return False

def log(self, message):
self.checkinit()
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()

post_data = {
Expand All @@ -302,6 +398,11 @@ def log(self, message):

self.__do_request(post_data)

def checkinit(self):
if not self.initialized:
print("Initialize first, in order to use the functions")
sys.exit()

def __do_request(self, post_data):

rq_out = requests.post(
Expand All @@ -326,6 +427,7 @@ def __load_user_data(self, data):
self.user_data.subcription = data["subscriptions"][0]["subscription"]



class others:
@staticmethod
def get_hwid():
Expand Down