commit 62d99253144a14648c4da1c2a60c01e7b06ef02c
parent 8057ab1167b3c0c19f8212c86c7a849ca3997d47
Author: Louis Burda <quent.burda@gmail.com>
Date: Thu, 27 May 2021 22:18:08 +0200
checker: replaced pwntools in self.openconn hotfix with self.connect
Diffstat:
1 file changed, 12 insertions(+), 18 deletions(-)
diff --git 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()