crypto: halloween
This commit is contained in:
parent
9e8502081c
commit
1fa848c01f
BIN
crypto/halloween/halloween.zip
Normal file
BIN
crypto/halloween/halloween.zip
Normal file
Binary file not shown.
15
crypto/halloween/halloween/Dockerfile
Normal file
15
crypto/halloween/halloween/Dockerfile
Normal file
@ -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"]
|
16
crypto/halloween/halloween/chall.py
Normal file
16
crypto/halloween/halloween/chall.py
Normal file
@ -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())
|
6
crypto/halloween/halloween/entry.sh
Normal file
6
crypto/halloween/halloween/entry.sh
Normal file
@ -0,0 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
while :
|
||||
do
|
||||
socat TCP-LISTEN:${LISTEN_PORT},forever,reuseaddr,fork EXEC:'/app/chall.py' 2>/dev/null
|
||||
done
|
Loading…
Reference in New Issue
Block a user