Hygcgggnngff

dsfsffsdf

Jun 18th, 2025
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.56 KB | None | 0 0
  1. import requests
  2. import random
  3. from flask import Flask, jsonify, request
  4. import json
  5. import os
  6. import base64
  7.  
  8. class GameInfo:
  9. def __init__(self):
  10. self.TitleId: str = "F64F5" # Playfab Title Id
  11. self.SecretKey: str = "7CIMF9AE97OHWGETAAAIE9B8BZJF17YC6QQNOMDU6HN1NMXJ6S" # Playfab Secret Key
  12. self.ApiKey: str = "OC|9683363235034046|077b918c13461da19816a9c6708b0e48" # App Api Key
  13.  
  14. def get_auth_headers(self):
  15. return {"content-type": "application/json", "X-SecretKey": self.SecretKey}
  16.  
  17.  
  18. settings = GameInfo()
  19. app = Flask(__name__)
  20.  
  21. def ReturnFunctionJson(data, funcname, funcparam={}):
  22. rjson = data["FunctionParameter"]
  23. userId: str = rjson.get("CallerEntityProfile").get("Lineage").get(
  24. "TitlePlayerAccountId")
  25.  
  26. req = requests.post(
  27. url=f"https://{settings.TitleId}.playfabapi.com/Server/ExecuteCloudScript",
  28. json={
  29. "PlayFabId": userId,
  30. "FunctionName": funcname,
  31. "FunctionParameter": funcparam
  32. },
  33. headers=settings.GetAuthHeaders())
  34.  
  35. if req.status_code == 200:
  36. return jsonify(
  37. req.json().get("data").get("FunctionResult")), req.status_code
  38. else:
  39. return jsonify({}), req.status_code
  40.  
  41.  
  42. def GetIsNonceValid(nonce: str, oculusId: str):
  43. req = requests.post(
  44. url=f'https://graph.oculus.com/user_nonce_validate?nonce=' + nonce +
  45. '&user_id=' + oculusId + '&access_token=' + settings.ApiKey,
  46. headers={"content-type": "application/json"})
  47. return req.json().get("is_valid")
  48.  
  49.  
  50. @app.route("/", methods=["GET", "POST"])
  51. def TitleData():
  52. return jsonify({
  53. "MOTD": "<color=red>WELCOME</color> <color=green>TO</color> <color=red>T</color><color=orange>A</color><color=yellow>C</color><color=green>T</color><color=blue>I</color><color=blue>C</color><color=purple>A</color><color=white>L</color><color=purple></color> <color=black>TAG</color>\n<color=red>DISCORD.GG/TACTICALTAG</color>\n<color=white>UPDATE IS LATEST PRIDE JAM</color>\n\n<color=red>CREDITS: METRO THE DEV</color>\n<color=white>OWNERS ARE LEMMING,METRO,LAGGY</color>\n<color=blue>IF THIS GAME IN IN PROP HUNT UPDATE LATEST COSMETICS HAVE BEEN RESET ONLY TO USE UPDATE COSMETICS WE WILL ONLY GIVE ALL COSMETICS IF WE GET A WORKING SERVER SIDED for the fix.</color>\n<color=red> LAGGY # LEMMINGS GF \n</color>",
  54. "TOBDefCompTxt": "PLEASE SELECT A PACK TO TRY ON AND BUY",
  55. "TOBDefPurchaseBtnDefTxt": "SELECT A PACK",
  56. "TOBSafeCompTxt": "PURCHASE ITEMS IN YOUR CART AT THE CHECKOUT COUNTER",
  57. "TOBAlreadyOwnCompTxt": "YOU OWN THE BUNDLE ALREADY! THANK YOU!",
  58. "TOBAlreadyOwnPurchaseBtnTxt": "-",
  59. "BundleBoardSafeAccountSign": "DISCORD.GG/TACTICALTAG",
  60. "BundleBoardSign_SafeAccount": "DISCORD.GG/TACTICALTAG",
  61. "BundleBoardSign": "DISCORD.GG/TACTICALTAG",
  62. "BundleKioskButton": "ts doesnt exist anymore",
  63. "BundleKioskSign": "DISCORD.GG/TACTICALTAG",
  64. "BundleLargeSign": "DISCORD.GG/TACTICALTAG",
  65. "SeasonalStoreBoardSign": "DISCORD.GG/TACTICALTAG",
  66. "VStumpMOTD": "THERE HAS BEEN NEW MAPS IN VIRTUAL STUMP! (WHATEVER THE MAPS ARE HERE)",
  67. "VStumpDiscord": "DISCORD.GG/TACTICALTAG",
  68. "VStumpFeaturedMaps": "4623240,4602591,4409834,4540963",
  69. "AllowedClientVersions": "1.1.99",
  70. "ArenaForestSign": "^\nTO THE\nMAGMARENA!",
  71. "ArenaRulesSign": "RULES:\n\n+CAN'T RUN WITH THE BALL\n\n+CAN'T GRAB THE BALL WHEN IT'S THE OTHER TEAM'S COLOR\n\n+BALL COLOR CHANGES FOR A FEW SECONDS WHEN DROPPED\n\n+SCORE BY HOLDING THE BALL IN THE OTHER TEAM'S GOAL\n\n\nRESTARTING THE GAME:\n\nDROP THE BALL INTO THE START SLOT, THEN THE OTHER TEAM MUST PRESS START GAME",
  72. "AnnouncementData": {
  73. "ShowAnnouncement": "false",
  74. "AnnouncementID": "kID_Prelaunch",
  75. "AnnouncementTitle": "IMPORTANT NEWS",
  76. "Message": "We're working to make Gorilla Tag a better, more age-appropriate experience in our next update. To learn more, please check out our Discord."
  77. },
  78. "UseLegacyIAP": "False",
  79. "CreditsData": '[{"Title":"DEV TEAM/OWNERS","Entries":["METRO","LEMMING","anotheraxiom","electronicwall"]}]'
  80. })
  81.  
  82. @app.route("/api/PlayFabAuthentication", methods=["POST"])
  83. def playfab_authentication():
  84. rjson = request.get_json()
  85. required_fields = ["Nonce", "AppId", "Platform", "OculusId"]
  86. missing_fields = [field for field in required_fields if not rjson.get(field)]
  87.  
  88. if missing_fields:
  89. return (
  90. jsonify(
  91. {
  92. "Message": f"Missing parameter(s): {', '.join(missing_fields)}",
  93. "Error": f"BadRequest-No{missing_fields[0]}",
  94. }
  95. ),
  96. 401,
  97. )
  98.  
  99. if rjson.get("AppId") != settings.TitleId:
  100. return (
  101. jsonify(
  102. {
  103. "Message": "Request sent for the wrong App ID",
  104. "Error": "BadRequest-AppIdMismatch",
  105. }
  106. ),
  107. 400,
  108. )
  109.  
  110. url = f"https://{settings.TitleId}.playfabapi.com/Server/LoginWithServerCustomId"
  111. login_request = requests.post(
  112. url=url,
  113. json={
  114. "ServerCustomId": "OCULUS" + rjson.get("OculusId"),
  115. "CreateAccount": True,
  116. },
  117. headers=settings.get_auth_headers(),
  118. )
  119.  
  120. if login_request.status_code == 200:
  121. data = login_request.json().get("data")
  122. session_ticket = data.get("SessionTicket")
  123. entity_token = data.get("EntityToken").get("EntityToken")
  124. playfab_id = data.get("PlayFabId")
  125. entity_type = data.get("EntityToken").get("Entity").get("Type")
  126. entity_id = data.get("EntityToken").get("Entity").get("Id")
  127.  
  128. link_response = requests.post(
  129. url=f"https://{settings.TitleId}.playfabapi.com/Server/LinkServerCustomId",
  130. json={
  131. "ForceLink": True,
  132. "PlayFabId": playfab_id,
  133. "ServerCustomId": rjson.get("CustomId"),
  134. },
  135. headers=settings.get_auth_headers(),
  136. ).json()
  137.  
  138. return (
  139. jsonify(
  140. {
  141. "PlayFabId": playfab_id,
  142. "SessionTicket": session_ticket,
  143. "EntityToken": entity_token,
  144. "EntityId": entity_id,
  145. "EntityType": entity_type,
  146. }
  147. ),
  148. 200,
  149. )
  150. else:
  151. if login_request.status_code == 403:
  152. ban_info = login_request.json()
  153. if ban_info.get("errorCode") == 1002:
  154. ban_message = ban_info.get("errorMessage", "No ban message provided.")
  155. ban_details = ban_info.get("errorDetails", {})
  156. ban_expiration_key = next(iter(ban_details.keys()), None)
  157. ban_expiration_list = ban_details.get(ban_expiration_key, [])
  158. ban_expiration = (
  159. ban_expiration_list[0]
  160. if len(ban_expiration_list) > 0
  161. else "No expiration date provided."
  162. )
  163. print(ban_info)
  164. return (
  165. jsonify(
  166. {
  167. "BanMessage": ban_expiration_key,
  168. "BanExpirationTime": ban_expiration,
  169. }
  170. ),
  171. 403,
  172. )
  173. else:
  174. error_message = ban_info.get(
  175. "errorMessage", "Forbidden without ban information."
  176. )
  177. return (
  178. jsonify({"Error": "PlayFab Error", "Message": error_message}),
  179. 403,
  180. )
  181. else:
  182. error_info = login_request.json()
  183. error_message = error_info.get("errorMessage", "An error occurred.")
  184. return (
  185. jsonify({"Error": "PlayFab Error", "Message": error_message}),
  186. login_request.status_code,
  187. )
  188.  
  189.  
  190. @app.route("/api/CachePlayFabId", methods=["POST"])
  191. def cache_playfab_id():
  192. return jsonify({"Message": "Success"}), 200
  193.  
  194.  
  195. @app.route("/api/TitleData", methods=["POST", "GET"])
  196. def title_data():
  197. response = requests.post(
  198. url=f"https://{settings.TitleId}.playfabapi.com/Server/GetTitleData",
  199. headers=settings.get_auth_headers()
  200. )
  201.  
  202. if response.status_code == 200:
  203. return jsonify(response.json().get("data").get("Data"))
  204. else:
  205. return jsonify({}), response.status_code
  206.  
  207.  
  208. @app.route("/api/ConsumeOculusIAP", methods=["POST"])
  209. def consume_oculus_iap():
  210. rjson = request.get_json()
  211.  
  212. access_token = rjson.get("userToken")
  213. user_id = rjson.get("userID")
  214. nonce = rjson.get("nonce")
  215. sku = rjson.get("sku")
  216.  
  217. response = requests.post(
  218. url=f"https://graph.oculus.com/consume_entitlement?nonce={nonce}&user_id={user_id}&sku={sku}&access_token={settings.ApiKey}",
  219. headers={"content-type": "application/json"},
  220. )
  221.  
  222. if response.json().get("success"):
  223. return jsonify({"result": True})
  224. else:
  225. return jsonify({"error": True})
  226.  
  227. @app.route("/api/GetAcceptedAgreements", methods=['POST', 'GET'])
  228. def GetAcceptedAgreements():
  229. data = request.json
  230.  
  231. return jsonify({"PrivacyPolicy":"1.1.28","TOS":"11.05.22.2"}), 200
  232.  
  233. @app.route("/api/SubmitAcceptedAgreements", methods=['POST', 'GET'])
  234. def SubmitAcceptedAgreements():
  235. data = request.json
  236.  
  237. return jsonify({}), 200
  238.  
  239. @app.route("/api/ConsumeCodeItem", methods=["POST"])
  240. def consume_code_item():
  241. rjson = request.get_json()
  242. code = rjson.get("itemGUID")
  243. playfab_id = rjson.get("playFabID")
  244. session_ticket = rjson.get("playFabSessionTicket")
  245.  
  246. if not all([code, playfab_id, session_ticket]):
  247. return jsonify({"error": "Missing parameters"}), 400
  248.  
  249. raw_url = f"https://github.com/redapplegtag/backendsfrr" # make a github and put the raw here (Redeemed = not redeemed, u have to add discord webhookss and if your smart you can make it so it auto updates the github url (redeemed is not redeemed, AlreadyRedeemed is already redeemed, then dats it
  250. # code:Redeemed
  251. response = requests.get(raw_url)
  252.  
  253. if response.status_code != 200:
  254. return jsonify({"error": "GitHub fetch failed"}), 500
  255.  
  256. lines = response.text.splitlines()
  257. codes = {split[0].strip(): split[1].strip() for line in lines if (split := line.split(":")) and len(split) == 2}
  258.  
  259. if code not in codes:
  260. return jsonify({"result": "CodeInvalid"}), 404
  261.  
  262. if codes[code] == "AlreadyRedeemed":
  263. return jsonify({"result": codes[code]}), 200
  264.  
  265. grant_response = requests.post(
  266. f"https://{settings.TitleId}.playfabapi.com/Admin/GrantItemsToUsers",
  267. json={
  268. "ItemGrants": [
  269. {
  270. "PlayFabId": playfab_id,
  271. "ItemId": item_id,
  272. "CatalogVersion": "DLC"
  273. } for item_id in ["dis da cosmetics", "anotehr cposmetic", "anotehr"]
  274. ]
  275. },
  276. headers=settings.get_auth_headers()
  277. )
  278.  
  279.  
  280. if grant_response.status_code != 200:
  281. return jsonify({"result": "PlayFabError", "errorMessage": grant_response.json().get("errorMessage", "Grant failed")}), 500
  282.  
  283. new_lines = [f"{split[0].strip()}:AlreadyRedeemed" if split[0].strip() == code else line.strip()
  284. for line in lines if (split := line.split(":")) and len(split) >= 2]
  285.  
  286. updated_content = "\n".join(new_lines).strip()
  287.  
  288. return jsonify({"result": "Success", "itemID": code, "playFabItemName": codes[code]}), 200
  289.  
  290. @app.route('/api/v2/GetName', methods=['POST', 'GET'])
  291. def GetNameIg():
  292. return jsonify({"result": f"GORILLA{random.randint(1000,9999)}"})
  293.  
  294. @app.route("/api/photon", methods=["POST"])
  295. def photonauth():
  296. print(f"Received {request.method} request at /api/photon")
  297. getjson = request.get_json()
  298. Ticket = getjson.get("Ticket")
  299. Nonce = getjson.get("Nonce")
  300. Platform = getjson.get("Platform")
  301. UserId = getjson.get("UserId")
  302. nickName = getjson.get("username")
  303. if request.method.upper() == "GET":
  304. rjson = request.get_json()
  305. print(f"{request.method} : {rjson}")
  306.  
  307. userId = Ticket.split('-')[0] if Ticket else None
  308. print(f"Extracted userId: {UserId}")
  309.  
  310. if userId is None or len(userId) != 16:
  311. print("Invalid userId")
  312. return jsonify({
  313. 'resultCode': 2,
  314. 'message': 'Invalid token',
  315. 'userId': None,
  316. 'nickname': None
  317. })
  318.  
  319. if Platform != 'Quest':
  320. return jsonify({'Error': 'Bad request', 'Message': 'Invalid platform!'}),403
  321.  
  322. if Nonce is None:
  323. return jsonify({'Error': 'Bad request', 'Message': 'Not Authenticated!'}),304
  324.  
  325. req = requests.post(
  326. url=f"https://{settings.TitleId}.playfabapi.com/Server/GetUserAccountInfo",
  327. json={"PlayFabId": userId},
  328. headers={
  329. "content-type": "application/json",
  330. "X-SecretKey": secretkey
  331. })
  332.  
  333. print(f"Request to PlayFab returned status code: {req.status_code}")
  334.  
  335. if req.status_code == 200:
  336. nickName = req.json().get("UserInfo",
  337. {}).get("UserAccountInfo",
  338. {}).get("Username")
  339. if not nickName:
  340. nickName = None
  341.  
  342. print(
  343. f"Authenticated user {userId.lower()} with nickname: {nickName}"
  344. )
  345.  
  346. return jsonify({
  347. 'resultCode': 1,
  348. 'message':
  349. f'Authenticated user {userId.lower()} title {settings.TitleId.lower()}',
  350. 'userId': f'{userId.upper()}',
  351. 'nickname': nickName
  352. })
  353. else:
  354. print("Failed to get user account info from PlayFab")
  355. return jsonify({
  356. 'resultCode': 0,
  357. 'message': "Something went wrong",
  358. 'userId': None,
  359. 'nickname': None
  360. })
  361.  
  362. elif request.method.upper() == "POST":
  363. rjson = request.get_json()
  364. print(f"{request.method} : {rjson}")
  365.  
  366. ticket = rjson.get("Ticket")
  367. userId = ticket.split('-')[0] if ticket else None
  368. print(f"Extracted userId: {userId}")
  369.  
  370. if userId is None or len(userId) != 16:
  371. print("Invalid userId")
  372. return jsonify({
  373. 'resultCode': 2,
  374. 'message': 'Invalid token',
  375. 'userId': None,
  376. 'nickname': None
  377. })
  378.  
  379. req = requests.post(
  380. url=f"https://{settings.TitleId}.playfabapi.com/Server/GetUserAccountInfo",
  381. json={"PlayFabId": userId},
  382. headers={
  383. "content-type": "application/json",
  384. "X-SecretKey": settings.SecretKey
  385. })
  386.  
  387. print(f"Authenticated user {userId.lower()}")
  388. print(f"Request to PlayFab returned status code: {req.status_code}")
  389.  
  390. if req.status_code == 200:
  391. nickName = req.json().get("UserInfo",
  392. {}).get("UserAccountInfo",
  393. {}).get("Username")
  394. if not nickName:
  395. nickName = None
  396. return jsonify({
  397. 'resultCode': 1,
  398. 'message':
  399. f'Authenticated user {userId.lower()} title {settings.TitleId.lower()}',
  400. 'userId': f'{userId.upper()}',
  401. 'nickname': nickName
  402. })
  403. else:
  404. print("Failed to get user account info from PlayFab")
  405. successJson = {
  406. 'resultCode': 0,
  407. 'message': "Something went wrong",
  408. 'userId': None,
  409. 'nickname': None
  410. }
  411. authPostData = {}
  412. for key, value in authPostData.items():
  413. successJson[key] = value
  414. print(f"Returning successJson: {successJson}")
  415. return jsonify(successJson)
  416. else:
  417. print(f"Invalid method: {request.method.upper()}")
  418. return jsonify({
  419. "Message":
  420. "Use a POST or GET Method instead of " + request.method.upper()
  421. })
  422.  
  423.  
  424. def ReturnFunctionJson(data, funcname, funcparam={}):
  425. print(f"Calling function: {funcname} with parameters: {funcparam}")
  426. rjson = data.get("FunctionParameter", {})
  427. userId = rjson.get("CallerEntityProfile",
  428. {}).get("Lineage", {}).get("TitlePlayerAccountId")
  429.  
  430. print(f"UserId: {userId}")
  431.  
  432. req = requests.post(
  433. url=f"https://{settings.TitleId}.playfabapi.com/Server/ExecuteCloudScript",
  434. json={
  435. "PlayFabId": userId,
  436. "FunctionName": funcname,
  437. "FunctionParameter": funcparam
  438. },
  439. headers={
  440. "content-type": "application/json",
  441. "X-SecretKey": secretkey
  442. })
  443.  
  444. if req.status_code == 200:
  445. result = req.json().get("data", {}).get("FunctionResult", {})
  446. print(f"Function result: {result}")
  447. return jsonify(result), req.status_code
  448. else:
  449. print(f"Function execution failed, status code: {req.status_code}")
  450. return jsonify({}), req.status_code
  451.  
  452.  
  453. if __name__ == "__main__":
  454. app.run(host="0.0.0.0", port=9080)
Tags: fsfdfs
Add Comment
Please, Sign In to add comment