Skip to content

Commit

Permalink
更新sage环境
Browse files Browse the repository at this point in the history
  • Loading branch information
Randark-JMT committed Sep 30, 2023
1 parent c21f074 commit d39bd87
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crypto-sagemath_9.6/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ RUN sage --python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple \
COPY ./src/main.sage /home/sage

# 拷贝启动脚本至根目录
COPY ./service/docker-entrypoint.sh /
COPY ./service/docker-entrypoint.sh /home/sage/docker-entrypoint.sh

# [可选]指定对外暴露端口,对于GZCTF等平台,强制EXPOSE可能会造成非预期端口泄露,请酌情启用
# EXPOSE 9999

# 指定容器入口点
ENTRYPOINT ["/bin/bash","/docker-entrypoint.sh"]
ENTRYPOINT ["/bin/bash","/home/sage/docker-entrypoint.sh"]
3 changes: 3 additions & 0 deletions crypto-sagemath_9.6/service/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/sh

# 删除启动脚本,以防非预期
rm -f /home/sage/docker-entrypoint.sh

# 通过socat转发SageMath会话
# TCP4-LISTEN:9999 服务将会转发到9999端口
# reuseaddr 启用端口复用,便于多用户同时连接同一个端口
Expand Down
11 changes: 11 additions & 0 deletions crypto-sagemath_9.6/src/main.sage
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,18 @@ Introduction = """

flag = os.getenv('FLAG')

BANNER = r'''
____ _____ _____ _ _ _
/ ___|_ _| ___| / \ _ __ ___| |__ (_)_ _____ ___
| | | | | |_ _____ / _ \ | '__/ __| '_ \| \ \ / / _ \/ __|
| |___ | | | _|_____/ ___ \| | | (__| | | | |\ V / __/\__ \
\____| |_| |_| /_/ \_\_| \___|_| |_|_| \_/ \___||___/
'''

if __name__ == "__main__":
print(BANNER)
while True:
ins = input("Please input 'ctf':")
if ins == "ctf":
Expand Down

0 comments on commit d39bd87

Please sign in to comment.