mirror of
https://gitea.tendokyu.moe/AttackVector/AVNetwork.git
synced 2026-09-22 22:27:58 +03:00
51 lines
1.8 KiB
Python
51 lines
1.8 KiB
Python
from urllib.parse import parse_qs
|
|
from flask import Blueprint, request # Import necessary functions
|
|
from kbinxml import KBinXML
|
|
from variables.protocols import IIDX_XML, IIDX_RESULT, EAC_XML, EAC_RESULT, Respond
|
|
from variables.strings.preLaunch import ServerState
|
|
from variables.strings.common import serverClock
|
|
import time
|
|
bp = Blueprint(
|
|
"preProcess", __name__, url_prefix="/preProcess"
|
|
)
|
|
|
|
|
|
@bp.route("/GetServerState", methods=["POST"])
|
|
@bp.route("/GetServerStatus", methods=["POST"])
|
|
def getServerState():
|
|
if request.method == "POST":
|
|
# Access post data
|
|
post_data = request.get_data().decode("UTF-8")
|
|
|
|
variables = parse_qs(post_data)
|
|
|
|
if variables["protocol_version"][0] == "P2D:2015091800":
|
|
response = KBinXML(ServerState.format(protocol=IIDX_XML,result=IIDX_RESULT).encode("utf-8"))
|
|
else:
|
|
response = KBinXML(ServerState.format(protocol=EAC_XML,result=EAC_RESULT).encode("utf-8"))
|
|
|
|
binary_data = response.to_binary()
|
|
return Respond(binary_data, variables["protocol_version"][0])
|
|
|
|
return "Invalid request method", 400
|
|
|
|
|
|
@bp.route("/GetServerClock", methods=["POST"])
|
|
def GetServerClock():
|
|
if request.method == "POST":
|
|
# Access post data
|
|
post_data = request.get_data().decode("UTF-8")
|
|
|
|
variables = parse_qs(post_data)
|
|
|
|
if variables["protocol_version"][0] == "P2D:2015091800":
|
|
response = KBinXML(serverClock.format(protocol=IIDX_XML,result=IIDX_RESULT,Clock=int(time.time() * 1000)).encode("utf-8"))
|
|
else:
|
|
print(time.time() * 1000)
|
|
response = KBinXML(serverClock.format(protocol=EAC_XML,result=EAC_RESULT,Clock=int(time.time() * 1000)).encode("utf-8"))
|
|
|
|
binary_data = response.to_binary()
|
|
return Respond(binary_data, variables["protocol_version"][0])
|
|
|
|
return "Invalid request method", 400
|