-
Notifications
You must be signed in to change notification settings - Fork 87
/
Dockerfile-emux
119 lines (97 loc) · 3.34 KB
/
Dockerfile-emux
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
# Dockerfile for EMUX-Docker
# by Saumil Shah
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# EMUX (formerly ARMX) by Saumil Shah
# https://emux.exploitlab.net/
#FROM alpine:latest
#FROM alpine:3.17.2
FROM alpine:3.15.4
# Install packages
RUN apk update
RUN apk add \
bash sudo pv tar dialog iptables curl wget tmux git \
vim nano asciinema \
coreutils util-linux \
iputils iproute2 \
build-base \
python3 python3-dev py3-pip \
openssh-client openssl openssl-dev \
libffi-dev \
xz-dev \
cargo \
openrc \
gdb-multiarch \
nfs-utils squashfs-tools cramfs \
dnsmasq \
tinyproxy \
socat \
netcat-openbsd \
busybox-extras \
cmake \
--no-cache
# Install Python packages
RUN pip install --upgrade pip
RUN pip install wheel
RUN pip install cstruct
RUN pip install ropper
RUN pip install jefferson
RUN pip install ubi_reader
# Uncomment if you want to install pwntools
# NOTE: *** It will take a very long time to build ***
# *** but it works ***
#
#RUN pip install pwntools
# Install packages/repos from Github
WORKDIR /tmp
#RUN git clone --depth 1 https://github.com/sviehb/jefferson.git
#RUN git clone --depth 1 https://github.com/ReFirmLabs/binwalk.git
# Force old version of binwalk until I get the time to figure out
# the new Rust version
RUN git clone --depth 1 --branch v2.3.3 https://github.com/ReFirmLabs/binwalk.git
#WORKDIR /tmp/jefferson
#RUN python3 setup.py install
WORKDIR /tmp/binwalk
RUN python3 setup.py install
# Copy network tunnel startup script, NFS exports, tinyproxy config and tinyproxy startup script
COPY files/etc/local.d/* /etc/local.d/
COPY files/etc/exports /etc/exports
COPY files/etc/tinyproxy/* /etc/tinyproxy/
COPY files/sbin/* /sbin/
# Transplanting cramfsck because the one in the package is broken
# Transplanting unsquashfs (static binary) because the existing one
# doesn't have LZMA support. This one is specially compiled with it.
RUN chmod 755 /etc/local.d/*.start /sbin/cramfsck /sbin/unsquashfs
# Create an r0 user for all userland work
RUN adduser --disabled-password --gecos "" r0
RUN echo 'r0 ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
# Set r0's shell to bash
RUN sed -i 's!/bin/ash!/bin/bash!g' /etc/passwd
# Set up the home directory of r0 user
WORKDIR /home/r0
# Add bashrc, ssh configs, etc
COPY --chown=r0 files/home/r0/bashrc .bashrc
COPY --chown=r0 files/home/r0/bash_profile .bash_profile
COPY --chown=r0 files/home/r0/tmux.conf .tmux.conf
COPY --chown=r0 files/home/r0/ssh .ssh
COPY --chown=r0 files/home/r0/dircolors .dircolors
COPY --chown=r0 files/home/r0/gdbinit .gdbinit
COPY --chown=r0 files/home/r0/gdbinit-gef.py .gdbinit-gef.py
COPY --chown=r0 files/home/r0/gef.rc .gef.rc
COPY --chown=root files/home/r0/bashrc /root/.bashrc
COPY --chown=root files/home/r0/bash_profile /root/.bash_profile
COPY --chown=root files/home/r0/tmux.conf /root/.tmux.conf
COPY --chown=root files/home/r0/ssh /root/.ssh
COPY --chown=root files/home/r0/dircolors /root/.dircolors
RUN chmod 600 /home/r0/.ssh/id_rsa /home/r0/.ssh/config
RUN chmod 600 /root/.ssh/id_rsa
# Set up the docker entrypoint script
COPY ./docker-entrypoint.sh /usr/local/bin
USER r0
ENV TERM=xterm-256color
ENV LANG=C.UTF-8
ENV CHARSET=UTF-8
ENV LC_COLLATE=C
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["/bin/bash"]