commit f75abdd928302e8ef555e1f10b19b6105609775e
parent 36f6b050319f1e8c37b3377a806420cdac09a505
Author: Louis Burda <quent.burda@gmail.com>
Date: Sat, 22 May 2021 15:25:18 +0200
fix permissions on docker container, clean up checker code a little
Diffstat:
3 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/checker/src/checker.py b/checker/src/checker.py
@@ -144,20 +144,18 @@ class STLDoctorChecker(BaseChecker):
def getfile(self, conn, modelname):
modelname = ensure_bytes(modelname)
- if modelname != "":
- self.debug(f"Sending command to retrieve file with name '{modelname}'")
- self.write(conn, "search\n")
- self.write(conn, modelname + b"\n")
- self.write(conn, "0\n") # first result
- self.write(conn, "y\n") # yes download
- else:
- self.debug(f"Sending command to retrieve file")
- self.write(conn, f"search\n0\ny\n")
+ self.debug(f"Sending command to retrieve file with name {modelname}")
+ self.write(conn, "search\n")
+ self.write(conn, modelname + b"\n")
+ self.write(conn, "0\n") # first result
+ self.write(conn, "y\n") # yes download
resp = conn.recvuntil(b"Here you go.. (")
+ print(resp)
try:
size = int(conn.recvuntil(b"B)\n")[:-3])
except:
+ print("GOT INSTEAD:", conn.recvall(timeout=0))
raise BrokenServiceException("Returned file content size for download is not a valid integer")
print("FILE SIZE:", size)
@@ -216,10 +214,12 @@ class STLDoctorChecker(BaseChecker):
self.closeconn(conn)
def openconn(self):
- import pwnlib
- self.debug("Connecting to service")
+ 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)
- conn.recvuntil("$") # ignore welcome
+ resp = conn.recvuntil("$") # ignore welcome
+ if self.debuglog:
+ print("WELCOME:",resp)
return conn
def closeconn(self, conn):
diff --git a/service/container/Dockerfile b/service/container/Dockerfile
@@ -5,8 +5,6 @@ RUN apt update && apt install -y --no-install-recommends socat build-essential
RUN addgroup --system service
RUN adduser --system --ingroup service --uid 1000 service
-RUN mkdir /data
-
COPY entrypoint.sh /
RUN chmod 755 /entrypoint.sh
diff --git a/service/container/entrypoint.sh b/service/container/entrypoint.sh
@@ -1,8 +1,7 @@
#!/bin/sh
-chown -R service:service "/data/"
-
mkdir -p "$RESULTDIR"
+chown -R service:service "$RESULTDIR"
while [ 1 ]; do
/cleaner.sh