Skip to content

Commit

Permalink
Half Automated Docker Script
Browse files Browse the repository at this point in the history
  • Loading branch information
ChoiSian committed Jul 30, 2023
1 parent a5412e3 commit f81f77c
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.DS_Store
*.gdb_history
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM ubuntu:16.04
MAINTAINER insp3ct0r_x

ARG DEBIAN_FRONTEND=noninteractive

ENV TZ Asia/Seoul

RUN sed -i "s/archive.ubuntu.com/mirror.kakao.com/g" /etc/apt/sources.list
RUN apt update && apt upgrade -y
RUN apt install xinetd gdbserver binutils -y

RUN dpkg --add-architecture i386
RUN apt update
RUN apt install libc6-dbg libc6:i386 libc6-dbg:i386 -y

WORKDIR /root/
COPY chall.bin /root/
RUN chmod 755 /root/chall.bin
COPY chall.daemon /etc/xinetd.d/chall
RUN echo "chall 9929/tcp" >> /etc/services

COPY ep.sh /root/
RUN chmod 755 /root/ep.sh
ENTRYPOINT ["/root/ep.sh"]
Binary file added chall.bin
Binary file not shown.
11 changes: 11 additions & 0 deletions chall.daemon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
service chall
{
socket_type = stream
flags = REUSE
wait = no
protocol = tcp
user = root
disable = no
server = /root/chall.bin
port = 9929
}
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
services:
chall:
build: ./
ports:
- "9929:9929" # for challenge
- "929:929" # for remote debugging
cap_add:
- SYS_PTRACE
security_opt:
- seccomp:unconfined
12 changes: 12 additions & 0 deletions ep.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

echo "[!] Container is started... Setting up xinetd"
/etc/init.d/xinetd restart 1>/dev/null

echo "[!] If challenge session is connected, gdbserver is run automatically..."
while [[ 1 ]]; do
PID=$(pidof /root/chall.bin 2>/dev/null)
if [[ -n $PID ]]; then
gdbserver 0.0.0.0:929 --attach $PID 2>/dev/null
fi
done

0 comments on commit f81f77c

Please sign in to comment.