diff --git a/crypto/halloween/halloween.zip b/crypto/halloween/halloween.zip new file mode 100644 index 0000000..325d78e Binary files /dev/null and b/crypto/halloween/halloween.zip differ diff --git a/crypto/halloween/halloween/Dockerfile b/crypto/halloween/halloween/Dockerfile new file mode 100644 index 0000000..2d3a8be --- /dev/null +++ b/crypto/halloween/halloween/Dockerfile @@ -0,0 +1,15 @@ +FROM python:3.11-alpine + +RUN apk --update add socat \ + && adduser -D --home /app user \ + && pip3 install gostcrypto + +COPY --chown=user . /app + +RUN chmod 755 /app/entry.sh /app/chall.py + +WORKDIR /app + +EXPOSE ${LISTEN_PORT} + +ENTRYPOINT ["/app/entry.sh"] \ No newline at end of file diff --git a/crypto/halloween/halloween/chall.py b/crypto/halloween/halloween/chall.py new file mode 100644 index 0000000..4925c5b --- /dev/null +++ b/crypto/halloween/halloween/chall.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 +import gostcrypto +import os + +with open("flag.txt", "rb") as f: + flag = f.read() + +key, iv = os.urandom(32), os.urandom(8) +cipher = gostcrypto.gostcipher.new( + "kuznechik", key, gostcrypto.gostcipher.MODE_CTR, init_vect=iv +) + +print(f"It's almost Halloween, time to get sp00{cipher.encrypt(flag).hex()}00ky 👻!") + +while True: + print(cipher.encrypt(bytes.fromhex(input())).hex()) diff --git a/crypto/halloween/halloween/entry.sh b/crypto/halloween/halloween/entry.sh new file mode 100644 index 0000000..5ee439f --- /dev/null +++ b/crypto/halloween/halloween/entry.sh @@ -0,0 +1,6 @@ +#! /bin/sh + +while : +do + socat TCP-LISTEN:${LISTEN_PORT},forever,reuseaddr,fork EXEC:'/app/chall.py' 2>/dev/null +done