Browse Source

full api reverse

master
gsd 3 months ago
parent
commit
ca6cdc7415
  1. 65
      api.py
  2. 2
      index.html
  3. 13
      initcode.local.js
  4. 3
      js/result.js

65
api.py

@ -0,0 +1,65 @@
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from pydantic import BaseModel
import uvicorn
from time import time
app = FastAPI()
main_req = "/apipanda/v2/game/755/tele2-panda-kombat/config"
@app.get(main_req)
async def root():
return {
"canPlay": True,
"serverTime": int(time()),
"errorCode": 0,
"errorMessage": None,
"tryAvailable": 1,
"nextFreeTryAt": int(time()) + 86400
}
@app.options(main_req)
async def opt():
return None
@app.post("/apipanda/v2/game/755/tele2-panda-kombat/game/start")
async def start():
return {"gameSessionId":"1234567890"}
@app.options("/apipanda/v2/game/755/tele2-panda-kombat/game/start")
async def start_opt():
return None
class GameEnd(BaseModel):
gameSessionId: str
duration: int
score: int
@app.post("/apipanda/v2/game/755/tele2-panda-kombat/game/end")
async def end(gameEnd: GameEnd):
return {"win": 1} ## 0 если вебал
@app.options("/apipanda/v2/game/755/tele2-panda-kombat/game/end")
async def end_opt():
return None
origins = [
"http://localhost:5500",
"http://localhost:8000",
"http://127.0.0.1:5500",
"http://127.0.0.1:8000"
]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)

2
index.html

@ -243,4 +243,4 @@
if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.errorHandler && messages.length) {
window.webkit.messageHandlers.errorHandler.postMessage(messages[0]);
}
};</script><script defer="defer" src="./js/result.js"></script><script src="./initcode.local.js"></script></head><body><div id="root"></div><div id="modal-layer"></div></body></html>
};</script><script defer="defer" src="./js/index.04e43cbac50332817385.bundle.js"></script><script src="./initcode.local.js"></script></head><body><div id="root"></div><div id="modal-layer"></div></body></html>

13
initcode.local.js

@ -1,7 +1,16 @@
function run() {
var code = `window.gameReader = (function(){var self = window.gameReader || {};self._e = self._e || [];self.ready = self.ready || function (f) {self._e.push(f);};return self;})();window.gameReader.ready(function(){window.initGame({"gameInstanceId":755,"gameResources":{"fonts":{"InternalPrimaryFontNormalNormal":"swyswxm5x1jvdj6eoupayes7kh.ttf","InternalPrimaryFontBoldNormal":"jy4gofnzg95z4mzh1mfk8dnfqn.ttf"},"assets":[]},"storyId":null,"elementId":null,"projectSlug":"tele2-app","demoMode":false,"projectEnv":"prod","verbose":false,"gameDomain":"https://games.inappstory.com/tele2-panda-kombat/1.0.9/build/","gameSlug":"tele2-panda-kombat","gameVersion":"1.0.9","clientConfig":"{{%sdkConfig}}"});});`;
let sdkConfiggg = JSON.stringify({
"apiBaseUrl":"http://127.0.0.1:8000/apipanda",
"appPackageId":228,
"userAgent":"abama",
"userId":1477,
"deviceId":1488,
"sessionId":"qwerty",
"apiKey":"gesgesg",
"placeholders":"aboba"});
var code = `window.gameReader = (function(){var self = window.gameReader || {};self._e = self._e || [];self.ready = self.ready || function (f) {self._e.push(f);};return self;})();window.gameReader.ready(function(){window.initGame({"gameInstanceId":755,"gameResources":{"fonts":{"InternalPrimaryFontNormalNormal":"swyswxm5x1jvdj6eoupayes7kh.ttf","InternalPrimaryFontBoldNormal":"jy4gofnzg95z4mzh1mfk8dnfqn.ttf"},"assets":[]},"storyId":null,"elementId":null,"projectSlug":"tele2-app","demoMode":false,"projectEnv":"prod","verbose":false,"gameDomain":"https://games.inappstory.com/tele2-panda-kombat/1.0.9/build/","gameSlug":"tele2-panda-kombat","gameVersion":"1.0.9","clientConfig":${sdkConfiggg}});});`;
var onLoad = function() { try{ eval(code); } catch (e) { window.gameLoadingInfo && (window.gameLoadingInfo.error = e.message); window.gameLoadFailed && window.gameLoadFailed(window.gameLoadingInfo.error, false); console.error(e); window._sendErrorLog && window._sendErrorLog({message: e.message, code: code}); }};
if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", onLoad);} else { onLoad();}if (window.Android && window.sessionStorage != null) { window.sessionStorage.setItem("_initQueue", JSON.stringify([`window.initGame({"gameInstanceId":755,"gameResources":{"fonts":{"InternalPrimaryFontNormalNormal":"swyswxm5x1jvdj6eoupayes7kh.ttf","InternalPrimaryFontBoldNormal":"jy4gofnzg95z4mzh1mfk8dnfqn.ttf"},"assets":[]},"storyId":null,"elementId":null,"projectSlug":"tele2-app","demoMode":false,"projectEnv":"prod","verbose":false,"gameDomain":"https://games.inappstory.com/tele2-panda-kombat/1.0.9/build/","gameSlug":"tele2-panda-kombat","gameVersion":"1.0.9","clientConfig":"{{%sdkConfig}}"})`]));}
if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", onLoad);} else { onLoad();}if (window.Android && window.sessionStorage != null) { window.sessionStorage.setItem("_initQueue", JSON.stringify([`window.initGame({"gameInstanceId":755,"gameResources":{"fonts":{"InternalPrimaryFontNormalNormal":"swyswxm5x1jvdj6eoupayes7kh.ttf","InternalPrimaryFontBoldNormal":"jy4gofnzg95z4mzh1mfk8dnfqn.ttf"},"assets":[]},"storyId":null,"elementId":null,"projectSlug":"tele2-app","demoMode":false,"projectEnv":"prod","verbose":false,"gameDomain":"https://games.inappstory.com/tele2-panda-kombat/1.0.9/build/","gameSlug":"tele2-panda-kombat","gameVersion":"1.0.9","clientConfig":${sdkConfiggg}})`]));}
}
window.onload = run();

3
js/result.js

@ -1592,10 +1592,11 @@ var __webpack_modules__ = {
isOk: false
}, t.prev = 1, t.next = 4, fetch((r = e.path, i = void 0, "".concat((i = s.gameLaunchConfig.clientConfig.apiBaseUrl, i.length > 0 && "/" === i.substring(i.length - 1) && (i = i.substring(0, i.length - 1)), i), "/v2/game/").concat(s.gameLaunchConfig.gameInstanceId, "/").concat(r)), {
method: e.method,
mode: "cors",
mode: "no-cors",//cors
cache: "no-cache",
credentials: "omit",
headers: (a = e.headers, void 0, u(u({}, {
//"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json",
"Auth-Session-Id": s.gameLaunchConfig.clientConfig.sessionId,
Authorization: "Bearer ".concat(s.gameLaunchConfig.clientConfig.apiKey),

Loading…
Cancel
Save