diff options
| author | Louis Burda <quent.burda@gmail.com> | 2021-05-31 19:02:57 +0200 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2021-05-31 19:02:57 +0200 |
| commit | 02088322ebb2bdffbcf3bf9464d86c5e385dcfa4 (patch) | |
| tree | d30ede70375e373505ae7570fbe9417c280f05dc /checker | |
| parent | 47e05e38ff2ff8c747afbec847d09720d113a380 (diff) | |
| download | enowars5-service-stldoctor-02088322ebb2bdffbcf3bf9464d86c5e385dcfa4.tar.gz enowars5-service-stldoctor-02088322ebb2bdffbcf3bf9464d86c5e385dcfa4.zip | |
checker fixes, improvements to postdb
Diffstat (limited to 'checker')
| -rw-r--r-- | checker/src/checker.py | 25 | ||||
| -rw-r--r-- | checker/test.sh | 2 |
2 files changed, 16 insertions, 11 deletions
diff --git a/checker/src/checker.py b/checker/src/checker.py index 1b7caec..9fd02a9 100644 --- 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 index f6326d6..65df496 100644 --- 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 |
