enowars5-service-stldoctor

STL-Analyzing A/D Service for ENOWARS5 in 2021
git clone https://git.sinitax.com/sinitax/enowars5-service-stldoctor
Log | Files | Refs | README | LICENSE | sfeed.txt

commit 02088322ebb2bdffbcf3bf9464d86c5e385dcfa4
parent 47e05e38ff2ff8c747afbec847d09720d113a380
Author: Louis Burda <quent.burda@gmail.com>
Date:   Mon, 31 May 2021 19:02:57 +0200

checker fixes, improvements to postdb

Diffstat:
Mchecker/src/checker.py | 25+++++++++++++++----------
Mchecker/test.sh | 2+-
2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/checker/src/checker.py b/checker/src/checker.py @@ -68,7 +68,8 @@ class STLDoctorChecker(BaseChecker): return "".join([chr(random.randint(32, 127)) for i in range(idlen)]) def do_auth(self, conn, authstr): - conn.write(f"auth {authstr}\n") + conn.write("auth\n") + conn.write(authstr + b"\n") resp = conn.recvuntil(self.prompt) authstr = ensure_bytes(authstr) assert_in(b"Success!", resp, f"Login with pass {authstr} failed"); @@ -151,11 +152,13 @@ class STLDoctorChecker(BaseChecker): conn.write(modelname + b"\n") # Parse ID - self.debug(conn.recvuntil("with ID ")) - modelid = conn.recvuntil(b"!")[:-1] + self.debug(conn.recvline()) + line = conn.recvuntil("with ID ") + self.debug(conn.recvline()) + modelid = line.rsplit(b"!", 1)[0].split(b"with ID ", 1)[1] if modelid == "": raise BrokenServiceException("Unable to upload file!") - self.debug(f"Uploaded file with {modelid}") + self.debug(f"Uploaded file with name {modelid}") conn.recvuntil(self.prompt) @@ -205,8 +208,8 @@ class STLDoctorChecker(BaseChecker): vals.append(val) return vals - def postdb(self, vdict): - self.chain_db = vdict + def postdb(self, **kwdict): + self.chain_db = kwdict def reverse_hash(self, hashstr): return subprocess.check_output(os.getenv("REVHASH_PATH") + f" \"{hashstr}\"", shell=True)[:-1] @@ -242,7 +245,7 @@ class STLDoctorChecker(BaseChecker): modelname = self.fakeid() stlfile, modelid = self.putfile(conn, modelname, self.flag, filetype = "ascii") self.closeconn(conn) - self.postdb({ "modelid": modelid, "modelname": modelname }) + self.postdb(modelid=modelid, modelname=modelname) elif self.variant_id == 1: conn = self.openconn() modelname = self.fakeid() @@ -250,7 +253,7 @@ class STLDoctorChecker(BaseChecker): self.do_auth(conn, authstr) stlfile, modelid = self.putfile(conn, modelname, self.flag, filetype = "bin") self.closeconn(conn) - self.postdb({ "modelid": modelid, "modelname": modelname, "auth": authstr }) + self.postdb(modelid=modelid, modelname=modelname, auth=authstr) else: raise EnoException("Invalid variant_id provided") @@ -279,7 +282,8 @@ class STLDoctorChecker(BaseChecker): solidname = self.fakeid() contents, modelid = self.putfile(conn, modelname, solidname, "bin") self.closeconn(conn) - self.postdb({ "modelid": modelid, "modelname": modelname, "solidname": solidname, "contents": contents }) + self.postdb(modelid=modelid, modelname=modelname, solidname=solidname, + contents=contents) elif self.variant_id == 1: conn = self.openconn() authstr = self.fakeid() @@ -288,7 +292,8 @@ class STLDoctorChecker(BaseChecker): self.do_auth(conn, authstr) contents, modelid = self.putfile(conn, modelname, solidname, "ascii") self.closeconn(conn) - self.postdb({ "modelid": modelid, "modelname": modelname, "solidname": solidname, "contents": contents, "auth": authstr }) + self.postdb(modelid=modelid, modelname=modelname, solidname=solidname, + contents=contents, auth=authstr) else: raise EnoException("Invalid variant_id provided") diff --git a/checker/test.sh b/checker/test.sh @@ -20,7 +20,7 @@ try() { } -if [ $# -eq 2 ]; then +if [ $# -ge 2 ]; then try $@ elif [ "$1" == "test-exploits" ]; then try exploit 0