-
-
Save morcefaster/96362410225af42ad10a4679686b01ce to your computer and use it in GitHub Desktop.
AFK gift code redemption
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import requests | |
game = 'afk' | |
#Hardcode your Username here or use as an inputline. | |
#user_id = 12345678 | |
user_id = input("Whats your user ID?\n") | |
auth_code = input("Whats your verification Code?\n") | |
def redeem_gitfcode(user_id, auth_code, gift_code, game): | |
auth_data, auth_cookie = authentificate(user_id, auth_code, game) | |
l_p_cdkey_game = auth_cookie.get('l_p_cdkey_game') | |
l_p_cdkey_game_sig = auth_cookie.get('l_p_cdkey_game.sig') | |
l_p_cdkey_tk_afk = auth_cookie.get('l_p_cdkey_tk_afk') | |
l_p_cdkey_tk_afk_sig = auth_cookie.get('l_p_cdkey_tk_afk.sig') | |
l_p_uid_afk = auth_cookie.get('l_p_uid_afk') | |
l_p_uid_afk_sig = auth_cookie.get('l_p_uid_afk.sig') | |
cookie = { | |
"l_p_cdkey_game": l_p_cdkey_game, | |
"l_p_cdkey_game.sig": l_p_cdkey_game_sig, | |
"l_p_cdkey_tk_afk": l_p_cdkey_tk_afk, | |
"l_p_cdkey_tk_afk.sig": l_p_cdkey_tk_afk_sig, | |
"l_p_uid_afk": l_p_uid_afk, | |
"l_p_uid_afk.sig": l_p_uid_afk_sig | |
} | |
users_data = fetch_users(user_id, game, cookie) | |
for i in users_data['data']['users']: | |
use_giftcode(gift_code, game, i['uid'], cookie) | |
return 'Finish!' | |
def authentificate(user_id, auth_code, game): | |
payload = { | |
'code': auth_code, | |
'game': game, | |
'uid': user_id, | |
} | |
url = 'https://cdkey.lilith.com/api/verify-afk-code' | |
response = requests.post(url, json=payload) | |
if response.status_code >= 400: | |
sys.exit('Something went wrong!') | |
data = response.json() | |
if data['info'] == 'err_wrong_code': | |
return sys.exit('Wrong Auth Code!') | |
return data, response.cookies | |
def fetch_users(user_id, game, cookie): | |
payload = { | |
'game': game, | |
'uid': user_id, | |
} | |
url = 'https://cdkey.lilith.com/api/users' | |
response = requests.post(url, json=payload, cookies=cookie) | |
if response.status_code >= 400: | |
sys.exit('Something went wrong!') | |
data = response.json() | |
return data | |
def use_giftcode(gift_code, game, user_id, cookie): | |
payload = { | |
'cdkey': gift_code, | |
'game': game, | |
'type': 'cdkey_web', | |
'uid': int(user_id), | |
} | |
url = 'https://cdkey.lilith.com/api/cd-key/consume' | |
response = requests.post(url, json=payload, cookies=cookie) | |
if response.status_code >= 400: | |
sys.exit('Something went wrong!') | |
data = response.json() | |
if data['info'] == 'err_cdkey_batch_error': | |
return print(f'⚠ This code is already used for user ID: {user_id}!') | |
if data['info'] == 'err_cdkey_record_not_found': | |
return exit(f'⚠ Code is incorrect!') | |
if data['info'] == 'err_cdkey_expired': | |
return exit(f'⚠ Code is expired!') | |
print(data) | |
return data | |
codes = ['PrinceOfPersia', 'Afk888', 'Xiaban886', 'misevj66yi', '311j4hw00d', 'badlijey666', '101nc107h', 'uf4shqjngq', 'ch3atc0de', 'xmasl00t', 'd14m0nd5', 'd39rqrbdcr', 'ck4kjutz6k', 'aaz27uvgfi'] | |
for code in codes: | |
print(redeem_gitfcode(user_id, auth_code, code, game)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment