Skip to content

Commit

Permalink
Improve Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
cnheitman committed Jul 2, 2024
1 parent a811e1d commit 326ec6a
Showing 1 changed file with 39 additions and 52 deletions.
91 changes: 39 additions & 52 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,50 +1,45 @@
FROM ubuntu:22.04

# Download and install basic dependencies.
RUN apt-get update

RUN DEBIAN_FRONTEND="noninteractive" \
# 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

# Download and install Honggfuzz dependencies.
RUN DEBIAN_FRONTEND="noninteractive" \
apt-get install -y --no-install-suggests --no-install-recommends \
clang \
libbfd-dev \
libunwind-dev \
libunwind8-dev

#
# AFLplusplus
#

RUN DEBIAN_FRONTEND="noninteractive" \
apt-get install -y --no-install-suggests --no-install-recommends \
build-essential \
python3-dev \
python3-setuptools \
unzip \
vim \
# Packages for AFL++.
automake \
bison \
cmake \
git \
flex \
bison \
libglib2.0-dev \
libpixman-1-dev \
cargo \
libgtk-3-dev \
# for QEMU mode
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

Expand All @@ -55,20 +50,11 @@ RUN git clone https://github.com/AFLplusplus/AFLplusplus && \
cd qemu_mode && \
./build_qemu_support.sh && \
cd .. && \
make install

#
# Honggfuzz
#

RUN DEBIAN_FRONTEND="noninteractive" \
apt-get install -y --no-install-suggests --no-install-recommends \
libbfd-dev \
libblocksruntime-dev \
liblzma-dev \
libunwind-dev
make install && \
cd .. && \
rm -rf AFLplusplus

# Copy honggfuzz PASTIS patch.
# Copy Honggfuzz PASTIS patch.
RUN mkdir patches
COPY engines/pastis-honggfuzz/patches/honggfuzz-5a504b49-pastis.patch patches/honggfuzz-5a504b49-pastis.patch

Expand All @@ -80,21 +66,21 @@ RUN git clone https://github.com/google/honggfuzz.git honggfuzz-5a504b49 && \
patch -s -p0 < patches/honggfuzz-5a504b49-pastis.patch && \
cd honggfuzz-5a504b49 && \
CFLAGS="-O3 -funroll-loops" make && \
make install

#
# PASTIS
#

RUN DEBIAN_FRONTEND="noninteractive" \
apt-get install -y --no-install-suggests --no-install-recommends \
libmagic1 \
python-is-python3
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 .
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

Expand All @@ -106,4 +92,5 @@ RUN adduser --disabled-password --gecos '' pastis-user && \
# Switch to the new user.
USER pastis-user

# Set work directory.
WORKDIR /workspace

0 comments on commit 326ec6a

Please sign in to comment.