Skip to content

Commit

Permalink
Update to the latest version of nmap from github
Browse files Browse the repository at this point in the history
  • Loading branch information
dfurneau committed Oct 27, 2022
1 parent 3072e9d commit 6dd9b9f
Show file tree
Hide file tree
Showing 918 changed files with 12,945 additions and 755,285 deletions.
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,20 @@ Pivoting with static binaries

# Linux Arch Types

There are 2 different version of static nmap binaries, one is for x86 architectures and the other is for x64. Included in the repository are two .gz files that have already been compiled with version 7.91 of Nmap. If you don't need to modify the nmap version, you can just grab those two .gz files in the release area and unarchive them on your target.
Updated versin of nmap is x86_64 from github

There are 2 different version of static nmap binaries, one is for x86 architectures and the other is for x64. Included in the repository are two .gz files that have already been compiled with version 7.93 of Nmap. If you don't need to modify the nmap version, you can just grab those two .gz files in the release area and unarchive them on your target.

# Compiling

Included in the repository is a docker file and build.sh for compiling the static binaries. The latest version of nmap (7.91) was used in the nmap.tar.gz archives.
Included in the repository is a docker file and build.sh for compiling the static binaries. The latest version of nmap (7.91) was used in the nmap.tar.gz archives for x86.
The latest version from gitlab was used for the x86_64 version. All previous version are also available in the archives.

```sh
docker build . -t nmap-build
docker run --rm -v ${PWD}/:/output/ nmap-build
```
The executables will be in the output directory

# Usage

Expand Down Expand Up @@ -48,7 +57,7 @@ scan-port.sh 192.168.0.1 80 "http*, banner, vuln"

## full-scan.sh

This script will perform the same initial scans as the scan.sh script, but will also scan ports that are found by the quick scans.
This script will perform the same initial scans as the scan.sh script, but will also scan ports that are found by the quick scans.
***NOTE:*** Quick scanning will only pull the most popular ports, there for the full scan may miss some ports found by the full scan.

The shell scrip is executed as follows:
Expand Down Expand Up @@ -78,3 +87,7 @@ full-scan.sh 192.168.0.1
# Credits

The build scripts are taken from Andrew-d's github page at https://github.com/andrew-d/static-binaries

Build scripts modified by opinfosec on 28-Oct-22
- Added removing of shared in libz
- Updated OpenSSL to 3.0.5
29 changes: 19 additions & 10 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ set -o pipefail
set -x


NMAP_VERSION=7.91
OPENSSL_VERSION=1.1.1k
#NMAP_VERSION=7.91
# Nmap is bleeding edge from git
OPENSSL_VERSION=1.1.1q


function build_openssl() {
cd /build

# Download
curl -LO https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz
curl -LOk https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz
tar zxvf openssl-${OPENSSL_VERSION}.tar.gz
cd openssl-${OPENSSL_VERSION}

Expand All @@ -33,9 +34,11 @@ function build_nmap() {
DEBIAN_FRONTEND=noninteractive apt-get install -yy python

# Download
curl -LO http://nmap.org/dist/nmap-${NMAP_VERSION}.tar.bz2
tar xjvf nmap-${NMAP_VERSION}.tar.bz2
cd nmap-${NMAP_VERSION}
#curl -LOk http://nmap.org/dist/nmap-${NMAP_VERSION}.tar.bz2
#tar xjvf nmap-${NMAP_VERSION}.tar.bz2
#cd nmap-${NMAP_VERSION}
git clone https://github.com/nmap/nmap.git
cd nmap

# Configure
CC='/opt/cross/x86_64-linux-musl/bin/x86_64-linux-musl-gcc -static -fPIC' \
Expand All @@ -51,6 +54,7 @@ function build_nmap() {

# Don't build the libpcap.so file
sed -i -e 's/shared\: /shared\: #/' libpcap/Makefile
sed -i -e 's/shared\: /shared\: #/' libz/Makefile

# Build
make -j4
Expand All @@ -65,10 +69,15 @@ function doit() {
if [ -d /output ]
then
OUT_DIR=/output/`uname | tr 'A-Z' 'a-z'`/`uname -m`
mkdir -p $OUT_DIR
cp /build/nmap-${NMAP_VERSION}/nmap $OUT_DIR/
cp /build/nmap-${NMAP_VERSION}/ncat/ncat $OUT_DIR/
cp /build/nmap-${NMAP_VERSION}/nping/nping $OUT_DIR/
mkdir -p $OUT_DIR && mkdir -p $OUT_DIR/scripts && mkdir -p $OUT_DIR/nselib
#cp /build/nmap-${NMAP_VERSION}/nmap $OUT_DIR/
#cp /build/nmap-${NMAP_VERSION}/ncat/ncat $OUT_DIR/
#cp /build/nmap-${NMAP_VERSION}/nping/nping $OUT_DIR/
cp /build/nmap/nmap $OUT_DIR/
cp /build/nmap/ncat/ncat $OUT_DIR/
cp /build/nmap/nping/nping $OUT_DIR/
cp /build/nmap/scripts/* $OUT_DIR/scripts/
cp -R /build/nmap/nselib/* $OUT_DIR/nselib/
echo "** Finished **"
else
echo "** /output does not exist **"
Expand Down
Loading

0 comments on commit 6dd9b9f

Please sign in to comment.