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 9763bd5c6d2ab498e989b738c35884c9d7bf8d5e
parent 0af3518c5dbf5a03684991658f3711f3860da36d
Author: Louis Burda <quent.burda@gmail.com>
Date:   Fri, 25 Jun 2021 18:01:32 +0200

fixed many inappropriate uses of EnoException to BrokenServiceException

Diffstat:
Mchecker/src/checker.py | 38+++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/checker/src/checker.py b/checker/src/checker.py @@ -67,7 +67,7 @@ def reverse_hash(hashstr): def check_line(conn, context): line = conn.recvline() if b"ERR:" in line: - raise EnoException(f"{context}: Unexpected error message\n") + raise BrokenServiceException(f"{context}: Unexpected error message\n") return line def parse_int(intstr): @@ -217,13 +217,13 @@ class STLDoctorChecker(BaseChecker): resp = conn.recvline() if b"ERR:" in resp: if check: - raise EnoException(f"Failed to login with {authstr}:\n{resp}") + raise BrokenServiceException(f"Failed to login with {authstr}:\n{resp}") return None # Also check success message resp += conn.recvuntil(self.prompt) if b"Success!" not in resp: - raise EnoException(f"Login with pass {authstr} failed") + raise BrokenServiceException(f"Login with pass {authstr} failed") return b"Welcome back" in resp def do_list(self, conn, check = True): @@ -233,7 +233,7 @@ class STLDoctorChecker(BaseChecker): # Check for errors if b"ERR:" in resp and b">> " not in resp: if check: - raise EnoException(f"Failed to list private files:\n{resp}") + raise BrokenServiceException(f"Failed to list private files:\n{resp}") return None return resp @@ -253,7 +253,7 @@ class STLDoctorChecker(BaseChecker): line = conn.recvline() if b"ERR:" in line: if check: - raise EnoException(f"Failed to upload model {modelname}:\n{line}") + raise BrokenServiceException(f"Failed to upload model {modelname}:\n{line}") conn.recvuntil(self.prompt) return None @@ -281,7 +281,7 @@ class STLDoctorChecker(BaseChecker): line = conn.recvline() if b"ERR:" in line: if check: - raise EnoException(f"Failed to retrieve model {modelname}:\n{line}") + raise BrokenServiceException(f"Failed to retrieve model {modelname}:\n{line}") if b"Couldn't find a matching scan result" in line: # collect all the invalid commands sent after (hacky) conn.recvuntil(self.prompt) @@ -311,23 +311,23 @@ class STLDoctorChecker(BaseChecker): def check_listed(self, conn, includes): resp = self.do_list(conn, check = True) if not includes_all(resp, includes): - raise EnoException(f"Failed to find {includes} in listing:\n{resp}") + raise BrokenServiceException(f"Failed to find {includes} in listing:\n{resp}") return resp def check_not_listed(self, conn, excludes, fail = False): resp = self.do_list(conn, check = False) if fail and resp: - raise EnoException(f"Expected list to fail, but returned:\n{resp}") + raise BrokenServiceException(f"Expected list to fail, but returned:\n{resp}") if not fail and not resp: - raise EnoException(f"List failed unexpectedly:\n{resp}") + raise BrokenServiceException(f"List failed unexpectedly:\n{resp}") if resp and includes_any(resp, excludes): - raise EnoException(f"Unexpectedly found one of {excludes} in listing:\n{resp}") + raise BrokenServiceException(f"Unexpectedly found one of {excludes} in listing:\n{resp}") return resp def check_in_search(self, conn, modelname, includes, download = False): info, stlfile = self.do_search(conn, modelname, download, check = True) if not includes_all(info + stlfile, includes): - raise EnoException(f"Retrieved info for {modelname} is missing {includes}: {resp}") + raise BrokenServiceException(f"Retrieved info for {modelname} is missing {includes}: {resp}") return info, stlfile def check_not_in_search(self, conn, modelname, excludes, download = False, fail = False): @@ -335,11 +335,11 @@ class STLDoctorChecker(BaseChecker): if resp: combined = resp[0]+resp[1] if fail and resp: - raise EnoException("Search for {modelname} succeeded unexpectedly:\n{combined}") + raise BrokenServiceException("Search for {modelname} succeeded unexpectedly:\n{combined}") if not fail and not resp: - raise EnoException(f"Search for {modelname} failed unexpectedly:\n{resp}") + raise BrokenServiceException(f"Search for {modelname} failed unexpectedly:\n{resp}") if resp and includes_any(resp[0] + resp[1], excludes): - raise EnoException(f"Unexpectedly {modelname} info contains one of {includes}: {combined}") + raise BrokenServiceException(f"Unexpectedly {modelname} info contains one of {includes}: {combined}") return resp # TEST METHODS # @@ -379,7 +379,7 @@ class STLDoctorChecker(BaseChecker): conn = self.openconn() if self.do_upload(conn, fakeid(), stlfile, check = False): - raise EnoException(f"Able to upload malformed file:\n{stlfile}") + raise BrokenServiceException(f"Able to upload malformed file:\n{stlfile}") self.closeconn(conn) def test_search(self, registered = False): @@ -414,7 +414,7 @@ class STLDoctorChecker(BaseChecker): if registered: conn = self.openconn() if self.do_auth(conn, authstr2): - raise EnoException("New authstr {authstr2} has user dir") + raise BrokenServiceException("New authstr {authstr2} has user dir") self.check_not_listed(conn, [modelid, modelname]) self.closeconn(conn) else: @@ -450,9 +450,9 @@ class STLDoctorChecker(BaseChecker): conn = self.openconn() if registered: self.do_auth(conn, authstr) - info, stlfile = self.do_search(conn, modelname) - if self.flag.encode() not in (info + stlfile): - raise EnoException(f"Flag {self.flag} not found in search:\n{info}\n{stlfile}") + info, stlfile = self.do_search(conn, modelname, download = True) + if self.flag.encode() not in info + stlfile: + raise BrokenServiceException(f"Flag {self.flag} not found in search:\n{info}\n{stlfile}") self.closeconn(conn) else: raise EnoException(f"Invalid getflag variant ({self.variant_id}) provided")