Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add files.
  • Loading branch information
summershrimp committed Sep 28, 2017
1 parent c808ad0 commit 8364752
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Dockerfile
@@ -0,0 +1,17 @@
FROM phusion/baseimage:0.9.22

# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]

RUN apt-get update && apt-get install -y xinetd tcpdump \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& rm /etc/xinetd.d/*

ADD banner_fail /etc/banner_fail
RUN mkdir -p /etc/service/xinetd && mkdir -p /etc/service/tcpdump
ADD xinetd.sh /etc/service/xinetd/run
ADD tcpdump.sh /etc/service/tcpdump/run
RUN chmod +x /etc/service/xinetd/run && chmod +x /etc/service/tcpdump/run

ADD ctf.xinetd.example /etc/xinetd.d/ctf

1 change: 1 addition & 0 deletions banner_fail
@@ -0,0 +1 @@
Your ip reaches access limit, please wait for a while.
19 changes: 19 additions & 0 deletions ctf.xinetd.example
@@ -0,0 +1,19 @@
service ctf
{
disable = no
socket_type = stream
protocol = tcp
wait = no
user = root
type = UNLISTED
port = 20000
bind = 0.0.0.0
server = /bin/date
server_args = -R
banner_fail = /etc/banner_fail
# safety options
per_source = 10 # the maximum instances of this service per source IP address
rlimit_cpu = 20 # the maximum number of CPU seconds that the service may use
rlimit_as = 512M # the Address Space resource limit for the service
#access_times = 2:00-9:00 12:00-24:00
}
24 changes: 24 additions & 0 deletions tcpdump.sh
@@ -0,0 +1,24 @@
#!/bin/sh

if [ -z $TCPDUMP_ENABLE ]; then
echo "Set TCPDUMP_ENABLE to enable packet capture."
exit 0
fi

if [ -z $TCPDUMP_DIR ]; then
TCPDUMP_DIR=/var/lib/tcpdump
fi

if [ -z $TCPDUMP_SPLIT_SIZE ]; then
TCPDUMP_SPLIT_SIZE=10m
fi

if [ -z $CTF_PORT ]; then
CTF_PORT=20000
fi

mkdir -p $TCPDUMP_DIR
echo "TCPDUMP: capture port: $CTF_PORT, split size: $TCPDUMP_SPLIT_SIZE"
exec /usr/sbin/tcpdump -i eth0 port $CTF_PORT -w $TCPDUMP_DIR/capture.pcap -C $TCPDUMP_SPLIT_SIZE


4 changes: 4 additions & 0 deletions xinetd.sh
@@ -0,0 +1,4 @@
#!/bin/sh

exec /usr/sbin/xinetd -dontfork -stayalive -inetd_compat

0 comments on commit 8364752

Please sign in to comment.