I'm taking a look at it right now. I noticed a couple changes like them changing the domain from server2 to just server. It also seems that for setaccountinfoNEW.php they have a second authentication part to it now. Instead of just having the username and password in the front of the request it is also in the end of it too. Here's the code I have so far, just a rough draft. I'm gonna see if I can get the server to change something as simple as the streamer value.
Code:
from http import client
from hashlib import sha512
import re
from xml.etree import ElementTree as ET
from urllib.parse import quote_plus
class Uri:
login = r"/OnlineAccountSystem/login.php"
stats = r"/OnlineAccountSystem/getaccountinfoNEW.php"
set = r"/OnlineAccountSystem/setaccountinfoNEW.php"
class Patterns:
stats = "(<AS_CustomInfo.*>.*</AS_CustomInfo>)"
prepost = "(.*)(?:<AS_CustomInfo .*>.*</AS_CustomInfo>)(.*)"
host = "server.blayzegames.com"
phpSecret = "s3c7kalph14_)"
username = "PC-" + input("Username: ")
password = sha512(input("Password: ").encode()).hexdigest().upper()
auth = "phpSecret={}&username={}&password={}".format(phpSecret, username, password)
server = client.HTTPSConnection(host, port=443)
server.request("POST", Uri.stats, body=auth, headers={"User-Agent": "Mozilla/5.0",
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "*/*",
"Accept-Encoding": "text/html",
"Accept-Language": "en-US, en;q = 0.9"})
resp = server.getresponse().read().decode()
a = re.search(Patterns.stats, resp, flags=re.MULTILINE|re.DOTALL)
b = re.search(Patterns.prepost, resp, flags=re.MULTILINE|re.DOTALL)
stats = None
root = None
prepost = None
if a and b:
stats = ET.ElementTree(ET.fromstring(a.group(0)))
root = stats.getroot()
prepost = b.group(0) + "{}" + b.group(1)
else:
print("Could not retrieve stats")
exit()
accinfo = stats.find("./bfAccountInfo")
accinfo.find("streamer").text = "false"
xml = quote_plus(prepost.format(ET.tostring(root)))
setformat = "username={user1}&password={pass1}&phpSecret={secret}&info={xml}&username={user2}&password={pass2}"
setreq = setformat.format(user1=username, pass1=password, secret=phpSecret, xml=xml, user2=username, pass2=password)
server.request("POST", Uri.set, body=setreq, headers={"User-Agent": "Mozilla/5.0",
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "*/*",
"Accept-Encoding": "text/html",
"Accept-Language": "en-US, en;q = 0.9"})
print(server.getresponse().read())
My business has slowed some thankfully. I might be able to put a little time into this.