Repository:
https://gitlab.com/gitlab-org/security-products/protocol-fuzzer-ce
Modify from a dockerfile based on DEBIAN: https://raw.githubusercontent.com/vanhauser-thc/peachpro/main/Dockerfile
shell
sudo apt update
sudo apt install -y \
coreutils apt-utils wget curl openssl ca-certificates bash-completion \
joe vim nano \
unzip p7zip \
hping3 httping thc-ipv6 gdb \
tcpdump wireshark-common \
locales-all \
git build-essential joe vim strace tcpdump python python-pip python-is-python2\
ruby doxygen libxml2-utils less openjdk-8-jre xsltproc asciidoctor \
nodejs node-typescript wget \
apt-transport-https dirmngr gnupg libtool-bin \
cmake dos2unix g++-multilib --fix-missing
cd ~/Downloads
git clone https://gitlab.com/gitlab-org/security-products/protocol-fuzzer-ce
cd protocol-fuzzer-ce
git checkout 5697f699dc43593d69c44b8521a50976dfff266e
cd paket/.paket
wget https://github.com/fsprojects/Paket/releases/download/5.257.0/paket.bootstrapper.exe
wget https://github.com/fsprojects/Paket/releases/download/5.257.0/paket.targets
wget https://github.com/fsprojects/Paket/releases/download/5.257.0/paket.exe
wget https://github.com/fsprojects/Paket/releases/download/5.257.0/Paket.Restore.targets
cd ../../
wget https://software.intel.com/sites/landingpage/pintool/downloads/pin-3.20-98437-gf02b61307-gcc-linux.tar.gz
mv pin-3.20-98437-gf02b61307-gcc-linux.tar.gz 3rdParty/pin/
cd 3rdParty/pin/
tar -xf pin-3.20-98437-gf02b61307-gcc-linux.tar.gz
cd ../../
sed -i s/pin-3.19-98425-gcc-linux/pin-3.20-98437-gf02b61307-gcc-linux/g build/config/linux.py
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
# switch to root
sudo su
echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" > /etc/apt/sources.list.d/mono-official-stable.list
exit
# exit root
sudo apt update -y
sudo apt install -y mono-devel
mozroots --import --sync
# check the mono version, should by 6.12.0
mono --version
sed -i '/^int main.*/itemplate<bool b>\nstruct StaticAssert {};\ntemplate <>\nstruct StaticAssert<true>\n{\n static void myassert() {}\n};\n' core/BasicBlocks/bblocks.cpp
sed -i 's/STATIC_ASSERT(sizeof(size_t) == sizeof(ADDRINT))/StaticAssert<sizeof(size_t) == sizeof(ADDRINT)>::myassert()/g' core/BasicBlocks/bblocks.cpp
./waf configure
./waf build
# Downgrade mono back to 4.x for installation and runtime
sudo apt purge -y mono* libmono* doxygen
sudo rm /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update -y
sudo apt install -y mono-complete
./waf install
# install binary is in ./output/linux_x86_64_release/bin
# copy to peach dir
cp -r output/linux_x86_64_release/bin /your_own_dir/to/peach
cp -r output/doc/sdk /your_own_dir/peach/doc
dockerfile
FROM ubuntu:18.04 AS peachpro
MAINTAINER vh@thc.org
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y \
coreutils apt-utils wget curl openssl ca-certificates bash-completion \
joe vim nano \
unzip p7zip \
hping3 httping thc-ipv6 gdb \
tcpdump wireshark-common \
locales-all \
git build-essential joe vim strace tcpdump python python-pip \
ruby doxygen libxml2-utils less openjdk-8-jre xsltproc asciidoctor \
nodejs node-typescript wget \
apt-transport-https dirmngr gnupg libtool-bin \
cmake dos2unix g++-multilib --fix-missing
RUN git clone https://gitlab.com/gitlab-org/security-products/protocol-fuzzer-ce
# Pin to a known version
RUN cd protocol-fuzzer-ce && \
git checkout 5697f699dc43593d69c44b8521a50976dfff266e
RUN echo "185.199.108.154 github.githubassets.com" >> /etc/hosts
RUN echo "140.82.112.22 central.github.com" >> /etc/hosts
RUN echo "185.199.108.133 desktop.githubusercontent.com" >> /etc/hosts
RUN echo "185.199.108.153 assets-cdn.github.com" >> /etc/hosts
RUN echo "185.199.108.133 camo.githubusercontent.com" >> /etc/hosts
RUN echo "185.199.108.133 github.map.fastly.net" >> /etc/hosts
RUN echo "199.232.69.194 github.global.ssl.fastly.net" >> /etc/hosts
RUN echo "140.82.114.3 gist.github.com" >> /etc/hosts
RUN echo "185.199.108.153 github.io" >> /etc/hosts
RUN echo "140.82.114.4 github.com" >> /etc/hosts
RUN echo "140.82.113.6 api.github.com" >> /etc/hosts
RUN echo "185.199.108.133 raw.githubusercontent.com" >> /etc/hosts
RUN echo "185.199.108.133 user-images.githubusercontent.com" >> /etc/hosts
RUN echo "185.199.108.133 favicons.githubusercontent.com" >> /etc/hosts
RUN echo "185.199.108.133 avatars5.githubusercontent.com" >> /etc/hosts
RUN echo "185.199.108.133 avatars4.githubusercontent.com" >> /etc/hosts
RUN echo "185.199.108.133 avatars3.githubusercontent.com" >> /etc/hosts
RUN echo "185.199.108.133 avatars2.githubusercontent.com" >> /etc/hosts
RUN echo "185.199.108.133 avatars1.githubusercontent.com" >> /etc/hosts
RUN echo "185.199.108.133 avatars0.githubusercontent.com" >> /etc/hosts
RUN echo "185.199.108.133 avatars.githubusercontent.com" >> /etc/hosts
RUN echo "140.82.112.10 codeload.github.com" >> /etc/hosts
RUN echo "52.217.44.188 github-cloud.s3.amazonaws.com" >> /etc/hosts
RUN echo "52.217.33.196 github-com.s3.amazonaws.com" >> /etc/hosts
RUN echo "52.216.93.147 github-production-release-asset-2e65be.s3.amazonaws.com" >> /etc/hosts
RUN echo "52.216.93.147 github-production-user-asset-6210df.s3.amazonaws.com" >> /etc/hosts
RUN echo "52.217.207.33 github-production-repository-file-5c1aeb.s3.amazonaws.com" >> /etc/hosts
RUN echo "185.199.108.153 githubstatus.com" >> /etc/hosts
RUN echo "64.71.144.211 github.community" >> /etc/hosts
RUN echo "185.199.108.133 media.githubusercontent.com" >> /etc/hosts
RUN echo "185.199.108.133 objects.githubusercontent.com" >> /etc/hosts
RUN echo "185.199.108.133 raw.github.com" >> /etc/hosts
# Get specific mono packages
WORKDIR /protocol-fuzzer-ce/paket/.paket
RUN wget https://github.com/fsprojects/Paket/releases/download/5.257.0/paket.bootstrapper.exe
RUN wget https://github.com/fsprojects/Paket/releases/download/5.257.0/paket.targets
RUN wget https://github.com/fsprojects/Paket/releases/download/5.257.0/paket.exe
RUN wget https://github.com/fsprojects/Paket/releases/download/5.257.0/Paket.Restore.targets
WORKDIR /protocol-fuzzer-ce
# Download new PIN and change PIN version in build config
RUN wget https://software.intel.com/sites/landingpage/pintool/downloads/pin-3.20-98437-gf02b61307-gcc-linux.tar.gz
RUN mv pin-3.20-98437-gf02b61307-gcc-linux.tar.gz 3rdParty/pin/
RUN cd 3rdParty/pin/ && tar -xf pin-3.20-98437-gf02b61307-gcc-linux.tar.gz
RUN sed -i s/pin-3.19-98425-gcc-linux/pin-3.20-98437-gf02b61307-gcc-linux/g build/config/linux.py
# && \
# mv pin-3.20-98437-gf02b61307-gcc-linux pin-3.2-98437-gcc-linux
#RUN sed -i s/pin-3.19-98425-gcc-linux/pin-3.2-98437-gcc-linux/g build/config/linux.py
#RUN cd 3rdParty/pin/ && tar xzf pin-3.20-98437-gf02b61307-gcc-linux.tar.gz && \
# mv pin-3.20-98437-gf02b61307-gcc-linux pin-3.2-98437-gcc-linux
#RUN sed -i s/pin-3.2-81205-gcc-linux/pin-3.20-98437-gf02b61307-gcc-linux/g build/config/linux.py
# Install specific mono for compiling
# RUN apt install dirmngr gnupg apt-transport-https ca-certificates -y
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
RUN echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" > /etc/apt/sources.list.d/mono-official-stable.list
RUN apt-get update -y
RUN apt-get install -y mono-devel
RUN mozroots --import --sync
RUN mono --version
# Patch bblocks.cpp
# https://gitlab.com/gitlab-org/security-products/protocol-fuzzer-ce/-/issues/1
# https://gitlab.com/gitlab-org/security-products/protocol-fuzzer-ce/-/merge_requests/7
RUN sed -i '/^int main.*/itemplate<bool b>\nstruct StaticAssert {};\ntemplate <>\nstruct StaticAssert<true>\n{\n static void myassert() {}\n};\n' core/BasicBlocks/bblocks.cpp
RUN sed -i 's/STATIC_ASSERT(sizeof(size_t) == sizeof(ADDRINT))/StaticAssert<sizeof(size_t) == sizeof(ADDRINT)>::myassert()/g' core/BasicBlocks/bblocks.cpp
# Patch BaseProgram.cs error CS0219: Warning as Error: The variable `config' is assigned but its value is never used
# https://gitlab.com/gitlab-org/security-products/protocol-fuzzer-ce/-/issues/3
RUN sed -i 's/var config = new LicenseConfig();/\/\/var config = new LicenseConfig();/g' pro/Core/Runtime/BaseProgram.cs
# Configure and build
RUN ./waf configure
RUN ./waf build
# Downgrade mono back to 4.x for installation and runtime
# The installed mono version 6.12.0.122 (tarball Mon Feb 22 17:33:15 UTC 2021) is not supported.
# Ensure mono version 4.x and not 4.4 is installed and try again.
RUN apt purge -y mono* libmono* doxygen && \
rm /etc/apt/sources.list.d/mono-official-stable.list
RUN apt update -y
RUN apt install -y mono-complete
RUN ./waf install
RUN cp -r output/linux_x86_64_release/bin /peach
RUN cp -r output/doc/sdk /peach/doc