diff options
Diffstat (limited to 'checker')
| -rw-r--r-- | checker/src/checker.py | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/checker/src/checker.py b/checker/src/checker.py index 46f91ce..1b7caec 100644 --- a/checker/src/checker.py +++ b/checker/src/checker.py @@ -46,9 +46,15 @@ class STLDoctorChecker(BaseChecker): conn.write(f"login\n{password}\n") conn.readline_expect(b"logged in!", recvuntil=self.prompt, exception_message="Failed to log in") - def write(self, conn, buf): - self.debug("SEND: " + str(ensure_bytes(buf))) - conn.send(ensure_bytes(buf)) + def openconn(self): + conn = self.connect() + resp = conn.recvuntil(self.prompt) + return conn + + def closeconn(self, conn): + self.debug("Sending exit command") + conn.write("exit\n") + conn.close() def fakeid(self): fake = Faker(["en_US"]) @@ -202,6 +208,9 @@ class STLDoctorChecker(BaseChecker): def postdb(self, vdict): self.chain_db = vdict + def reverse_hash(self, hashstr): + return subprocess.check_output(os.getenv("REVHASH_PATH") + f" \"{hashstr}\"", shell=True)[:-1] + def havoc_upload(self, filetype, register): # cant be havocid with ascii since might mess with stl parsing solidname = self.fakeid() if filetype == 'ascii' else self.havocid() @@ -227,21 +236,6 @@ class STLDoctorChecker(BaseChecker): self.check_listed(conn, modelid) self.closeconn(conn) - def reverse_hash(self, hashstr): - return subprocess.check_output(os.getenv("REVHASH_PATH") + f" \"{hashstr}\"", shell=True)[:-1] - - def openconn(self): - import pwnlib.tubes.remote - self.debug(f"Connecting to service at {self.address}:{self.port}") - conn = pwnlib.tubes.remote.remote(self.address, self.port, timeout = self.timeout) - resp = conn.recvuntil(self.prompt) - return conn - - def closeconn(self, conn): - self.debug("Sending exit command") - conn.write("exit\n") - conn.close() - def putflag(self): # type: () -> None if self.variant_id == 0: conn = self.openconn() |
