-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
96 lines (86 loc) · 2.57 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
FROM ubuntu:22.04
# Download and install packages.
RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" \
apt-get install -y --no-install-suggests --no-install-recommends \
# Basic packages.
build-essential \
clang \
cmake \
curl \
git \
less \
pkg-config \
python-is-python3 \
python3 \
python3-pip \
sudo \
tar \
unzip \
vim \
# Packages for AFL++.
automake \
bison \
cmake \
flex \
libglib2.0-dev \
libgtk-3-dev \
libpixman-1-dev \
python3-dev \
python3-setuptools \
# Packages for AFL++-QEMU.
ninja-build \
# Packages for Honggfuzz.
binutils-dev \
libblocksruntime-dev \
libunwind-dev \
# Packages for PASTIS.
libmagic1 && \
DEBIAN_FRONTEND="noninteractive" \
apt-get install -y --no-install-suggests --no-install-recommends \
# Packages for AFL++-QEMU.
gcc-$(gcc --version|head -n1|sed 's/\..*//'|sed 's/.* //')-plugin-dev \
libstdc++-$(gcc --version|head -n1|sed 's/\..*//'|sed 's/.* //')-dev
# Download, compile and install AFLplusplus.
RUN git clone https://github.com/AFLplusplus/AFLplusplus && \
cd AFLplusplus && \
CC=clang make && \
cd qemu_mode && \
./build_qemu_support.sh && \
cd .. && \
make install && \
cd .. && \
rm -rf AFLplusplus
# Copy Honggfuzz PASTIS patch.
RUN mkdir patches
COPY engines/patches/honggfuzz-5a504b49-pastis.patch patches/honggfuzz-5a504b49-pastis.patch
# Download, patch, compile and install Honggfuzz.
RUN git clone https://github.com/google/honggfuzz.git honggfuzz-5a504b49 && \
cd honggfuzz-5a504b49 && \
git checkout 5a504b49fe829a73b6ea88214d8e4bcf3d103d4f && \
cd .. && \
patch -s -p0 < patches/honggfuzz-5a504b49-pastis.patch && \
cd honggfuzz-5a504b49 && \
CFLAGS="-O3 -funroll-loops" make && \
make install && \
cd .. && \
rm -rf honggfuzz-5a504b49 patches
# Download and install PASTIS
RUN git clone https://github.com/quarkslab/pastis.git && \
cd pastis && \
pip install . && \
cd .. && \
rm -rf pastis
# Clean up.
RUN pip cache purge
# Set environment variables.
ENV AFLPP_PATH=/usr/local/bin
ENV HFUZZ_PATH=/usr/local/bin
# Add new user.
RUN adduser --disabled-password --gecos '' pastis-user && \
adduser pastis-user sudo && \
echo 'pastis-user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# Switch to the new user.
USER pastis-user
# Set work directory.
WORKDIR /workspace