# KeyAuth.ru
KeyAuth.ru API Wrapper for Python
## Usage Example
```py
from keyauthru import api
import sys
import time
import platform
import os
import hashlib
from time import sleep
from datetime import datetime
# import json as jsond
def clear():
if platform.system() == 'Windows':
os.system('cls & title Python Example') # clear console, change title
elif platform.system() == 'Linux':
os.system('clear') # clear console
sys.stdout.write("\x1b]0;Python Example\x07") # change title
elif platform.system() == 'Darwin':
os.system("clear && printf '\e[3J'") # clear console
os.system('''echo - n - e "\033]0;Python Example\007"''') # change title
print("Initializing")
def getchecksum():
md5_hash = hashlib.md5()
file = open(''.join(sys.argv), "rb")
md5_hash.update(file.read())
digest = md5_hash.hexdigest()
return digest
keyauthapp = api(
name = "",
ownerid = "",
secret = "",
version = "1.0",
hash_to_check = getchecksum()
)
def answer():
try:
print("""1.Login
2.Register
3.Upgrade
4.License Key Only
""")
ans = input("Select Option: ")
if ans == "1":
user = input('Provide username: ')
password = input('Provide password: ')
keyauthapp.login(user, password)
elif ans == "2":
user = input('Provide username: ')
password = input('Provide password: ')
license = input('Provide License: ')
keyauthapp.register(user, password, license)
elif ans == "3":
user = input('Provide username: ')
license = input('Provide License: ')
keyauthapp.upgrade(user, license)
elif ans == "4":
key = input('Enter your license: ')
keyauthapp.license(key)
else:
print("\nInvalid option")
sleep(1)
clear()
answer()
except KeyboardInterrupt:
os._exit(1)
answer()
'''try:
if os.path.isfile('auth.json'): #Checking if the auth file exist
if jsond.load(open("auth.json"))["authusername"] == "": #Checks if the authusername is empty or not
print("""
1. Login
2. Register
""")
ans=input("Select Option: ") #Skipping auto-login bc auth file is empty
if ans=="1":
user = input('Provide username: ')
password = input('Provide password: ')
keyauthapp.login(user,password)
authfile = jsond.load(open("auth.json"))
authfile["authusername"] = user
authfile["authpassword"] = password
jsond.dump(authfile, open('auth.json', 'w'), sort_keys=False, indent=4)
elif ans=="2":
user = input('Provide username: ')
password = input('Provide password: ')
license = input('Provide License: ')
keyauthapp.register(user,password,license)
authfile = jsond.load(open("auth.json"))
authfile["authusername"] = user
authfile["authpassword"] = password
jsond.dump(authfile, open('auth.json', 'w'), sort_keys=False, indent=4)
else:
print("\nNot Valid Option")
os._exit(1)
else:
try: #2. Auto login
with open('auth.json', 'r') as f:
authfile = jsond.load(f)
authuser = authfile.get('authusername')
authpass = authfile.get('authpassword')
keyauthapp.login(authuser,authpass)
except Exception as e: #Error stuff
print(e)
else: #Creating auth file bc its missing
try:
f = open("auth.json", "a") #Writing content
f.write("""{
"authusername": "",
"authpassword": ""
}""")
f.close()
print ("""
1. Login
2. Register
""")#Again skipping auto-login bc the file is empty/missing
ans=input("Select Option: ")
if ans=="1":
user = input('Provide username: ')
password = input('Provide password: ')
keyauthapp.login(user,password)
authfile = jsond.load(open("auth.json"))
authfile["authusername"] = user
authfile["authpassword"] = password
jsond.dump(authfile, open('auth.json', 'w'), sort_keys=False, indent=4)
elif ans=="2":
user = input('Provide username: ')
password = input('Provide password: ')
license = input('Provide License: ')
keyauthapp.register(user,password,license)
authfile = jsond.load(open("auth.json"))
authfile["authusername"] = user
authfile["authpassword"] = password
jsond.dump(authfile, open('auth.json', 'w'), sort_keys=False, indent=4)
else:
print("\nNot Valid Option")
os._exit(1)
except Exception as e: #Error stuff
print(e)
os._exit(1)
except Exception as e: #Error stuff
print(e)
os._exit(1)'''
print("\nUser data: ")
print("Username: " + keyauthapp.user_data.username)
print("IP address: " + keyauthapp.user_data.ip)
print("Hardware-Id: " + keyauthapp.user_data.hwid)
subs = keyauthapp.user_data.subscriptions # Get all Subscription names, expiry, and timeleft
for i in range(len(subs)):
sub = subs[i]["subscription"] # Subscription from every Sub
expiry = datetime.utcfromtimestamp(int(subs[i]["expiry"])).strftime(
'%Y-%m-%d %H:%M:%S') # Expiry date from every Sub
timeleft = subs[i]["timeleft"] # Timeleft from every Sub
print(f"[{i + 1} / {len(subs)}] | Subscription: {sub} - Expiry: {expiry} - Timeleft: {timeleft}")
print("Created at: " + datetime.utcfromtimestamp(int(keyauthapp.user_data.createdate)).strftime('%Y-%m-%d %H:%M:%S'))
print("Last login at: " + datetime.utcfromtimestamp(int(keyauthapp.user_data.lastlogin)).strftime('%Y-%m-%d %H:%M:%S'))
print("Expires at: " + datetime.utcfromtimestamp(int(keyauthapp.user_data.expires)).strftime('%Y-%m-%d %H:%M:%S'))
print("\nExiting in five seconds..")
sleep(5)
os._exit(1)
```
Raw data
{
"_id": null,
"home_page": "https://gist.github.com/ttwizz/88ded5b95c6b52c65e50196f555b51cd",
"name": "KeyAuth.ru",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "KeyAuth.ru",
"author": "ttwiz_z",
"author_email": "moderkascriptsltd@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/75/ac/8c8d4c63968ab3bf0c5a8534934982e8a357683719539a4333ee9a0c98e6/KeyAuth.ru-1.2.1.tar.gz",
"platform": null,
"description": "# KeyAuth.ru\r\nKeyAuth.ru API Wrapper for Python\r\n\r\n## Usage Example\r\n```py\r\nfrom keyauthru import api\r\n\r\nimport sys\r\nimport time\r\nimport platform\r\nimport os\r\nimport hashlib\r\nfrom time import sleep\r\nfrom datetime import datetime\r\n# import json as jsond\r\n\r\ndef clear():\r\n if platform.system() == 'Windows':\r\n os.system('cls & title Python Example') # clear console, change title\r\n elif platform.system() == 'Linux':\r\n os.system('clear') # clear console\r\n sys.stdout.write(\"\\x1b]0;Python Example\\x07\") # change title\r\n elif platform.system() == 'Darwin':\r\n os.system(\"clear && printf '\\e[3J'\") # clear console\r\n os.system('''echo - n - e \"\\033]0;Python Example\\007\"''') # change title\r\n\r\nprint(\"Initializing\")\r\n\r\ndef getchecksum():\r\n md5_hash = hashlib.md5()\r\n file = open(''.join(sys.argv), \"rb\")\r\n md5_hash.update(file.read())\r\n digest = md5_hash.hexdigest()\r\n return digest\r\n\r\nkeyauthapp = api(\r\n name = \"\",\r\n ownerid = \"\",\r\n secret = \"\",\r\n version = \"1.0\",\r\n hash_to_check = getchecksum()\r\n)\r\n\r\ndef answer():\r\n try:\r\n print(\"\"\"1.Login\r\n2.Register\r\n3.Upgrade\r\n4.License Key Only\r\n \"\"\")\r\n ans = input(\"Select Option: \")\r\n if ans == \"1\":\r\n user = input('Provide username: ')\r\n password = input('Provide password: ')\r\n keyauthapp.login(user, password)\r\n elif ans == \"2\":\r\n user = input('Provide username: ')\r\n password = input('Provide password: ')\r\n license = input('Provide License: ')\r\n keyauthapp.register(user, password, license)\r\n elif ans == \"3\":\r\n user = input('Provide username: ')\r\n license = input('Provide License: ')\r\n keyauthapp.upgrade(user, license)\r\n elif ans == \"4\":\r\n key = input('Enter your license: ')\r\n keyauthapp.license(key)\r\n else:\r\n print(\"\\nInvalid option\")\r\n sleep(1)\r\n clear()\r\n answer()\r\n except KeyboardInterrupt:\r\n os._exit(1)\r\n\r\nanswer()\r\n\r\n'''try:\r\n if os.path.isfile('auth.json'): #Checking if the auth file exist\r\n if jsond.load(open(\"auth.json\"))[\"authusername\"] == \"\": #Checks if the authusername is empty or not\r\n print(\"\"\"\r\n1. Login\r\n2. Register\r\n \"\"\")\r\n ans=input(\"Select Option: \") #Skipping auto-login bc auth file is empty\r\n if ans==\"1\": \r\n user = input('Provide username: ')\r\n password = input('Provide password: ')\r\n keyauthapp.login(user,password)\r\n authfile = jsond.load(open(\"auth.json\"))\r\n authfile[\"authusername\"] = user\r\n authfile[\"authpassword\"] = password\r\n jsond.dump(authfile, open('auth.json', 'w'), sort_keys=False, indent=4)\r\n elif ans==\"2\":\r\n user = input('Provide username: ')\r\n password = input('Provide password: ')\r\n license = input('Provide License: ')\r\n keyauthapp.register(user,password,license) \r\n authfile = jsond.load(open(\"auth.json\"))\r\n authfile[\"authusername\"] = user\r\n authfile[\"authpassword\"] = password\r\n jsond.dump(authfile, open('auth.json', 'w'), sort_keys=False, indent=4)\r\n else:\r\n print(\"\\nNot Valid Option\") \r\n os._exit(1) \r\n else:\r\n try: #2. Auto login\r\n with open('auth.json', 'r') as f:\r\n authfile = jsond.load(f)\r\n authuser = authfile.get('authusername')\r\n authpass = authfile.get('authpassword')\r\n keyauthapp.login(authuser,authpass)\r\n except Exception as e: #Error stuff\r\n print(e)\r\n else: #Creating auth file bc its missing\r\n try:\r\n f = open(\"auth.json\", \"a\") #Writing content\r\n f.write(\"\"\"{\r\n \"authusername\": \"\",\r\n \"authpassword\": \"\"\r\n}\"\"\")\r\n f.close()\r\n print (\"\"\"\r\n1. Login\r\n2. Register\r\n \"\"\")#Again skipping auto-login bc the file is empty/missing\r\n ans=input(\"Select Option: \") \r\n if ans==\"1\": \r\n user = input('Provide username: ')\r\n password = input('Provide password: ')\r\n keyauthapp.login(user,password)\r\n authfile = jsond.load(open(\"auth.json\"))\r\n authfile[\"authusername\"] = user\r\n authfile[\"authpassword\"] = password\r\n jsond.dump(authfile, open('auth.json', 'w'), sort_keys=False, indent=4)\r\n elif ans==\"2\":\r\n user = input('Provide username: ')\r\n password = input('Provide password: ')\r\n license = input('Provide License: ')\r\n keyauthapp.register(user,password,license)\r\n authfile = jsond.load(open(\"auth.json\"))\r\n authfile[\"authusername\"] = user\r\n authfile[\"authpassword\"] = password\r\n jsond.dump(authfile, open('auth.json', 'w'), sort_keys=False, indent=4)\r\n else:\r\n print(\"\\nNot Valid Option\") \r\n os._exit(1) \r\n except Exception as e: #Error stuff\r\n print(e)\r\n os._exit(1) \r\nexcept Exception as e: #Error stuff\r\n print(e)\r\n os._exit(1)'''\r\n\r\nprint(\"\\nUser data: \")\r\nprint(\"Username: \" + keyauthapp.user_data.username)\r\nprint(\"IP address: \" + keyauthapp.user_data.ip)\r\nprint(\"Hardware-Id: \" + keyauthapp.user_data.hwid)\r\n\r\nsubs = keyauthapp.user_data.subscriptions # Get all Subscription names, expiry, and timeleft\r\nfor i in range(len(subs)):\r\n sub = subs[i][\"subscription\"] # Subscription from every Sub\r\n expiry = datetime.utcfromtimestamp(int(subs[i][\"expiry\"])).strftime(\r\n '%Y-%m-%d %H:%M:%S') # Expiry date from every Sub\r\n timeleft = subs[i][\"timeleft\"] # Timeleft from every Sub\r\n\r\n print(f\"[{i + 1} / {len(subs)}] | Subscription: {sub} - Expiry: {expiry} - Timeleft: {timeleft}\")\r\n\r\nprint(\"Created at: \" + datetime.utcfromtimestamp(int(keyauthapp.user_data.createdate)).strftime('%Y-%m-%d %H:%M:%S'))\r\nprint(\"Last login at: \" + datetime.utcfromtimestamp(int(keyauthapp.user_data.lastlogin)).strftime('%Y-%m-%d %H:%M:%S'))\r\nprint(\"Expires at: \" + datetime.utcfromtimestamp(int(keyauthapp.user_data.expires)).strftime('%Y-%m-%d %H:%M:%S'))\r\nprint(\"\\nExiting in five seconds..\")\r\nsleep(5)\r\nos._exit(1)\r\n```\r\n",
"bugtrack_url": null,
"license": "",
"summary": "KeyAuth.ru API Wrapper for Python",
"version": "1.2.1",
"project_urls": {
"Author": "https://github.com/ttwizz",
"Homepage": "https://gist.github.com/ttwizz/88ded5b95c6b52c65e50196f555b51cd",
"Organization": "https://github.com/ModerkaScripts"
},
"split_keywords": [
"keyauth.ru"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "13da232a08bdad10983142e6f652ed065c2f2d78bb2a572285e7436c6242dda9",
"md5": "0d85bb863b7af92ae2b91c4d1b5a7f30",
"sha256": "a1dc71850be95b9ad3d98ce915a360cd5b8ee1f59cc087f5b9571f398b11c808"
},
"downloads": -1,
"filename": "KeyAuth.ru-1.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0d85bb863b7af92ae2b91c4d1b5a7f30",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 7137,
"upload_time": "2023-10-19T15:00:20",
"upload_time_iso_8601": "2023-10-19T15:00:20.995693Z",
"url": "https://files.pythonhosted.org/packages/13/da/232a08bdad10983142e6f652ed065c2f2d78bb2a572285e7436c6242dda9/KeyAuth.ru-1.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "75ac8c8d4c63968ab3bf0c5a8534934982e8a357683719539a4333ee9a0c98e6",
"md5": "5952708d6d6d783987d9ccf64d060cd3",
"sha256": "570f4715b807a9477883dcc752f05ee38d006bd6c99dd5c63e83a0f511561ecd"
},
"downloads": -1,
"filename": "KeyAuth.ru-1.2.1.tar.gz",
"has_sig": false,
"md5_digest": "5952708d6d6d783987d9ccf64d060cd3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 7298,
"upload_time": "2023-10-19T15:00:22",
"upload_time_iso_8601": "2023-10-19T15:00:22.917716Z",
"url": "https://files.pythonhosted.org/packages/75/ac/8c8d4c63968ab3bf0c5a8534934982e8a357683719539a4333ee9a0c98e6/KeyAuth.ru-1.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-19 15:00:22",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "keyauth.ru"
}