Initial commit
This commit is contained in:
parent
4ae8082081
commit
4cee679bdb
802 changed files with 2840 additions and 1 deletions
recipes
nmap
socat
23
recipes/nmap/README.md
Normal file
23
recipes/nmap/README.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Nmap
|
||||
|
||||
## Build x86
|
||||
|
||||
```
|
||||
sudo docker build -t static-toolbox-nmap-x86 .
|
||||
sudo docker run -v $(pwd)/output:/output static-toolbox-nmap-x86
|
||||
```
|
||||
|
||||
## Build x86_64
|
||||
|
||||
```
|
||||
sudo docker build -t static-toolbox-nmap-x86-64 .
|
||||
sudo docker run -v $(pwd)/output:/output static-toolbox-nmap-x86-64
|
||||
```
|
||||
|
||||
## 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
|
||||
```
|
19
recipes/nmap/linux_x86/Dockerfile
Normal file
19
recipes/nmap/linux_x86/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_x86.sh
|
||||
CMD /build/build_x86.sh
|
110
recipes/nmap/linux_x86/build_x86.sh
Normal file
110
recipes/nmap/linux_x86/build_x86.sh
Normal file
|
@ -0,0 +1,110 @@
|
|||
#!/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
|
19
recipes/nmap/linux_x86_64/Dockerfile
Normal file
19
recipes/nmap/linux_x86_64/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_x86_64.sh
|
||||
CMD /build/build_x86_64.sh
|
108
recipes/nmap/linux_x86_64/build_x86_64.sh
Normal file
108
recipes/nmap/linux_x86_64/build_x86_64.sh
Normal file
|
@ -0,0 +1,108 @@
|
|||
#!/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
|
18
recipes/socat/Dockerfile
Normal file
18
recipes/socat/Dockerfile
Normal file
|
@ -0,0 +1,18 @@
|
|||
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
|
139
recipes/socat/build.sh
Normal file
139
recipes/socat/build.sh
Normal file
|
@ -0,0 +1,139 @@
|
|||
#!/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
|
Loading…
Add table
Add a link
Reference in a new issue