-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
115 lines (98 loc) · 2.59 KB
/
Dockerfile
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
# Custom r2 docker build
# ========
# ubuntu
# nodejs
# python pip
# r2
# r2pipe
# r2frida
# r2dec
#
# Takes your custom config file (.radare2rc) from the current directory
# Copies contents of ./data to /home/r2/data
#
# Build docker image with:
# $ docker build -t r2-docker:latest .
#
# Open binary with frida:
# r2 frida:///home/r2/data/sample
# Using Ubuntu latest as base image.
FROM ubuntu:latest
# Label base
LABEL r2-docker latest
ARG R2_TAG=5.6.8
# Build and install radare2 on master branch
RUN DEBIAN_FRONTEND=noninteractive dpkg --add-architecture i386 && apt-get update
# Build dependencies
RUN apt-get install -y \
curl \
gcc \
git \
bison \
pkg-config \
make \
glib-2.0 \
libc6:i386 \
libncurses5:i386 \
libstdc++6:i386 \
gnupg2 \
sudo \
xz-utils \
python3-pip \
python-is-python3 \
openssl \
build-essential \
xxd \
wget \
tmux
# nodejs
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -
RUN apt-get update
RUN apt-get install nodejs
# r2pipe
RUN pip3 install r2pipe && npm install --unsafe-perm -g r2pipe
# Build radare2 in a volume to minimize space used by build
#VOLUME ["/mnt"]
#WORKDIR /mnt
# r2
RUN git clone -q --depth 1 https://github.com/radare/radare2.git -b ${R2_TAG} && \
./radare2/sys/install.sh
# Create non-root user
RUN useradd -m r2 && adduser r2 sudo
# New added for disable sudo password
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# Initilise base user
USER r2
WORKDIR /home/r2
ENV HOME /home/r2
# Setup r2pm
RUN r2pm init && r2pm update && chown -R r2:r2 /home/r2/.config
# r2dec plugin
# command pdd
# .radare2rc options:
# r2dec.casts | if false, hides all casts in the pseudo code.
# r2dec.asm | if true, shows pseudo next to the assembly.
# r2dec.blocks | if true, shows only scopes blocks.
# r2dec.paddr | if true, all xrefs uses physical addresses compare.
# r2dec.xrefs | if true, shows all xrefs in the pseudo code.
# r2dec.theme | defines the color theme to be used on r2dec.
# e scr.html | outputs html data instead of text.
# e scr.color | enables syntax colors.
RUN r2pm -ci r2dec
# r2frida plugin
# Forms of use:
# $ r2 frida://Twitter
# $ r2 frida://1234
# $ r2 frida:///bin/ls
# $ r2 frida://"/bin/ls -al"
# $ r2 frida://device-id/Twitter
RUN r2pm -ci r2frida
# Cleanup
USER root
RUN apt-get autoremove --purge -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Base command for container
USER r2
COPY .radare2rc /home/r2/.radare2rc
COPY ./data /home/r2/data
COPY .tmux.conf ${HOME}/.tmux.conf
ENTRYPOINT bash