Added armhf and aarch64 recipes, binaries and prepackaged archives
This commit is contained in:
parent
4cee679bdb
commit
5a8c19b38e
17 changed files with 324 additions and 2 deletions
recipes/nmap
|
@ -1,19 +1,33 @@
|
|||
# Nmap
|
||||
|
||||
## Build x86
|
||||
## Build Linux x86
|
||||
|
||||
```
|
||||
sudo docker build -t static-toolbox-nmap-x86 .
|
||||
sudo docker run -v $(pwd)/output:/output static-toolbox-nmap-x86
|
||||
```
|
||||
|
||||
## Build x86_64
|
||||
## 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:
|
||||
|
|
19
recipes/nmap/linux_aarch64/Dockerfile
Normal file
19
recipes/nmap/linux_aarch64/Dockerfile
Normal file
|
@ -0,0 +1,19 @@
|
|||
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
|
102
recipes/nmap/linux_aarch64/build_aarch64.sh
Normal file
102
recipes/nmap/linux_aarch64/build_aarch64.sh
Normal file
|
@ -0,0 +1,102 @@
|
|||
#!/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
|
19
recipes/nmap/linux_armhf/Dockerfile
Normal file
19
recipes/nmap/linux_armhf/Dockerfile
Normal file
|
@ -0,0 +1,19 @@
|
|||
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
|
104
recipes/nmap/linux_armhf/build_armhf.sh
Normal file
104
recipes/nmap/linux_armhf/build_armhf.sh
Normal file
|
@ -0,0 +1,104 @@
|
|||
#!/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
|
Loading…
Add table
Add a link
Reference in a new issue