-
-
Notifications
You must be signed in to change notification settings - Fork 56
/
config.py
73 lines (57 loc) · 1.82 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2018-09-17 14:01:13
# @Author : giantbranch (giantbranch@gmail.com)
# @Link : http://www.giantbranch.cn/
# @tags :
# Whether to replace /bin/sh
REPLACE_BINSH = False
FLAG_BAK_FILENAME = "flags.txt"
PORT_INFO_FILENAME = "ports.txt"
PWN_BIN_PATH = "./bin"
XINETD_CONF_FILENAME = "pwn.xinetd"
PORT_LISTEN_START_FROM = 10000
XINETD = '''service ctf
{
disable = no
socket_type = stream
protocol = tcp
wait = no
user = root
type = UNLISTED
port = %d
bind = 0.0.0.0
server = /usr/sbin/chroot
server_args = --userspec=%s /home/%s ./%s
# 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 = 100M # the Address Space resource limit for the service
#access_times = 2:00-9:00 12:00-24:00
}
'''
DOCKERFILE = '''FROM ubuntu:16.04
RUN sed -i 's/archive.ubuntu.com/asia-east1.gce.archive.ubuntu.com/g' /etc/apt/sources.list && apt update && apt-get install -y lib32z1 xinetd && rm -rf /var/lib/apt/lists/ && rm -rf /root/.cache && apt-get autoclean && rm -rf /tmp/* /var/lib/apt/* /var/cache/* /var/log/*
#apt update && apt-get install -y lib32z1 xinetd && rm -rf /var/lib/apt/lists/ && rm -rf /root/.cache && apt-get autoclean && rm -rf /tmp/* /var/lib/apt/* /var/cache/* /var/log/*
COPY ./'''+ XINETD_CONF_FILENAME +''' /etc/xinetd.d/pwn
COPY ./service.sh /service.sh
RUN chmod +x /service.sh
# useradd and put flag
%s
# copy bin
%s
# chown & chmod
%s
# copy lib,/bin
%s
CMD ["/service.sh"]
'''
DOCKERCOMPOSE = '''version: '2'
services:
pwn_deploy_chroot:
image: pwn_deploy_chroot:latest
build: .
container_name: pwn_deploy_chroot
ports:
%s
'''