aboutsummaryrefslogtreecommitdiffstats
path: root/checker/src/checker.py
diff options
context:
space:
mode:
Diffstat (limited to 'checker/src/checker.py')
-rw-r--r--checker/src/checker.py25
1 files changed, 15 insertions, 10 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")