from sanic import Sanic import sanic import asyncio import json import requests import os import shutil import aiohttp import random app = Sanic("backend") ini = "ini" async def task(): await asyncio.sleep(7200) RefreshCosmetics() app.add_task(task()) async def idget(ip: str): get = open("idget.json", encoding='utf8') thing = json.load(get) return thing.get(ip, '0') @app.route("/id/") async def id33(request, epicid:str): ip = request.ip Def = open("idget.json", encoding='utf8') f = json.load(Def) f.update({ip: epicid}) v = open("idget.json", 'w') v.write(json.dumps(f)) return sanic.response.json({"lol": "lol"}) @app.route("/id//") async def idepicid(request, epicid:str, ip:str): Def = open("idget.json", encoding='utf8') f = json.load(Def) f.update({ip: epicid}) v = open("idget.json", 'w') v.write(json.dumps(f)) return sanic.response.json({"lol": "lol"}) @app.route("/id/get/") async def idgete(request, ip:str): Def = open("idget.json", encoding='utf8') f = json.load(Def) return sanic.response.text(f.get(ip, '0')) @app.route("/editbg/background/") async def editbg(request, epicid:str): if 'newimg' in request.headers: newimg = request.headers.get('newimg') Def = open("bg.json", encoding='utf8') f = json.load(Def) f.update({epicid: newimg}) v = open("bg.json", 'w') v.write(json.dumps(f)) else: Def = open("bg.json", encoding='utf8') f = json.load(Def) del f[epicid] v = open("bg.json", 'w') v.write(json.dumps(f)) return sanic.response.json({"lol": "lol"}) @app.route("/cloudstorage/replace//") async def inireplac(request, epicid, inii): olddata=request.headers['olddata'] newdata=request.headers['newdata'] newdata=newdata.replace("newLine", "\n") #print(olddata, newdata, sep='\n') if os.path.exists("custom_ini/" + epicid) == False: os.makedirs("custom_ini/" + epicid) shutil.copyfile(f"ini/DefaultGame.ini", f"custom_ini/{epicid}/DefaultGame.ini") shutil.copyfile(f"ini/DefaultEngine.ini", f"custom_ini/{epicid}/DefaultEngine.ini") shutil.copyfile(f"ini/DefaultRuntimeOptions.ini", f"custom_ini/{epicid}/DefaultRuntimeOptions.ini") f = open(f"custom_ini/{epicid}/{inii}", encoding='utf8') f.seek(0) print(f.tell()) k = f.read() #print(k) k=k.replace(olddata, newdata) j = open(f"custom_ini/{epicid}/{inii}",'w', encoding='utf8') j.write(k) return sanic.response.raw(k) @app.route("/shop/replace/") async def resshop(request, epicid): olddata=request.headers['olddata'] newdata=request.headers['newdata'] #print(olddata, newdata, sep='\n') if os.path.exists("shops/" + epicid) == False: os.makedirs("shops/" + epicid) shutil.copyfile(f"json/shop.json", f"shops/{epicid}/shop.json") f = open(f"shops/{epicid}/shop.json", encoding='utf8') f.seek(0) #print(f.tell()) k = f.read() #print(k) k=k.replace(olddata, newdata) j = open(f"shops/{epicid}/shop.json",'w', encoding='utf8') j.write(k) return sanic.response.raw(k) @app.route("/cloudstorage/reset/") async def rescldstg(request, epicid): if os.path.exists("custom_ini/" + epicid) == False: os.makedirs("custom_ini/" + epicid) shutil.rmtree("custom_ini/" + epicid) return sanic.response.raw('Done') @app.route("/cloudstorage/del-all//") async def delallce(request, epicid, Inii): if os.path.exists("custom_ini/" + epicid) == False: os.makedirs("custom_ini/" + epicid) f =open("custom_ini/" + epicid + "/" + Inii, 'w') f.write('') return sanic.response.raw('Done') @app.route("/cloudstorage/status/remove/") async def remcrl(request, epicid): if os.path.exists("custom_ini/" + epicid) == False: os.makedirs("custom_ini/" + epicid) f =open("custom_ini/" + epicid + "/DefaultGame.ini", encoding='utf8') g = f.readlines() o = 0 for i in g: if "Battle Royale Lobby" in i: g[o] = '' o+=1 v = open("custom_ini/" + epicid + "/DefaultGame.ini", 'w', encoding='utf8') v.writelines(g) return sanic.response.raw('Done') @app.route("/shop/reset/") async def test1(request, epicid): if os.path.exists("shops/" + epicid) == False: os.makedirs("shops/" + epicid) shutil.rmtree("shops/" + epicid) return sanic.response.raw('Done') @app.route('/fortnite/api/cloudstorage/system') async def cldstrg(request): return sanic.response.json(json.load(open("json/cloudstorage.json", encoding='utf8'))) @app.route('/fortnite/api/cloudstorage/system/') async def storge(request, file: str): headerz = request.headers build = 23.50 idd = await idget(request.ip) try: build = float(headerz['User-Agent'].split('-')[1]) except: pass if build <= 13.40: ini = 'old_ini' elif os.path.exists("custom_ini/" + idd): ini = 'custom_ini/' + idd else: ini = 'ini' if file != "config": return sanic.response.raw(open(f"{ini}/" + file, encoding='utf8').read()) else: return sanic.response.json('') @app.route('/content/api/pages/fortnite-game') async def fngame(request): r = json.load(open("json/fngame.json", encoding='utf8')) headerz = request.headers build = float(headerz['User-Agent'].split('-')[1]) bgs = json.load(open("bg.json")) ip = request.ip bg = bgs.get(await idget(str(ip)), r['dynamicbackgrounds']['backgrounds']['backgrounds'][0]['backgroundimage']) if build == 13.40: r['dynamicbackgrounds']['backgrounds']['backgrounds'][0]['stage'] = 'season13' else: r['dynamicbackgrounds']['backgrounds']['backgrounds'][0]['stage'] = 'season2300' r['dynamicbackgrounds']['backgrounds']['backgrounds'][0]['backgroundimage'] = bg return sanic.response.json(r) @app.route('/content/api/pages') async def pages(request): r = json.load(open("json/fngame.json", encoding='utf8')) return sanic.response.json(r) @app.route('/fortnite/api/storefront/v2/catalog') async def shop(request): idd = await idget(request.ip) if os.path.exists("shops/" + idd): return sanic.response.json(json.load(open("shops/" + idd + "/shop.json"))) r = json.load(open("json/shop.json")) return sanic.response.json(r) @app.route('/api/v1/fortnite-br/surfaces/motd/target', methods=['GET', 'POST']) async def news(request): #r = json.load(open("json/motd.json", encoding='utf8')) return sanic.response.text('''{ "contentType": "collection", "contentId": "motd-default-collection", "tcId": "cca20b46-eb7d-4852-94b9-8479ddb53b2d", "contentItems": [ { "contentType": "content-item", "contentId": "753b2fed-a492-4e11-a34f-9741cc739d47", "tcId": "9b89584d-0711-4269-980d-09d50d04f857", "contentFields": { "body": "Discord Server - https://discord.gg/fndev", "entryType": "Text", "image": [ { "width": 1920, "height": 1080, "url": "https://media.discordapp.net/attachments/1050803859452338248/1074010206389932112/70fjL2s1WH4dTV9huCTW2FPLGVZauTrPu8ihpY3Vwool788DwEnbBIB9BLmy3QIsUoL2TKICHARjvkKW6P8fqCPipmQpYW4AAAAASUVORK5CYII.png" }, { "width": 960, "height": 540, "url": "https://media.discordapp.net/attachments/1050803859452338248/1074010206389932112/70fjL2s1WH4dTV9huCTW2FPLGVZauTrPu8ihpY3Vwool788DwEnbBIB9BLmy3QIsUoL2TKICHARjvkKW6P8fqCPipmQpYW4AAAAASUVORK5CYII.png" } ], "tabTitleOverride": "Atomic Hybrid Server", "tileImage": [ { "width": 1024, "height": 512, "url": "https://media.discordapp.net/attachments/1050803859452338248/1074010206389932112/70fjL2s1WH4dTV9huCTW2FPLGVZauTrPu8ihpY3Vwool788DwEnbBIB9BLmy3QIsUoL2TKICHARjvkKW6P8fqCPipmQpYW4AAAAASUVORK5CYII.png" } ], "title": "Atomic Hybrid Server", "websiteButtonText": "Join discord", "websiteURL": "https://discord.gg/fndev", "websiteSKickIntroDo": false }, "contentSchemaName": "MotdWebsiteNews" } ] }''') @app.route('/affiliate/api/public/affiliates/slug/', methods=['GET', 'POST']) async def affia(request, slug: str): r = { 'id': 'kysgay6767kysgay6767kysgay6767ky', 'slug': slug, 'displayName': slug, 'status': 'ACTIVE', 'verified': True } return sanic.response.json(r) @app.route('/fortnite/api/game/v2/br-inventory/account/', methods=['GET', 'POST']) async def brinv(request, accountid: str): r = { "stash": { "globalcash": 6969 } } return sanic.response.json(r) async def LoadSettings(accountid, mode, auth=None): settings = open(f"Account/{accountid}/Config.json") athena = open("Def/athena.json") pchanges = open(f"Account/{accountid}/profileChanges.json") if mode == "athena": f = json.load(athena) r = json.load(settings) athena.close() settings.close() f['profileCommandRevision'] += 1 f['profileRevision'] += 1 f["profileChanges"][0]["profile"]["items"]["loadout1"]["attributes"]["locker_slots_data"]["slots"]["Character"]["items"][0] = r["Character0"] f["profileChanges"][0]["profile"]["items"]["loadout1"]["attributes"]["locker_slots_data"]["slots"]["Backpack"]["items"][0] = r["Backpack0"] f["profileChanges"][0]["profile"]["items"]["loadout1"]["attributes"]["locker_slots_data"]["slots"]["SkyDiveContrail"]["items"][0] = r["Contrail0"] f["profileChanges"][0]["profile"]["items"]["loadout1"]["attributes"]["locker_slots_data"]["slots"]["Dance"]["items"][0] = r["Emote0"] f["profileChanges"][0]["profile"]["items"]["loadout1"]["attributes"]["locker_slots_data"]["slots"]["Dance"]["items"][1] = r["Emote1"] f["profileChanges"][0]["profile"]["items"]["loadout1"]["attributes"]["locker_slots_data"]["slots"]["Dance"]["items"][2] = r["Emote2"] f["profileChanges"][0]["profile"]["items"]["loadout1"]["attributes"]["locker_slots_data"]["slots"]["Dance"]["items"][3] = r["Emote3"] f["profileChanges"][0]["profile"]["items"]["loadout1"]["attributes"]["locker_slots_data"]["slots"]["Dance"]["items"][4] = r["Emote4"] f["profileChanges"][0]["profile"]["items"]["loadout1"]["attributes"]["locker_slots_data"]["slots"]["Dance"]["items"][5] = r["Emote5"] f["profileChanges"][0]["profile"]["items"]["loadout1"]["attributes"]["locker_slots_data"]["slots"]["Glider"]["items"][0] = r["Glider0"] f["profileChanges"][0]["profile"]["items"]["loadout1"]["attributes"]["locker_slots_data"]["slots"]["LoadingScreen"]["items"][0] = r["LoadingScreen0"] f["profileChanges"][0]["profile"]["items"]["loadout1"]["attributes"]["locker_slots_data"]["slots"]["MusicPack"]["items"][0] = r["MusicPack0"] f["profileChanges"][0]["profile"]["items"]["loadout1"]["attributes"]["locker_slots_data"]["slots"]["ItemWrap"]["items"][0] = r["Wrap0"] f["profileChanges"][0]["profile"]["items"]["loadout1"]["attributes"]["locker_slots_data"]["slots"]["ItemWrap"]["items"][1] = r["Wrap1"] f["profileChanges"][0]["profile"]["items"]["loadout1"]["attributes"]["locker_slots_data"]["slots"]["ItemWrap"]["items"][2] = r["Wrap2"] f["profileChanges"][0]["profile"]["items"]["loadout1"]["attributes"]["locker_slots_data"]["slots"]["ItemWrap"]["items"][3] = r["Wrap3"] f["profileChanges"][0]["profile"]["items"]["loadout1"]["attributes"]["locker_slots_data"]["slots"]["ItemWrap"]["items"][4] = r["Wrap4"] f["profileChanges"][0]["profile"]["items"]["loadout1"]["attributes"]["locker_slots_data"]["slots"]["ItemWrap"]["items"][5] = r["Wrap5"] f["profileChanges"][0]["profile"]["items"]["loadout1"]["attributes"]["locker_slots_data"]["slots"]["ItemWrap"]["items"][6] = r["Wrap6"] f["profileChanges"][0]["profile"]["items"]["loadout1"]["attributes"]["locker_slots_data"]["slots"]["Pickaxe"]["items"][0] = r["Pickaxe0"] f["profileChanges"][0]["profile"]["stats"]["attributes"]["level"] = r["Level"] f["profileChanges"][0]["profile"]["stats"]["attributes"]["battlestars"] = r["BattleStars"] f["profileChanges"][0]["profile"]["stats"]["attributes"]["xp"] = r["Xp"] f["profileChanges"][0]["profile"]["stats"]["attributes"]["xp"] = r["Xp"] f["profileChanges"][0]["profile"]["items"]["VictoryCrown_defaultvictorycrown"]['attributes']['victory_crown_account_data']["total_royal_royales_achieved_count"] = r["Crowns"] f['profileChanges'][0]['profile']['items']["loadout1"]['attributes']['locker_slots_data']['slots']['Character']['activeVariants'][0]['variants'] = r['Character_Variants'] f['profileChanges'][0]['profile']['items']["loadout1"]['attributes']['locker_slots_data']['slots']['Backpack']['activeVariants'][0]['variants'] = r['Backpack_Variants'] if r["Removed_Items"] == []: return f else: for i in r['Removed_Items']: del f['profileChanges'][0]['profile']['items'][i] return f elif mode == "pchanges": f = json.load(pchanges) r = json.load(settings) pchanges.close() settings.close() f['profileCommandRevision'] += 1 f['profileRevision'] += 1 f["profileChanges"][0]["attributeValue"]["slots"]["Character"]["items"][0] = r["Character0"] f["profileChanges"][0]["attributeValue"]["slots"]["Backpack"]["items"][0] = r["Backpack0"] f["profileChanges"][0]["attributeValue"]["slots"]["Pickaxe"]["items"][0] = r["Pickaxe0"] f["profileChanges"][0]["attributeValue"]["slots"]["SkyDiveContrail"]["items"][0] = r["Contrail0"] f["profileChanges"][0]["attributeValue"]["slots"]["Dance"]["items"][0] = r["Emote0"] f["profileChanges"][0]["attributeValue"]["slots"]["Dance"]["items"][1] = r["Emote1"] f["profileChanges"][0]["attributeValue"]["slots"]["Dance"]["items"][2] = r["Emote2"] f["profileChanges"][0]["attributeValue"]["slots"]["Dance"]["items"][3] = r["Emote3"] f["profileChanges"][0]["attributeValue"]["slots"]["Dance"]["items"][4] = r["Emote4"] f["profileChanges"][0]["attributeValue"]["slots"]["Dance"]["items"][5] = r["Emote5"] f["profileChanges"][0]["attributeValue"]["slots"]["ItemWrap"]["items"][0] = r["Wrap0"] f["profileChanges"][0]["attributeValue"]["slots"]["ItemWrap"]["items"][1] = r["Wrap1"] f["profileChanges"][0]["attributeValue"]["slots"]["ItemWrap"]["items"][2] = r["Wrap2"] f["profileChanges"][0]["attributeValue"]["slots"]["ItemWrap"]["items"][3] = r["Wrap3"] f["profileChanges"][0]["attributeValue"]["slots"]["ItemWrap"]["items"][4] = r["Wrap4"] f["profileChanges"][0]["attributeValue"]["slots"]["ItemWrap"]["items"][5] = r["Wrap5"] f["profileChanges"][0]["attributeValue"]["slots"]["ItemWrap"]["items"][6] = r["Wrap6"] f["profileChanges"][0]["attributeValue"]["slots"]["MusicPack"]["items"][0] = r["MusicPack0"] f["profileChanges"][0]["attributeValue"]["slots"]["Glider"]["items"][0] = r["Glider0"] f["profileChanges"][0]["attributeValue"]["slots"]["LoadingScreen"]["items"][0] = r["LoadingScreen0"] f['profileChanges'][0]['attributeValue']['slots']["Character"]['activeVariants'][0]['variants'] = r['Character_Variants'] f['profileChanges'][0]['attributeValue']['slots']["Backpack"]['activeVariants'][0]['variants'] = r['Backpack_Variants'] return f elif mode == "common_core": cummon_core = open("Account/" + accountid + "/common_core.json") f = json.load(cummon_core) r = json.load(settings) cummon_core.close() settings.close() f["profileChanges"][0]["profile"]["items"]["Currency"]["quantity"] = r["Vbucks"] return f elif mode == "oldathena": #thx timmie f = json.load(athena) r = json.load(settings) athena.close() settings.close() f["profileChanges"][0]['profile']['stats']['attributes']['favorite_character'] = r['Character0'] f["profileChanges"][0]['profile']['stats']['attributes']['favorite_backpack'] = r['Backpack0'] f["profileChanges"][0]['profile']['stats']['attributes']['favorite_pickaxe'] = r['Pickaxe0'] f["profileChanges"][0]['profile']['stats']['attributes']['favorite_glider'] = r['Glider0'] f["profileChanges"][0]['profile']['stats']['attributes']['favorite_skydivecontrail'] = r['Contrail0'] f["profileChanges"][0]['profile']['stats']['attributes']['favorite_musicpack'] = r['MusicPack0'] f["profileChanges"][0]['profile']['stats']['attributes']['favorite_loadingscreen'] = r['LoadingScreen0'] f["profileChanges"][0]['profile']['stats']['attributes']['favorite_dance'][0] = r['Emote0'] f["profileChanges"][0]['profile']['stats']['attributes']['favorite_dance'][1] = r['Emote1'] f["profileChanges"][0]['profile']['stats']['attributes']['favorite_dance'][2] = r['Emote2'] f["profileChanges"][0]['profile']['stats']['attributes']['favorite_dance'][3] = r['Emote3'] f["profileChanges"][0]['profile']['stats']['attributes']['favorite_dance'][4] = r['Emote4'] f["profileChanges"][0]['profile']['stats']['attributes']['favorite_dance'][5] = r['Emote5'] f["profileChanges"][0]['profile']['stats']['attributes']['favorite_itemwraps'][0] = r['Wrap0'] f["profileChanges"][0]['profile']['stats']['attributes']['favorite_itemwraps'][1] = r['Wrap1'] f["profileChanges"][0]['profile']['stats']['attributes']['favorite_itemwraps'][2] = r['Wrap2'] f["profileChanges"][0]['profile']['stats']['attributes']['favorite_itemwraps'][3] = r['Wrap3'] f["profileChanges"][0]['profile']['stats']['attributes']['favorite_itemwraps'][4] = r['Wrap4'] f["profileChanges"][0]['profile']['stats']['attributes']['favorite_itemwraps'][5] = r['Wrap5'] f["profileChanges"][0]['profile']['stats']['attributes']['favorite_itemwraps'][6] = r['Wrap6'] f["profileChanges"][0]['profile']['items'][r.get("Character0")]['attributes']['variants'] = r['Character_Variants'] f['profileRevision'] = random.randint(1, 99999) return f else: f = json.load(open("Account/" + accountid + "/" + mode + ".json")) return f return async def CheckValidFortId(id): async with aiohttp.request('GET', 'https://fortnite-api.com/v2/stats/br/v2/' +id, headers = {'Content-Type': 'application/json', 'Authorization': '57c14674-da4d-4afe-b0e3-6bef6edbc751' }) as r: if r.status == 200 or r.status == 403: return True elif r.status == 404 and json.loads(await r.text())['error'] == "the requested profile didnt play any match yet": return True return False def RefreshCosmetics(): r = requests.get("https://fortnite-api.com/v2/cosmetics/br/new").json()['data']['items'] athena = open('Def/athena.json') x = json.load(athena) for i in r: variants = [] owned = [] if i['variants'] != None: for u in i['variants'][0]['options']: owned.append(u['tag']) for c in i['variants']: variants.append({ "channel": c['channel'], "active": c['options'][0]['tag'], "owned": owned }) dict = { i['type']['backendValue'] + ":" + i['id']: { "templateId": i['type']['backendValue'] + ":" + i['id'], "attributes":{ "max_level_bonus":0, "level":1, "item_seen":True, "xp":0, "variants":variants, "favorite":False }, "quantity":1 } } f = x['profileChanges'][0]['profile']['items'].get(i['type']['backendValue'] + ":" + i['id']) if f == None: x['profileChanges'][0]['profile']['items'].update(dict) n = open('Def/athena.json', 'w') json.dump(x, n, indent=3) n.close() print ("Added - " + i['type']['backendValue'] + ":" + i['id']) print('Reloaded Cosmetics!') return async def RefreshCosmeticsAsync(): r = requests.get("https://fortnite-api.com/v2/cosmetics/br/new").json()['data']['items'] athena = open('Def/athena.json') x = json.load(athena) for i in r: variants = [] owned = [] if i['variants'] != None: for u in i['variants'][0]['options']: owned.append(u['tag']) for c in i['variants']: variants.append({ "channel": c['channel'], "active": c['options'][0]['tag'], "owned": owned }) dict = { i['type']['backendValue'] + ":" + i['id']: { "templateId": i['type']['backendValue'] + ":" + i['id'], "attributes":{ "max_level_bonus":0, "level":1, "item_seen":True, "xp":0, "variants":variants, "favorite":False }, "quantity":1 } } f = x['profileChanges'][0]['profile']['items'].get(i['type']['backendValue'] + ":" + i['id']) if f == None: x['profileChanges'][0]['profile']['items'].update(dict) n = open('Def/athena.json', 'w') json.dump(x, n, indent=3) n.close() print ("Added - " + i['type']['backendValue'] + ":" + i['id']) print('Reloaded Cosmetics!') return def RefreshCosmeticsBackup(): r = requests.get("https://fortniteapi.io/v2/items/list?lang=en", headers={"Authorization": "b0b1a11e-dcafb389-48781fab-eda1aeb7"}).json()['items'] athena = open('Def/athena.json') x = json.load(athena) for i in r: title = '' match i['type']['id']: case 'outfit': title = 'AthenaCharacter:' + i['id'] case 'emote': title = 'AthenaDance:' + i['id'] case 'backpack': title = 'AthenaBackpack:' + i['id'] case 'pickaxe': title = 'AthenaPickaxe:' + i['id'] case 'glider': title = 'AthenaGlider:' + i['id'] case 'contrail': title = 'AthenaSkyDiveContrail:' + i['id'] case 'music': title = 'AthenaMusicPack:' + i['id'] case 'wrap': title = 'AthenaItemWrap:' + i['id'] case 'loadingscreen': title = 'AthenaLoadingScreen:' + i['id'] variants = [] dict = { title: { "templateId": title, "attributes":{ "max_level_bonus":0, "level":1, "item_seen":True, "xp":0, "variants":variants, "favorite":False }, "quantity":1 } } if x['profileChanges'][0]['profile']['items'].get(title) == None: print("Added - " + title) x['profileChanges'][0]['profile']['items'].update(dict) n = open('Def/athena.json', 'w') json.dump(x, n, indent=3) n.close() print('Reloaded Cosmetics!') return @app.route('/fortnite/api/v2/versioncheck/') async def vercheck(request, version): #await ac_log(request) return sanic.response.json({"type":"NO_UPDATE"}) @app.route('/fortnite/api/game/v2/enabled_features') async def efea(request): #await ac_log(request) return sanic.response.json([]) @app.route('/datarouter/api/v1/public/data') async def datarouter(request): #await ac_log(request) return sanic.response.json({ "errorCode": "errors.com.epicgames.common.not_found", "errorMessage": "Sorry the resource you were trying to find could not be found", "messageVars": [], "numericErrorCode": 150, "originatingService": "fortnite", "intent": "prod-live"}) @app.route('/fortnite/api/calendar/v1/timeline') async def timeline(request): #await ac_log(request) return sanic.response.json([ { "channels":{ "client-events":{ "states":[ { "state":{ "seasonNumber":13, "seasonTemplateId":"AthenaSeason:athenaseason13", "seasonBegin":"0001-06-23T04:00:00Z", "seasonEnd":"9999-07-23T04:00:00Z", "seasonDisplayedEnd":"9999-07-23T04:00:00Z" } } ] } }, "currentTime":"9998-06-23T04:00:00Z" } ]) @app.route('/waitingroom/api/waitingroom') async def waitingroom(request): return sanic.repsonse.text('', status=204) @app.route('/account/api/public/account/') async def accao(request, accountId): accInfo = { "id": accountId, "displayName": "code xivy", "externalAuths": {} } return sanic.response.json(accInfo) @app.route('/fortnite/api/game/v2/profile//client/', methods=["GET", "POST"]) async def vprofile(request, accountId: str, command: str): if not os.path.exists("Account/" + accountId) and await CheckValidFortId(accountId) == True: os.makedirs("Account/" + accountId) for i in os.listdir("Def"): shutil.copyfile(f"Def/{i}", f"Account/{accountId}/{i}") if command == "SetCosmeticLockerSlot": pchanges = json.load(open("Account/" + accountId + "/profileChanges.json")) #pfile = open("Account/" + accountId + "/profileChanges.json", 'r+') settings = open("Account/" + accountId + "/Config.json", "r+") ConfigFile = "Account/" + accountId + "/Config.json" f = json.load(open("Account/" + accountId + "/athena.json", 'r+')) #ff = open("Account/" + accountId + "/athena.json" ,'r+') body = json.loads(request.body)["category"] slot = json.loads(request.body)["itemToSlot"] if "slotIndex" in json.loads(request.body): slotIndex = json.loads(request.body)["slotIndex"] else: slotIndex = 0 jsettings = json.load(settings) if body + "_Variants" in jsettings: jsettings[body + "_Variants"] = json.loads(request.body)['variantUpdates'] if "Dance" in body: body = "Emote" if "SkyDiveContrail" in body: body = "Contrail" if str(slotIndex) == "-1": for k in jsettings: if "Wrap" in k: jsettings[k] = slot dict = jsettings f = open(ConfigFile, 'w+') f.write(json.dumps(dict)) f.close() return sanic.response.json(await LoadSettings(accountId, "pchanges")) jsettings[body + str(slotIndex)] = slot dict = jsettings f = open(ConfigFile, 'w+') f.write(json.dumps(dict)) f.close() return sanic.response.json(await LoadSettings(accountId, "pchanges")) elif command == "QueryProfile": body = request.args["profileId"][0] if body == "athena": return sanic.response.json(await LoadSettings(accountId, "athena")) elif body == "common_core": return sanic.response.json(await LoadSettings(accountId, "common_core")) print(body) else: f=await LoadSettings(accountId, request.args["profileId"][0]) #f = requests.post("https://fngw-mcp-gc-livefn.ol.epicgames.com/fortnite/api/game/v2/profile/" + accountId + "/client/QueryProfile?profileId=" + body, headers={"Content-Type": 'application/json', 'Authorization': request.headers['Authorization']}, json={}) return sanic.response.json(f) elif command == "SetMtxPlatform": return sanic.response.json(await LoadSettings(accountId, "common_core")) elif command == "RemoveGiftBox": cmmncore = open(f"Account/{accountId}/common_core.json") v = json.load(cmmncore) del v['profileChanges'][0]['profile']['items']['gifting'] bh = open(f"Account/{accountId}/common_core.json", 'w') json.dump(v, bh) rvn = random.randint(1, 99999) dct = {"profileRevision": rvn, "profileId": "common_core", "profileChangesBaseRevision": 1, "profileChanges": [{ "changeType": "fullProfileUpdate", "_id": "RANDOM", "profile": { "changeType": "itemRemoved", "itemId": "gifting" } }], "serverTime": "now", "profileCommandRevision": rvn, "responseVersion": 1} return sanic.response.json(dct) elif command == "EquipBattleRoyaleCustomization": settings = open("Account/" + accountId + "/Config.json", "r+") ConfigFile = "Account/" + accountId + "/Config.json" f = json.load(open("Account/" + accountId + "/athena.json", 'r+')) #ff = open("Account/" + accountId + "/athena.json" ,'r+') body = json.loads(request.body)["slotName"] slot = 0 if 'indexWithinSlot' in json.loads(request.body): slot = json.loads(request.body)["indexWithinSlot"] jsettings = json.load(settings) jsettings[body + str(slot)] = json.loads(request.body)['itemToSlot'] k = open(ConfigFile, 'w') k.write(json.dumps(jsettings)) k.close() return sanic.response.json(await LoadSettings(accountId, "oldathena")) else: g=await LoadSettings(accountId, request.args["profileId"][0], request.headers['Authorization']) return sanic.response.json(g) #not by me @app.route('/fortnite/api/matchmaking/session/', methods=['POST', 'GET']) async def msie(request,sid: str): reqbody = request.body reqheader = request.headers paramz = request.args res = requests.get('https://fortnite-public-service-prod11.ol.epicgames.com/fortnite/api/matchmaking/session/'+sid+'', headers=reqheader) resjson = json.loads(res.text) resheaders = res.headers print("serip"+str(resjson)) return sanic.response.json(resjson, headers=resheaders) @app.route('/fortnite/api/matchmaking/session//', methods=['POST', 'GET']) async def msession(request,sid: str,met: str): reqbody = request.body reqheader = request.headers paramz = request.args res = requests.get('https://fortnite-public-service-prod11.ol.epicgames.com/fortnite/api/matchmaking/session/'+sid+'', params=paramz, headers=reqheader) resheaders = res.headers return sanic.response.json(json.loads(res.text), headers=resheaders) @app.route('/fortnite/api/game/v2/matchmakingservice/ticket/player//', methods=['POST', 'GET']) async def mservice(request,sid: str): reqbody = request.body reqheader = request.headers request.args['player.platform'] = 'Android' paramz = request.args res = requests.get('https://fortnite-public-service-prod11.ol.epicgames.com/fortnite/api/game/v2/matchmakingservice/ticket/player/'+sid+'', params=paramz, headers=reqheader) resjson = json.loads(res.text) resheaders = res.headers return sanic.response.text(res.text, headers=resheaders) # @app.route('/stats///') async def stats(request, stat: str, accountid: str, amount: int): f = json.load(open('Account/' + accountid + "/Config.json")) if stat == 'battlestars': f['BattleStars'] = amount else: f[stat.capitalize()] = amount g = open ('Account/' + accountid + "/Config.json", 'w') g.write(json.dumps(f)) return sanic.response.json(f) @app.route('/locker///') async def locker(request, action: str, accountid: str, idd: str): f = json.load(open('Account/' + accountid + "/Config.json")) if action == 'remove': f['Removed_Items'].append(idd) elif action == "add": try: f["Removed_Items"].remove(idd) except: pass elif action == "clear": n = open("Def/athena.json") b = json.load(n) f['Removed_Items'] = [] for i in b['profileChanges'][0]['profile']['items'].copy().keys(): if i.startswith("Athena"): f["Removed_Items"].append(i) elif action == "reset": f["Removed_Items"] = [] g = open ('Account/' + accountid + "/Config.json", 'w') g.write(json.dumps(f)) return sanic.response.json(f) Gifting = {"gifting": { "templateId": "GiftBox:GB_Default", "attributes": { "max_level_bonus": 0, "fromAccountId": "", "lootList": [ { "itemType": "AthenaBattleBus:BBID_BirthdayBus2nd", "itemGuid": "AthenaBattleBus:BBID_BirthdayBus2nd", "itemProfile": "athena", "quantity": 1 } ] } } } @app.route("/refreshcosmetics") async def refersh(request): await RefreshCosmeticsAsync() return sanic.response.json({"lol": "Refreshed Cosmetics!"}) @app.route('/gifting/seperate///') async def spegift(request, idd: str, accountid: str, giftbox: str): shutil.copyfile("Def/common_core.json", "Account/" + accountid + "/common_core.json") c = idd.split(":") r=requests.get('http://81.0.246.125:3052/gifting/' + accountid + "/" + c[1] + "/" + giftbox + "/" + c[0]) rr=requests.post(f'http://81.0.246.125:3052/fortnite/api/game/v2/profile/' + accountid + "/client/QueryProfile?profileId=common_core") """f = json.load(open("Account/" + accountid + "/common_core.json")) f['profileChanges'][0]['profile']['items']['gifting']['templateId'] = "AthenaGiftBox:" + giftbox f['profileChanges'][0]['profile']['items']['gifting']['attributes']['lootList'][0]['itemType'] = idd f['profileChanges'][0]['profile']['items']['gifting']['attributes']['lootList'][0]['itemGuid'] = idd f['profileChanges'][0]['profile']['items']['gifting']['attributes']['lootList'][0]['itemProfile'] = 'athena'""" g = open('Account/' + accountid + "/common_core.json", 'w') g.write(rr.text) return sanic.response.json(rr.json()) @app.route('/gifting/vbucks///') async def gift(request, amount: str, accountid: str, giftbox: str): shutil.copyfile("Def/common_core.json", "Account/" + accountid + "/common_core.json") r=requests.get('http://81.0.246.125:3052/giftvbucks/' + accountid + "/" + giftbox + "/" + amount) rr=requests.post(f'http://81.0.246.125:3052/fortnite/api/game/v2/profile/' + accountid + "/client/QueryProfile?profileId=common_core") """f = json.load(open("Account/" + accountid + "/common_core.json")) f['profileChanges'][0]['profile']['items']['gifting']['templateId'] = "AthenaGiftBox:" + giftbox f['profileChanges'][0]['profile']['items']['gifting']['attributes']['lootList'][0]['itemType'] = "Currency:MtxPurchased" f['profileChanges'][0]['profile']['items']['gifting']['attributes']['lootList'][0]['itemGuid'] = "Currency:MtxPurchased" f['profileChanges'][0]['profile']['items']['gifting']['attributes']['lootList'][0]['itemProfile'] = 'common_core' f['profileChanges'][0]['profile']['items']['gifting']['attributes']['lootList'][0]['quantity'] = int(amount)""" g = open('Account/' + accountid + "/common_core.json", 'w') g.write(rr.text) return sanic.response.json(rr.json()) @app.route('/gifting/all///') async def giftall(request, accountid: str, typee: str, giftbox: str): shutil.copyfile("Def/common_core.json", "Account/" + accountid + "/common_core.json") r=requests.get('http://81.0.246.125:3052/giftall/' + accountid + "/" + giftbox + "/" + typee) rr=requests.post(f'http://81.0.246.125:3052/fortnite/api/game/v2/profile/' + accountid + "/client/QueryProfile?profileId=common_core") """f = json.load(open("Account/" + accountid + "/common_core.json")) h = json.load(open('Def/athena.json', encoding='utf8'))['profileChanges'][0]['profile']['items'] bh = 0 amount =1 for i in h: if typee in i: f['profileChanges'][0]['profile']['items']['gifting']['templateId'] = "AthenaGiftBox:" + giftbox f['profileChanges'][0]['profile']['items']['gifting']['attributes']['lootList'][bh]['itemType'] = i f['profileChanges'][0]['profile']['items']['gifting']['attributes']['lootList'][bh]['itemGuid'] = i f['profileChanges'][0]['profile']['items']['gifting']['attributes']['lootList'][bh]['itemProfile'] = 'athena' f['profileChanges'][0]['profile']['items']['gifting']['attributes']['lootList'][bh]['quantity'] = 1 f['profileChanges'][0]['profile']['items']['gifting']['attributes']['lootList'].append({ "itemType": "", "itemGuid": "", "itemProfile": "athena", "quantity": 1 }) bh += 1""" g = open('Account/' + accountid + "/common_core.json", 'w') g.write(rr.text) return sanic.response.json(rr.json()) @app.route('/') async def test(request): o = 0 for i in os.listdir('Account'): o += 1 return sanic.response.text("atomicv4 has " + str(o) + " users!") RefreshCosmetics() if __name__ == "__main__": app.run(host="0.0.0.0", port=8000, access_log=True)