-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.template
172 lines (150 loc) · 3.8 KB
/
Dockerfile.template
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
FROM <OS>:<VERSION> as builder
# Label base
LABEL maintainer="Alex Kislitsa"
# Radare version
ARG R2_VERSION=master
ARG R2_TAG=5.7.0
ENV R2_VERSION ${R2_VERSION}
ENV R2_TAG ${R2_TAG}
ENV R2_PIPE_PY_VERSION ${R2_PIPE_PY_VERSION}
ENV DEBIAN_FRONTEND noninteractive
ENV TZ UTC
RUN echo -e "Building versions:\n\
R2_VERSION=${R2_VERSION}\n\
R2_TAG=${R2_TAG}"
# Build radare2 in a volume to minimize space used by build
VOLUME ["/mnt"]
# Install all build dependencies
# Install bindings
# Build and install radare2 on master branch
# Remove all build dependencies
# Cleanup
RUN \
apt-get -y update && \
apt install -y \
cmake \
pkg-config \
libffi-dev \
libssl-dev \
build-essential \
ruby \
ruby-dev \
nasm \
wget \
curl \
git \
patchelf \
gawk \
file \
libglib2.0-dev \
bison \
rpm2cpio cpio \
zstd && \
apt install -y locales --reinstall && \
rm -rf /var/lib/apt/list/*
WORKDIR /mnt
RUN \
git clone -q --depth 1 https://github.com/radareorg/radare2.git -b ${R2_TAG} && \
cd radare2 && \
git checkout -b ${R2_TAG} && \
./sys/install.sh --install && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
r2pm init && r2pm update && r2pm -gi r2ghidra-sleigh && r2pm -gi r2ghidra && r2pm -gi r2frida
FROM <OS>:<VERSION> as runner
# Label base
LABEL maintainer="Alex Kislitsa"
ENV DEBIAN_FRONTEND noninteractive
ENV TZ UTC
COPY --from=builder /usr/local /usr/local
RUN dpkg --add-architecture i386 && \
apt-get -y update && \
apt install -y \
libc6:i386 \
libc6-dbg:i386 \
libc6-dbg \
lib32stdc++6 \
g++-multilib \
cmake \
pkg-config \
ipython3 \
vim \
net-tools \
iputils-ping \
libffi-dev \
libssl-dev \
python3-dev \
python3-pip \
build-essential \
ruby \
ruby-dev \
tmux \
strace \
ltrace \
nasm \
wget \
curl \
gdb \
gdb-multiarch \
netcat \
socat \
git \
patchelf \
gawk \
file \
python3-dev \
python3-setuptools \
libglib2.0-dev \
libc6-dbg \
bison \
rpm2cpio cpio \
zstd \
sudo && \
apt install -y locales --reinstall && \
rm -rf /var/lib/apt/list/* && \
rm -rf /usr/bin/python && \
ln /usr/bin/python3 /usr/bin/python
# Create non-root user
RUN useradd -m adam && usermod -aG sudo adam
# New added for disable sudo password
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
COPY locale.gen /etc/
RUN locale-gen
# Initilise base user
USER adam
WORKDIR /home/adam
ENV HOME /home/adam
COPY .gdbinit ${HOME}/.gdbinit
COPY .pwn.conf ${HOME}/.pwn.conf
COPY .tmux.conf ${HOME}/.tmux.conf
RUN \
python3 -m pip install -U pip && \
python3 -m pip install --no-cache-dir \
ROPgadget \
z3-solver \
smmap2 \
apscheduler \
ropper \
unicorn \
keystone-engine \
capstone \
angr \
pebble \
r2pipe \
frida-tools \
frida && \
sudo chown adam:adam ${HOME}/.gdbinit ${HOME}/.pwn.conf ${HOME}/.tmux.conf && \
gem install --user one_gadget seccomp-tools && \
git clone https://github.com/matrix1001/heapinspect.git ~/heapinspect && \
git clone https://github.com/hugsy/gef.git ~/gef && \
git clone https://github.com/longld/peda.git ~/peda && \
git clone https://github.com/pwndbg/pwndbg.git ~/pwndbg && \
cd ~/pwndbg && ./setup.sh && \
git clone --depth 1 https://github.com/scwuaptx/Pwngdb.git ~/Pwngdb && \
cd ~/Pwngdb && mv .gdbinit .gdbinit-pwngdb && \
sed -i "s?source ~/peda/peda.py?# source ~/peda/peda.py?g" .gdbinit-pwngdb && \
wget -O ~/.gdbinit-gef.py -q http://gef.blah.cat/py && \
echo "export LC_ALL=en_US.UTF-8" >> $HOME/.bashrc && \
echo "PATH=${HOME}/.local/bin:$(find ~ -name one_gadget -exec dirname {} \; | tail -n 1):$PATH" >> $HOME/.bashrc && \
echo "alias pwndbg='gdb -iex init-pwndbg'" >>$HOME/.bashrc && \
echo "alias pedagdb='gdb -iex init-peda'" >>$HOME/.bashrc && \
echo "alias gefgdb='gdb -iex init-gef'" >>$HOME/.bashrc