Removed old build scripts

This commit is contained in:
takeshix 2020-07-15 22:15:09 +02:00
parent 2e95cb4f0f
commit 047017e200
24 changed files with 0 additions and 1474 deletions

26
Vagrantfile vendored
View file

@ -1,26 +0,0 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/artful64"
config.vm.provider "virtualbox" do |vb|
vb.memory = "4096"
vb.cpus = 4
end
config.vm.provision "shell", inline: <<-SHELL
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" > /etc/apt/sources.list.d/docker.list
apt update
apt install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
apt install -y docker-engine
service docker start
apt install -y python3-pip
pip3 install --upgrade pip
pip3 install docker-compose
systemctl daemon-reload
systemctl restart docker
apt install -y qemu
SHELL
end

View file

@ -1,61 +0,0 @@
#!/bin/bash
if [ $# -lt 2 ];then
echo "Usage: ${0} <commit> <version?" >&2
echo "Example: ${0} b5bd185 7.70SVN" >&2
exit 2
fi
commit=$1
version=$2
architectures=(aarch64 armhf x86 x86_64)
tmp_dir=$(mktemp -dt packaging.XXXXXX)
trap exit_script EXIT TERM
exit_script(){
rm -rf "$tmp_dir"
}
echo "tmp_dir: ${tmp_dir}"
for arch in "${architectures[@]}";do
arch_dir="${tmp_dir}/nmap-${version}-${commit}-${arch}-portable"
mkdir -p "$arch_dir"
find ../bin/linux/${arch}/ -name "*-${commit}" -exec cp {} "${arch_dir}" \;
echo "version: ${version}"
ls -la "$arch_dir"
if [ -s "${arch_dir}/nmap-${version}-${commit}" ];then
mv "${arch_dir}/nmap-${version}-${commit}" "${arch_dir}/nmap"
mv "${arch_dir}/ncat-${version}-${commit}" "${arch_dir}/ncat"
# Note: Nping version starts with "0.".
mv "${arch_dir}/nping-0.${version}-${commit}" "${arch_dir}/nping"
elif [ -s "${arch_dir}/nmap-${commit}" ];then
mv "${arch_dir}/nmap-${commit}" "${arch_dir}/nmap"
mv "${arch_dir}/ncat-${commit}" "${arch_dir}/ncat"
mv "${arch_dir}/nping-${commit}" "${arch_dir}/nping"
else
echo "Nmap binaries for ${arch} not found!"
read
continue
fi
if [ -d "../data/nmap-data-${version}-${commit}" ];then
cp -r "../data/nmap-data-${version}-${commit}" "${arch_dir}/data"
elif [ -d "../data/nmap-data-0.${version}-${commit}" ];then
cp -r "../data/nmap-data-0.${version}-${commit}" "${arch_dir}/data"
else
echo "Nmap data directory not found!"
read
continue
fi
cp run-nmap.sh "$arch_dir"
tar czf "${tmp_dir}/nmap-${version}-${commit}-${arch}-portable.tar.gz" -C "$tmp_dir" "nmap-${version}-${commit}-${arch}-portable"
cd "$tmp_dir"
zip -r -q "${tmp_dir}/nmap-${version}-${commit}-${arch}-portable.zip" "nmap-${version}-${commit}-${arch}-portable"
cd -
rm -rf "$arch_dir"
done
echo "Finished packing. Got the following releases:"
ls -la "$tmp_dir"
echo "Ready to copy them. Press CTRL+C to arbort, RETURN to continue...."
read
cp "${tmp_dir}/"* ../packaged

View file

@ -1,3 +0,0 @@
$allArgs = $PsBoundParameters.Values + $args
$env:NMAPDIR = "data"
.\nmap.exe $allArgs

View file

@ -1,4 +0,0 @@
#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
NMAPDIR="$SCRIPT_DIR/data" "$SCRIPT_DIR/nmap" $@

View file

@ -1,28 +0,0 @@
# GDB
## Build Linux x86
```
sudo docker build -t static-toolbox-gdb-x86 .
sudo docker run -v $(pwd)/output:/output static-toolbox-gdb-x86
```
## Build Linux x86_64
```
sudo docker build -t static-toolbox-gdb-x86-64 .
sudo docker run -v $(pwd)/output:/output static-toolbox-gdb-x86-64
```
## Build Linux armhf
```
sudo docker build -t static-toolbox-gdb-armhf .
sudo docker run -v $(pwd)/output:/output static-toolbox-gdb-armhf
```
## Build Linux aarch64
```
sudo docker build -t static-toolbox-gdb-aarch64 .
sudo docker run -v $(pwd)/output:/output static-toolbox-gdb-aarch64

View file

@ -1,25 +0,0 @@
FROM ubuntu:xenial
RUN apt-get update && \
apt upgrade -yy && \
apt install -yy \
automake \
cmake \
build-essential \
checkinstall \
libgmp-dev \
libmpfr-dev \
libmpc-dev \
wget \
git \
pkg-config \
python \
binutils-dev \
lib32z1-dev \
byacc \
flex \
texinfo \
qemu
RUN mkdir /build
ADD . /build
RUN chmod +x /build/build_aarch64.sh
CMD /build/build_aarch64.sh

View file

@ -1,146 +0,0 @@
#!/bin/bash
#set -e
set -o pipefail
set -x
NMAP_COMMIT=
fetch(){
if [ ! -d "/build/musl" ];then
#git clone https://github.com/GregorR/musl-cross.git /build/musl
git clone https://github.com/takeshixx/musl-cross.git /build/musl
fi
if [ ! -d "/build/binutils-gdb" ];then
git clone https://github.com/bminor/binutils-gdb.git /build/binutils-gdb
fi
cd /build/binutils-gdb
git checkout binutils-2_30
cd -
}
build_musl_aarch64() {
cd /build/musl
git clean -fdx
echo "ARCH=arm64" >> config.sh
echo "GCC_BUILTIN_PREREQS=yes" >> config.sh
echo "TRIPLE=aarch64-linux-musleabi" >> config.sh
./build.sh
echo "[+] Finished building musl-cross aarch64"
}
build_gdb_aarch64() {
cd /build/binutils-gdb
git clean -fdx
make clean || true
cd /build/binutils-gdb/bfd
CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static -fPIC' \
CXX='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-ld \
./configure \
--host=x86_64-linux-gnu \
--target=aarch64-none-linux-gnueabi
make -j4
cd /build/binutils-gdb/readline
CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static -fPIC' \
CXX='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-ld \
./configure \
--host=x86_64-linux-gnu \
--target=aarch64-none-linux-gnueabi \
--disable-shared \
--enable-static
make -j4
cd /build/binutils-gdb/opcodes
CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static -fPIC' \
CXX='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-ld \
./configure \
--host=x86_64-linux-gnu \
--target=aarch64-none-linux-gnueabi \
--disable-shared \
--enable-static
make -j4
cd /build/binutils-gdb/libiberty
CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static -fPIC' \
CXX='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-ld \
./configure \
--host=x86_64-linux-gnu \
--target=aarch64-none-linux-gnueabi \
--disable-shared \
--enable-static
make -j4
cd /build/binutils-gdb/libdecnumber
CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static -fPIC' \
CXX='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-ld \
./configure \
--host=x86_64-linux-gnu \
--target=aarch64-none-linux-gnueabi \
--disable-shared \
--enable-static
make -j4
cd /build/binutils-gdb/zlib
CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static -fPIC' \
CXX='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-g++ -static -static-libstdc++ -fPIC' \
cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_LINKER=/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-ld .
make zlibstatic
cd /build/binutils-gdb/gdb
CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static -fPIC' \
CXX='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-ld \
LDFLAGS='-static' \
./configure \
--enable-static=yes \
--host=x86_64-linux-gnu \
--target=aarch64-none-linux-gnueabi \
--disable-interprocess-agent
make -j4
cd /build/binutils-gdb/gdb/gdbserver/
CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static -fPIC' \
CXX='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-ld \
LDFLAGS='-static' \
./configure \
--enable-static=yes \
--host=x86_64-linux-gnu \
--target=aarch64-none-linux-gnueabi \
--disable-interprocess-agent
make -j4
/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-strip /build/binutils-gdb/gdb/gdb /build/binutils-gdb/gdb/gdbserver/gdbserver
}
build_aarch64(){
OUT_DIR=/output/`uname | tr 'A-Z' 'a-z'`/aarch64
mkdir -p $OUT_DIR
build_musl_aarch64
build_gdb_aarch64
GDB_VERSION=
GDBSERVER_VERSION=
if which qemu-aarch64 >/dev/null;then
GDB_VERSION="-$(qemu-aarch64 /build/binutils-gdb/gdb/gdb --version |head -n1 |awk '{print $4}')"
GDBSERVER_VERSION="-$(qemu-aarch64 /build/binutils-gdb/gdb/gdbserver/gdbserver --version |head -n1 |awk '{print $4}')"
fi
cp /build/binutils-gdb/gdb/gdb "${OUT_DIR}/gdb-aarch64${GDB_VERSION}"
cp /build/binutils-gdb/gdb/gdbserver/gdbserver "${OUT_DIR}/gdbserver-aarch64${GDBSERVER_VERSION}"
echo "[+] Finished building aarch64"
}
main() {
if [ ! -d "/output" ];then
echo "[-] /output does not exist, creating it"
mkdir /output
fi
fetch
build_aarch64
}
main

View file

@ -1,25 +0,0 @@
FROM ubuntu:xenial
RUN apt-get update && \
apt upgrade -yy && \
apt install -yy \
automake \
cmake \
build-essential \
checkinstall \
libgmp-dev \
libmpfr-dev \
libmpc-dev \
wget \
git \
pkg-config \
python \
binutils-dev \
lib32z1-dev \
byacc \
flex \
texinfo \
qemu
RUN mkdir /build
ADD . /build
RUN chmod +x /build/build_armhf.sh
CMD /build/build_armhf.sh

View file

@ -1,148 +0,0 @@
#!/bin/bash
#set -e
set -o pipefail
set -x
NMAP_COMMIT=
fetch(){
if [ ! -d "/build/musl" ];then
#git clone https://github.com/GregorR/musl-cross.git /build/musl
git clone https://github.com/takeshixx/musl-cross.git /build/musl
fi
if [ ! -d "/build/binutils-gdb" ];then
git clone https://github.com/bminor/binutils-gdb.git /build/binutils-gdb
fi
cd /build/binutils-gdb
git checkout binutils-2_30
cd -
}
build_musl_armhf() {
cd /build/musl
git clean -fdx
echo "ARCH=arm" >> config.sh
echo "GCC_BUILTIN_PREREQS=yes" >> config.sh
echo "TRIPLE=arm-linux-musleabihf" >> config.sh
echo "GCC_BOOTSTRAP_CONFFLAGS='--with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16'" >> config.sh
echo "GCC_CONFFLAGS='--with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16'" >> config.sh
./build.sh
echo "[+] Finished building musl-cross armhf"
}
build_gdb_armhf() {
cd /build/binutils-gdb
git clean -fdx
make clean || true
cd /build/binutils-gdb/bfd
CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static -fPIC' \
CXX='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-ld \
./configure \
--host=x86_64-linux-gnu \
--target=arm-none-linux-gnueabi
make -j4
cd /build/binutils-gdb/readline
CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static -fPIC' \
CXX='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-ld \
./configure \
--host=x86_64-linux-gnu \
--target=arm-none-linux-gnueabi \
--disable-shared \
--enable-static
make -j4
cd /build/binutils-gdb/opcodes
CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static -fPIC' \
CXX='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-ld \
./configure \
--host=x86_64-linux-gnu \
--target=arm-none-linux-gnueabi \
--disable-shared \
--enable-static
make -j4
cd /build/binutils-gdb/libiberty
CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static -fPIC' \
CXX='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-ld \
./configure \
--host=x86_64-linux-gnu \
--target=arm-none-linux-gnueabi \
--disable-shared \
--enable-static
make -j4
cd /build/binutils-gdb/libdecnumber
CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static -fPIC' \
CXX='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-ld \
./configure \
--host=x86_64-linux-gnu \
--target=arm-none-linux-gnueabi \
--disable-shared \
--enable-static
make -j4
cd /build/binutils-gdb/zlib
CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static -fPIC' \
CXX='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -static -static-libstdc++ -fPIC' \
cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_LINKER=/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-ld .
make zlibstatic
cd /build/binutils-gdb/gdb
CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static -fPIC' \
CXX='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-ld \
LDFLAGS='-static' \
./configure \
--enable-static=yes \
--host=x86_64-linux-gnu \
--target=arm-none-linux-gnueabi \
--disable-interprocess-agent
make -j4
cd /build/binutils-gdb/gdb/gdbserver/
CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static -fPIC' \
CXX='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-ld \
LDFLAGS='-static' \
./configure \
--host=x86_64-linux-gnu \
--target=arm-none-linux-gnueabi \
--enable-static=yes \
--disable-interprocess-agent
make -j4
/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-strip /build/binutils-gdb/gdb/gdb /build/binutils-gdb/gdb/gdbserver/gdbserver
}
build_armhf(){
OUT_DIR=/output/`uname | tr 'A-Z' 'a-z'`/armhf
mkdir -p $OUT_DIR
build_musl_armhf
build_gdb_armhf
GDB_VERSION=
GDBSERVER_VERSION=
if which qemu-arm >/dev/null;then
GDB_VERSION="-$(qemu-arm /build/binutils-gdb/gdb/gdb --version |head -n1 |awk '{print $4}')"
GDBSERVER_VERSION="-$(qemu-arm /build/binutils-gdb/gdb/gdbserver/gdbserver --version |head -n1 |awk '{print $4}')"
fi
cp /build/binutils-gdb/gdb/gdb "${OUT_DIR}/gdb-armhf${GDB_VERSION}"
cp /build/binutils-gdb/gdb/gdbserver/gdbserver "${OUT_DIR}/gdbserver-armhf${GDBSERVER_VERSION}"
echo "[+] Finished building armhf"
}
main() {
if [ ! -d "/output" ];then
echo "[-] /output does not exist, creating it"
mkdir /output
fi
fetch
build_armhf
}
main

View file

@ -1,24 +0,0 @@
FROM ubuntu:xenial
RUN apt-get update && \
apt upgrade -yy && \
apt install -yy \
automake \
cmake \
build-essential \
checkinstall \
libgmp-dev \
libmpfr-dev \
libmpc-dev \
wget \
git \
pkg-config \
python \
binutils-dev \
lib32z1-dev \
byacc \
flex \
texinfo
RUN mkdir /build
ADD . /build
RUN chmod +x /build/build_x86.sh
CMD /build/build_x86.sh

View file

@ -1,134 +0,0 @@
#!/bin/bash
set -e
set -o pipefail
set -x
NMAP_COMMIT=
fetch(){
if [ ! -d "/build/musl" ];then
#git clone https://github.com/GregorR/musl-cross.git /build/musl
git clone https://github.com/takeshixx/musl-cross.git /build/musl
fi
if [ ! -d "/build/binutils-gdb" ];then
git clone https://github.com/bminor/binutils-gdb.git /build/binutils-gdb
fi
cd /build/binutils-gdb
git checkout binutils-2_30
cd -
}
build_musl_x86() {
cd /build/musl
git clean -fdx
echo "ARCH=i486" >> config.sh
echo "GCC_BUILTIN_PREREQS=yes" >> config.sh
./build.sh
echo "[+] Finished building musl-cross x86"
}
build_gdb_x86() {
cd /build/binutils-gdb
git clean -fdx
make clean || true
cd /build/binutils-gdb/bfd
CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static -fPIC' \
CXX='/opt/cross/i486-linux-musl/bin/i486-linux-musl-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/i486-linux-musl/bin/i486-linux-musl-ld \
LDFLAGS="" \
./configure
make -j4
cd /build/binutils-gdb/readline
CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static -fPIC' \
CXX='/opt/cross/i486-linux-musl/bin/i486-linux-musl-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/i486-linux-musl/bin/i486-linux-musl-ld \
./configure \
--target=i686-linux-gnu \
--disable-shared \
--enable-static
make -j4
cd /build/binutils-gdb/opcodes
CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static -fPIC' \
CXX='/opt/cross/i486-linux-musl/bin/i486-linux-musl-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/i486-linux-musl/bin/i486-linux-musl-ld \
./configure \
--target=i686-linux-gnu \
--disable-shared \
--enable-static
make -j4
cd /build/binutils-gdb/libiberty
CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static -fPIC' \
CXX='/opt/cross/i486-linux-musl/bin/i486-linux-musl-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/i486-linux-musl/bin/i486-linux-musl-ld \
./configure \
--target=i686-linux-gnu \
--disable-shared \
--enable-static
make -j4
cd /build/binutils-gdb/libdecnumber
CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static -fPIC' \
CXX='/opt/cross/i486-linux-musl/bin/i486-linux-musl-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/i486-linux-musl/bin/i486-linux-musl-ld \
./configure \
--target=i686-linux-gnu \
--disable-shared \
--enable-static
make -j4
cd /build/binutils-gdb/zlib
CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static -fPIC' \
CXX='/opt/cross/i486-linux-musl/bin/i486-linux-musl-g++ -static -static-libstdc++ -fPIC' \
cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_LINKER=/opt/cross/i486-linux-musl/bin/i486-linux-musl-ld .
make zlibstatic
cd /build/binutils-gdb/gdb
CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -m32 -static -fPIC' \
CXX='/opt/cross/i486-linux-musl/bin/i486-linux-musl-g++ -m32 -static -static-libstdc++ -fPIC' \
LD=/opt/cross/i486-linux-musl/bin/i486-linux-musl-ld \
./configure \
--enable-static=yes \
--host=x86_64-linux-gnu \
--target=i686-linux-gnu \
--disable-interprocess-agent
make -j4
cd /build/binutils-gdb/gdb/gdbserver/
CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -m32 -static -fPIC' \
CXX='/opt/cross/i486-linux-musl/bin/i486-linux-musl-g++ -m32 -static -static-libstdc++ -fPIC' \
LD=/opt/cross/i486-linux-musl/bin/i486-linux-musl-ld \
./configure \
--enable-static=yes \
--host=x86_64-linux-gnu \
--target=i686-linux-gnu \
--disable-interprocess-agent
make -j4
/opt/cross/i486-linux-musl/bin/i486-linux-musl-strip /build/binutils-gdb/gdb/gdb /build/binutils-gdb/gdb/gdbserver/gdbserver
}
build_x86(){
OUT_DIR=/output/`uname | tr 'A-Z' 'a-z'`/x86
mkdir -p $OUT_DIR
build_musl_x86
build_gdb_x86
GDB_VERSION="-$(/build/binutils-gdb/gdb/gdb --version |head -n1 |awk '{print $4}')"
GDBSERVER_VERSION="-$(/build/binutils-gdb/gdb/gdbserver/gdbserver --version |head -n1 |awk '{print $4}')"
cp /build/binutils-gdb/gdb/gdb "${OUT_DIR}/gdb-x86${GDB_VERSION}"
cp /build/binutils-gdb/gdb/gdbserver/gdbserver "${OUT_DIR}/gdbserver-x86${GDBSERVER_VERSION}"
echo "[+] Finished building x86"
}
main() {
if [ ! -d "/output" ];then
echo "[-] /output does not exist, creating it"
mkdir /output
fi
fetch
build_x86
}
main

View file

@ -1,24 +0,0 @@
FROM ubuntu:xenial
RUN apt-get update && \
apt upgrade -yy && \
apt install -yy \
automake \
cmake \
build-essential \
checkinstall \
libgmp-dev \
libmpfr-dev \
libmpc-dev \
wget \
git \
pkg-config \
python \
binutils-dev \
lib32z1-dev \
byacc \
flex \
texinfo
RUN mkdir /build
ADD . /build
RUN chmod +x /build/build_x86_64.sh
CMD /build/build_x86_64.sh

View file

@ -1,132 +0,0 @@
#!/bin/bash
set -e
set -o pipefail
set -x
NMAP_COMMIT=
fetch(){
if [ ! -d "/build/musl" ];then
#git clone https://github.com/GregorR/musl-cross.git /build/musl
git clone https://github.com/takeshixx/musl-cross.git /build/musl
fi
if [ ! -d "/build/binutils-gdb" ];then
git clone https://github.com/bminor/binutils-gdb.git /build/binutils-gdb
fi
cd /build/binutils-gdb
git checkout binutils-2_30
cd -
}
build_musl_x86_64() {
cd /build/musl
git clean -fdx
./build.sh
echo "[+] Finished building musl-cross x86_64"
}
build_gdb_x86_64() {
cd /build/binutils-gdb
git clean -fdx
make clean || true
cd /build/binutils-gdb/bfd
CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \
CXX='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-ld \
LDFLAGS="" \
./configure
make -j4
cd /build/binutils-gdb/readline
CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \
CXX='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-ld \
./configure \
--target=x86_64-linux-gnu \
--disable-shared \
--enable-static
make -j4
cd /build/binutils-gdb/opcodes
CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \
CXX='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-ld \
./configure \
--target=x86_64-linux-gnu \
--disable-shared \
--enable-static
make -j4
cd /build/binutils-gdb/libiberty
CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \
CXX='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-ld \
./configure \
--target=x86_64-linux-gnu \
--disable-shared \
--enable-static
make -j4
cd /build/binutils-gdb/libdecnumber
CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \
CXX='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-ld \
./configure \
--target=x86_64-linux-gnu \
--disable-shared \
--enable-static
make -j4
cd /build/binutils-gdb/zlib
CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \
CXX='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -static -static-libstdc++ -fPIC' \
cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_LINKER=/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-ld
make zlibstatic
cd /build/binutils-gdb/gdb
CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \
CXX='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-ld \
LDFLAGS='-static' \
./configure \
--enable-static=yes \
--host=x86_64-linux-gnu \
--target=x86_64-linux-gnu \
--disable-interprocess-agent
make -j4
cd /build/binutils-gdb/gdb/gdbserver/
CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \
CXX='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -static -static-libstdc++ -fPIC' \
LD=/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-ld \
LDFLAGS='-static' \
./configure \
--enable-static=yes \
--disable-interprocess-agent
make -j4
/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-strip /build/binutils-gdb/gdb/gdb /build/binutils-gdb/gdb/gdbserver/gdbserver
}
build_x86_64(){
OUT_DIR_x86=/output/`uname | tr 'A-Z' 'a-z'`/x86_64
mkdir -p $OUT_DIR_x86
build_musl_x86_64
build_gdb_x86_64
GDB_VERSION="-$(/build/binutils-gdb/gdb/gdb --version |head -n1 |awk '{print $4}')"
GDBSERVER_VERSION="-$(/build/binutils-gdb/gdb/gdbserver/gdbserver --version |head -n1 |awk '{print $4}')"
cp /build/binutils-gdb/gdb/gdb "${OUT_DIR}/gdb-x86_64${GDB_VERSION}"
cp /build/binutils-gdb/gdb/gdbserver/gdbserver "${OUT_DIR}/gdbserver-x86_64${GDBSERVER_VERSION}"
echo "[+] Finished building x86_64"
}
main() {
if [ ! -d "/output" ];then
echo "[-] /output does not exist, creating it"
mkdir /output
fi
fetch
build_x86_64
}
main

View file

@ -1,37 +0,0 @@
# Nmap
## Build Linux x86
```
sudo docker build -t static-toolbox-nmap-x86 .
sudo docker run -v $(pwd)/output:/output static-toolbox-nmap-x86
```
## Build Linux x86_64
```
sudo docker build -t static-toolbox-nmap-x86-64 .
sudo docker run -v $(pwd)/output:/output static-toolbox-nmap-x86-64
```
## Build Linux armhf
```
sudo docker build -t static-toolbox-nmap-armhf .
sudo docker run -v $(pwd)/output:/output static-toolbox-nmap-armhf
```
## Build Linux aarch64
```
sudo docker build -t static-toolbox-nmap-aarch64 .
sudo docker run -v $(pwd)/output:/output static-toolbox-nmap-aarch64
```
## Using the Nmap data directory
In order to use features like script scanning, we also need the Nmap data files that are typically installed into `/usr/share/nmap`. They are available in the `data/nmap` directory. Just copy this directory to the target system, e.g. into `/tmp/nmap-data` and run Nmap like this:
```
NMAPDIR=/tmp/nmap-data ./nmap
```

View file

@ -1,19 +0,0 @@
FROM ubuntu:xenial
RUN apt-get update && \
apt upgrade -yy && \
apt install -yy \
automake \
cmake \
build-essential \
checkinstall \
libgmp-dev \
libmpfr-dev \
libmpc-dev \
wget \
git \
pkg-config \
python
RUN mkdir /build
ADD . /build
RUN chmod +x /build/build_aarch64.sh
CMD /build/build_aarch64.sh

View file

@ -1,102 +0,0 @@
#!/bin/bash
#set -e
set -o pipefail
set -x
NMAP_COMMIT=
fetch(){
if [ ! -d "/build/musl" ];then
#git clone https://github.com/GregorR/musl-cross.git /build/musl
git clone https://github.com/takeshixx/musl-cross.git /build/musl
fi
if [ ! -d "/build/openssl" ];then
git clone https://github.com/drwetter/openssl-pm-snapshot.git /build/openssl
fi
if [ ! -d "/build/nmap" ];then
git clone https://github.com/nmap/nmap.git /build/nmap
fi
NMAP_COMMIT=$(cd /build/nmap/ && git rev-parse --short HEAD)
}
build_musl_aarch64() {
cd /build/musl
git clean -fdx
echo "ARCH=arm64" >> config.sh
echo "GCC_BUILTIN_PREREQS=yes" >> config.sh
echo "TRIPLE=aarch64-linux-musleabi" >> config.sh
./build.sh
echo "[+] Finished building musl-cross aarch64"
}
build_openssl_aarch64() {
cd /build/openssl
git clean -fdx
make clean
CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static' ./Configure no-shared linux-generic64
make -j4
echo "[+] Finished building OpenSSL aarch64"
}
build_nmap_aarch64() {
cd /build/nmap
git clean -fdx
make clean
cd /build/nmap/libz
CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static -fPIC' \
CXX='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-g++ -static -static-libstdc++ -fPIC' \
cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_LINKER=/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-ld .
make zlibstatic
cd /build/nmap
CC='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-gcc -static -fPIC' \
CXX='/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-g++ -static -static-libstdc++ -fPIC' \
CXXFLAGS="-I/build/nmap/libz" \
LD=/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-ld \
LDFLAGS="-L/build/openssl -L/build/nmap/libz" \
./configure \
--host=aarch64-none-linux-gnueabi \
--without-ndiff \
--without-zenmap \
--without-nmap-update \
--without-libssh2 \
--with-pcap=linux \
--with-libz=/build/nmap/libz \
--with-openssl=/build/openssl \
--with-liblua=included
sed -i -e 's/shared\: /shared\: #/' libpcap/Makefile
sed -i 's|LIBS = |& libz/libz.a |' Makefile
make -j4
if [ ! -f "/build/nmap/nmap" -o ! -f "/build/nmap/ncat/ncat" -o ! -f "/build/nmap/nping/nping" ];then
echo "[-] Building Nmap armhf failed!"
exit 1
fi
if [ -f "/build/nmap/nmap" -a -f "/build/nmap/ncat/ncat" -a -f "/build/nmap/nping/nping" ];then
/opt/cross/aarch64-linux-musleabi/bin/aarch64-linux-musleabi-strip nmap ncat/ncat nping/nping
fi
}
build_aarch64(){
OUT_DIR_AARCH64=/output/`uname | tr 'A-Z' 'a-z'`/aarch64
mkdir -p $OUT_DIR_AARCH64
build_musl_aarch64
build_openssl_aarch64
build_nmap_aarch64
if [ ! -f "/build/nmap/nmap" -o ! -f "/build/nmap/ncat/ncat" -o ! -f "/build/nmap/nping/nping" ];then
echo "[-] Building Nmap aarch64 failed!"
exit 1
fi
cp /build/nmap/nmap "${OUT_DIR_AARCH64}/nmap-${NMAP_COMMIT}"
cp /build/nmap/ncat/ncat "${OUT_DIR_AARCH64}/ncat-${NMAP_COMMIT}"
cp /build/nmap/nping/nping "${OUT_DIR_AARCH64}/nping-${NMAP_COMMIT}"
echo "[+] Finished building Nmap aarch64"
}
main() {
if [ ! -d "/output" ];then
echo "[-] /output does not exist, creating it"
mkdir /output
fi
fetch
build_aarch64
}
main

View file

@ -1,19 +0,0 @@
FROM ubuntu:xenial
RUN apt-get update && \
apt upgrade -yy && \
apt install -yy \
automake \
cmake \
build-essential \
checkinstall \
libgmp-dev \
libmpfr-dev \
libmpc-dev \
wget \
git \
pkg-config \
python
RUN mkdir /build
ADD . /build
RUN chmod +x /build/build_armhf.sh
CMD /build/build_armhf.sh

View file

@ -1,104 +0,0 @@
#!/bin/bash
#set -e
set -o pipefail
set -x
NMAP_COMMIT=
fetch(){
if [ ! -d "/build/musl" ];then
#git clone https://github.com/GregorR/musl-cross.git /build/musl
git clone https://github.com/takeshixx/musl-cross.git /build/musl
fi
if [ ! -d "/build/openssl" ];then
git clone https://github.com/drwetter/openssl-pm-snapshot.git /build/openssl
fi
if [ ! -d "/build/nmap" ];then
git clone https://github.com/nmap/nmap.git /build/nmap
fi
NMAP_COMMIT=$(cd /build/nmap/ && git rev-parse --short HEAD)
}
build_musl_armhf() {
cd /build/musl
git clean -fdx
echo "ARCH=arm" >> config.sh
echo "GCC_BUILTIN_PREREQS=yes" >> config.sh
echo "TRIPLE=arm-linux-musleabihf" >> config.sh
echo "GCC_BOOTSTRAP_CONFFLAGS='--with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16'" >> config.sh
echo "GCC_CONFFLAGS='--with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16'" >> config.sh
./build.sh
echo "[+] Finished building musl-cross armhf"
}
build_openssl_armhf() {
cd /build/openssl
git clean -fdx
make clean
CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static' ./Configure no-shared linux-generic32
make -j4
echo "[+] Finished building OpenSSL armhf"
}
build_nmap_armhf() {
cd /build/nmap
git clean -fdx
make clean
cd /build/nmap/libz
CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static -fPIC' \
CXX='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -static -static-libstdc++ -fPIC' \
cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_LINKER=/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-ld .
make zlibstatic
cd /build/nmap
CC='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-gcc -static -fPIC' \
CXX='/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-g++ -static -static-libstdc++ -fPIC' \
CXXFLAGS="-I/build/nmap/libz" \
LD=/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-ld \
LDFLAGS="-L/build/openssl -L/build/nmap/libz" \
./configure \
--host=arm-none-linux-gnueabi \
--without-ndiff \
--without-zenmap \
--without-nmap-update \
--without-libssh2 \
--with-pcap=linux \
--with-libz=/build/nmap/libz \
--with-openssl=/build/openssl \
--with-liblua=included
sed -i -e 's/shared\: /shared\: #/' libpcap/Makefile
sed -i 's|LIBS = |& libz/libz.a |' Makefile
make -j4
if [ ! -f "/build/nmap/nmap" -o ! -f "/build/nmap/ncat/ncat" -o ! -f "/build/nmap/nping/nping" ];then
echo "[-] Building Nmap armhf failed!"
exit 1
fi
if [ -f "/build/nmap/nmap" -a -f "/build/nmap/ncat/ncat" -a -f "/build/nmap/nping/nping" ];then
/opt/cross/arm-linux-musleabihf/bin/arm-linux-musleabihf-strip nmap ncat/ncat nping/nping
fi
}
build_armhf(){
OUT_DIR_ARMHF=/output/`uname | tr 'A-Z' 'a-z'`/armhf
mkdir -p $OUT_DIR_ARMHF
build_musl_armhf
build_openssl_armhf
build_nmap_armhf
if [ ! -f "/build/nmap/nmap" -o ! -f "/build/nmap/ncat/ncat" -o ! -f "/build/nmap/nping/nping" ];then
echo "[-] Building Nmap armhf failed!"
exit 1
fi
cp /build/nmap/nmap "${OUT_DIR_ARMHF}/nmap-${NMAP_COMMIT}"
cp /build/nmap/ncat/ncat "${OUT_DIR_ARMHF}/ncat-${NMAP_COMMIT}"
cp /build/nmap/nping/nping "${OUT_DIR_ARMHF}/nping-${NMAP_COMMIT}"
echo "[+] Finished building Nmap armhf"
}
main() {
if [ ! -d "/output" ];then
echo "[-] /output does not exist, creating it"
mkdir /output
fi
fetch
build_armhf
}
main

View file

@ -1,19 +0,0 @@
FROM ubuntu:xenial
RUN apt-get update && \
apt upgrade -yy && \
apt install -yy \
automake \
cmake \
build-essential \
checkinstall \
libgmp-dev \
libmpfr-dev \
libmpc-dev \
wget \
git \
pkg-config \
python
RUN mkdir /build
ADD . /build
RUN chmod +x /build/build_x86.sh
CMD /build/build_x86.sh

View file

@ -1,110 +0,0 @@
#!/bin/bash
#set -e
set -o pipefail
set -x
NMAP_COMMIT=
fetch(){
if [ ! -d "/build/musl" ];then
#git clone https://github.com/GregorR/musl-cross.git /build/musl
git clone https://github.com/takeshixx/musl-cross.git /build/musl
fi
if [ ! -d "/build/openssl" ];then
git clone https://github.com/drwetter/openssl-pm-snapshot.git /build/openssl
fi
if [ ! -d "/build/nmap" ];then
git clone https://github.com/nmap/nmap.git /build/nmap
fi
NMAP_COMMIT=$(cd /build/nmap/ && git rev-parse --short HEAD)
}
build_musl_x86() {
cd /build/musl
git clean -fdx
echo "ARCH=i486" >> config.sh
echo "GCC_BUILTIN_PREREQS=yes" >> config.sh
./build.sh
echo "[+] Finished building musl-cross x86"
}
build_openssl_x86() {
cd /build/openssl
git clean -fdx
make clean
CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static' ./Configure no-shared -m32 linux-generic32
make -j4
echo "[+] Finished building OpenSSL x86"
}
build_nmap_x86() {
cd /build/nmap
git clean -fdx
make clean
cd /build/nmap/libz
CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static -fPIC' \
CXX='/opt/cross/i486-linux-musl/bin/i486-linux-musl-g++ -static -static-libstdc++ -fPIC' \
cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_LINKER=/opt/cross/i486-linux-musl/bin/i486-linux-musl-ld .
make zlibstatic
cd /build/nmap
CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static -fPIC' \
CXX='/opt/cross/i486-linux-musl/bin/i486-linux-musl-g++ -static -static-libstdc++ -fPIC' \
CXXFLAGS="-I/build/nmap/libz" \
LD=/opt/cross/i486-linux-musl/bin/i486-linux-musl-ld \
LDFLAGS="-L/build/openssl -L/build/nmap/libz" \
./configure \
--without-ndiff \
--without-zenmap \
--without-nmap-update \
--without-libssh2 \
--with-pcap=linux \
--with-libz=/build/nmap/libz \
--with-openssl=/build/openssl
sed -i -e 's/shared\: /shared\: #/' libpcap/Makefile
sed -i 's|LIBS = |& libz/libz.a |' Makefile
make -j4
/opt/cross/i486-linux-musl/bin/i486-linux-musl-strip nmap ncat/ncat nping/nping
}
build_x86(){
OUT_DIR_x86=/output/`uname | tr 'A-Z' 'a-z'`/x86
mkdir -p $OUT_DIR_x86
build_musl_x86
build_openssl_x86
build_nmap_x86
if [ ! -f "/build/nmap/nmap" -o ! -f "/build/nmap/ncat/ncat" -o ! -f "/build/nmap/nping/nping" ];then
echo "[-] Building Nmap x86 failed!"
exit 1
fi
NMAP_VERSION=$(/build/nmap/nmap --version |grep "Nmap version" | awk '{print $3}')
NCAT_VERSION=$(/build/nmap/ncat/ncat --version 2>&1 |grep "Ncat: Version" | awk '{print $3}')
NPING_VERSION=$(/build/nmap/nping/nping --version |grep "Nping version" | awk '{print $3}')
cp /build/nmap/nmap "${OUT_DIR_x86}/nmap-${NMAP_VERSION}-${NMAP_COMMIT}"
cp /build/nmap/ncat/ncat "${OUT_DIR_x86}/ncat-${NCAT_VERSION}-${NMAP_COMMIT}"
cp /build/nmap/nping/nping "${OUT_DIR_x86}/nping-${NPING_VERSION}-${NMAP_COMMIT}"
echo "[+] Finished building x86"
}
main() {
if [ ! -d "/output" ];then
echo "[-] /output does not exist, creating it"
mkdir /output
fi
fetch
build_x86
NMAP_DIR=/output/nmap-data-${NPING_VERSION}-${NMAP_COMMIT}
if [ ! -d "$NMAP_DIR" ];then
echo "[-] ${NMAP_DIR} does not exist, creating it"
mkdir -p "${NMAP_DIR}"
fi
if [ -n "$(ls $NMAP_DIR)" ];then
echo "[+] Data directory is not empty"
exit
fi
cd /build/nmap
make install
cp -r /usr/local/share/nmap/* $NMAP_DIR
echo "[+] Copied data to data dir"
}
main

View file

@ -1,19 +0,0 @@
FROM ubuntu:xenial
RUN apt-get update && \
apt upgrade -yy && \
apt install -yy \
automake \
cmake \
build-essential \
checkinstall \
libgmp-dev \
libmpfr-dev \
libmpc-dev \
wget \
git \
pkg-config \
python
RUN mkdir /build
ADD . /build
RUN chmod +x /build/build_x86_64.sh
CMD /build/build_x86_64.sh

View file

@ -1,108 +0,0 @@
#!/bin/bash
#set -e
set -o pipefail
set -x
NMAP_COMMIT=
fetch(){
if [ ! -d "/build/musl" ];then
#git clone https://github.com/GregorR/musl-cross.git /build/musl
git clone https://github.com/takeshixx/musl-cross.git /build/musl
fi
if [ ! -d "/build/openssl" ];then
git clone https://github.com/drwetter/openssl-pm-snapshot.git /build/openssl
fi
if [ ! -d "/build/nmap" ];then
git clone https://github.com/nmap/nmap.git /build/nmap
fi
NMAP_COMMIT=$(cd /build/nmap/ && git rev-parse --short HEAD)
}
build_musl() {
cd /build/musl
git clean -fdx
./build.sh
echo "[+] Finished building musl-cross x86_64"
}
build_openssl() {
cd /build/openssl
git clean -fdx
make clean
CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static' ./Configure no-shared linux-x86_64
make -j4
echo "[+] Finished building OpenSSL x86_64"
}
build_nmap() {
cd /build/nmap
git clean -fdx
make clean
cd /build/nmap/libz
CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \
CXX='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -static -static-libstdc++ -fPIC' \
cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_LINKER=/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-ld .
make zlibstatic
cd /build/nmap
CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \
CXX='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -static -static-libstdc++ -fPIC' \
CXXFLAGS="-I/build/nmap/libz" \
LD=/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-ld \
LDFLAGS="-L/build/openssl -L/build/nmap/libz" \
./configure \
--without-ndiff \
--without-zenmap \
--without-nmap-update \
--without-libssh2 \
--with-pcap=linux \
--with-libz=/build/nmap/libz \
--with-openssl=/build/openssl
sed -i -e 's/shared\: /shared\: #/' libpcap/Makefile
sed -i 's|LIBS = |& libz/libz.a |' Makefile
make -j4
/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-strip nmap ncat/ncat nping/nping
}
build_x86_64(){
OUT_DIR_x86_64=/output/`uname | tr 'A-Z' 'a-z'`/x86_64
mkdir -p $OUT_DIR_x86_64
build_musl
build_openssl
build_nmap
if [ ! -f "/build/nmap/nmap" -o ! -f "/build/nmap/ncat/ncat" -o ! -f "/build/nmap/nping/nping" ];then
echo "[-] Building Nmap x86_64 failed!"
exit 1
fi
NMAP_VERSION=$(/build/nmap/nmap --version |grep "Nmap version" | awk '{print $3}')
NCAT_VERSION=$(/build/nmap/ncat/ncat --version 2>&1 |grep "Ncat: Version" | awk '{print $3}')
NPING_VERSION=$(/build/nmap/nping/nping --version |grep "Nping version" | awk '{print $3}')
cp /build/nmap/nmap "${OUT_DIR_x86_64}/nmap-${NMAP_VERSION}-${NMAP_COMMIT}"
cp /build/nmap/ncat/ncat "${OUT_DIR_x86_64}/ncat-${NCAT_VERSION}-${NMAP_COMMIT}"
cp /build/nmap/nping/nping "${OUT_DIR_x86_64}/nping-${NPING_VERSION}-${NMAP_COMMIT}"
echo "[+] Finished building x86_64"
}
main() {
if [ ! -d "/output" ];then
echo "[-] /output does not exist, creating it"
mkdir /output
fi
fetch
build_x86_64
NMAP_DIR=/output/nmap-data-${NPING_VERSION}-${NMAP_COMMIT}
if [ ! -d "$NMAP_DIR" ];then
echo "[-] ${NMAP_DIR} does not exist, creating it"
mkdir -p "${NMAP_DIR}"
fi
if [ -n "$(ls $NMAP_DIR)" ];then
echo "[+] Data directory is not empty"
exit
fi
cd /build/nmap
make install
cp -r /usr/local/share/nmap/* $NMAP_DIR
echo "[+] Copied data to data dir"
}
main

View file

@ -1,18 +0,0 @@
FROM ubuntu:zesty
RUN apt-get update && \
apt upgrade -yy && \
apt install -yy \
automake \
autoconf \
yodl \
build-essential \
libgmp-dev \
libmpfr-dev \
libmpc-dev \
wget \
git \
pkg-config \
python
RUN mkdir /build
ADD . /build
CMD /build/build.sh

View file

@ -1,139 +0,0 @@
#!/bin/bash
set -e
set -x
set -o pipefail
fetch(){
#git clone https://github.com/GregorR/musl-cross.git /build/musl
git clone https://github.com/takeshixx/musl-cross.git /build/musl
git clone https://github.com/drwetter/openssl-pm-snapshot.git /build/openssl
git clone https://git.savannah.gnu.org/git/readline.git /build/readline
git clone https://github.com/mirror/ncurses.git /build/ncurses
git clone http://repo.or.cz/socat.git /build/socat
}
build_musl() {
cd /build/musl
git clean -fdx
./build.sh
echo "[+] Finished building musl-cross x86_64"
}
build_musl_x86() {
cd /build/musl
git clean -fdx
echo "ARCH=i486" >> config.sh
echo "GCC_BUILTIN_PREREQS=yes" >> config.sh
./build.sh
echo "[+] Finished building musl-cross x86"
}
build_openssl() {
cd /build/openssl
git clean -fdx
CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static' ./Configure no-shared linux-x86_64
make
echo "[+] Finished building OpenSSL x86_64"
}
build_openssl_x86() {
cd /build/openssl
git clean -fdx
CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static' ./Configure no-shared -m32 linux-generic32
make
echo "[+] Finished building OpenSSL x86"
}
build_ncurses() {
cd /build/ncurses
CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static' CFLAGS='-fPIC' ./configure \
--disable-shared \
--enable-static
echo "[+] Finished building ncurses x86_64"
}
build_ncurses_x86() {
cd /build/ncurses
CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static' CFLAGS='-fPIC' ./configure \
--disable-shared \
--enable-static
echo "[+] Finished building ncurses x86"
}
build_readline() {
cd /build/readline
git clean -fdx
CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static' CFLAGS='-fPIC' ./configure \
--disable-shared \
--enable-static
make -j4
echo "[+] Finished building readline x86_64"
}
build_readline_x86() {
cd /build/readline
git clean -fdx
CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static' CFLAGS='-fPIC' ./configure \
--disable-shared \
--enable-static
make -j4
echo "[+] Finished building readline x86"
}
build_socat() {
cd /build/socat
git clean -fdx
autoconf
CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static' \
CFLAGS='-fPIC' \
CPPFLAGS='-I/build -I/build/openssl/include -DNETDB_INTERNAL=-1' \
LDFLAGS="-L/build/readline -L/build/ncurses/lib -L/build/openssl" \
./configure
make -j4
/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-strip socat
}
build_socat_x86() {
cd /build/socat
git clean -fdx
autoconf
CC='/opt/cross/i486-linux-musl/bin/i486-linux-musl-gcc -static' \
CFLAGS='-fPIC' \
CPPFLAGS='-I/build -I/build/openssl/include -DNETDB_INTERNAL=-1' \
LDFLAGS="-L/build/readline -L/build/ncurses/lib -L/build/openssl" \
./configure
make -j4
/opt/cross/i486-linux-musl/bin/i486-linux-musl-strip socat
}
main() {
if [ ! -d /output ];then
echo "[-] /output does not exist"
exit
fi
fetch
build_musl
build_openssl
build_ncurses
build_readline
build_socat
OUT_DIR=/output/`uname | tr 'A-Z' 'a-z'`/x86_64
mkdir -p $OUT_DIR
cp /build/socat/socat $OUT_DIR/
echo "[+] Finished building socat x86_64"
build_musl_x86
build_openssl_x86
build_ncurses_x86
build_readline_x86
build_socat_x86
OUT_DIR=/output/`uname | tr 'A-Z' 'a-z'`/x86
mkdir -p $OUT_DIR
cp /build/socat/socat $OUT_DIR/
echo "[+] Finished building socat x86"
}
main