Skip to content

Commit

Permalink
Merge changes from Nmap 7.80 release branch
Browse files Browse the repository at this point in the history
  • Loading branch information
bonsaiviking committed Aug 11, 2019
1 parent 0b49f7f commit f05296d
Show file tree
Hide file tree
Showing 14 changed files with 453 additions and 327 deletions.
382 changes: 207 additions & 175 deletions CHANGELOG

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/nmap.usage.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Nmap 7.70SVN ( https://nmap.org )
Nmap 7.80 ( https://nmap.org )
Usage: nmap [Scan Type(s)] [Options] {target specification}
TARGET SPECIFICATION:
Can pass hostnames, IP addresses, networks, etc.
Expand Down
60 changes: 39 additions & 21 deletions mswin32/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MAKENSIS="/cygdrive/c/Program Files/NSIS/makensis.exe"
MAKENSIS="/cygdrive/c/Program Files (x86)/NSIS/makensis.exe"
# VCExpress.exe is devenv.com with the commercial Visual Studio suite instead of VC++ Express
VCEXPRESS := $(shell reg query "HKEY_CLASSES_ROOT\\Applications\\devenv.exe\\shell\\edit\\command" | egrep -i '[A-Z]:\\' | cut -d\" -f2 | sed 's%\\%/%g' | tr -d '\r\n')
SIGNTOOL := $(shell reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.1" /v "InstallationFolder" | egrep InstallationFolder | cut -d ' ' -f13- | sed 's%\\%/%g' | tr -d '\r\n' | sed 's%$$%bin/x86/signtool.exe%')
Expand All @@ -7,44 +7,58 @@ export NMAP_NUM_VERSION := $(shell grep '^\#[ \t]*define[ \t]\+NMAP_NUM_VERSION'
export NPCAP_VERSION := $(shell ls npcap-*.exe | sed -e 's/npcap-\([-r0-9.]*\)\.exe/\1/' -e 'q')
COMMA_VERSION=$(shell echo $(NMAP_NUM_VERSION) | tr '.' ',')
LOGLOC=c:nmapbuild.log
NSE_FILES = scripts/script.db scripts/*.nse
NSE_FILES = ../scripts/script.db ../scripts/*.nse
NMAP_MSWIN32_AUX = ../../nmap-mswin32-aux
SIGNTOOL_ARGS = sign /a /n "Insecure.Com LLC" /tr http:https://timestamp.digicert.com /td sha256 /fd sha256
# escape quotes for NSIS
# escape for right side of sed regex replace
SIGNTOOL_SUBST = $(shell echo '"$(SIGNTOOL)" $(SIGNTOOL_ARGS)' | sed -e 's/"/$$\\"/g' -e 's/[\/&]/\\&/g' )

PRODUCT_NAME=Nmap
PLATFORM=Win32
BASE_CONFIG=Release
VCCONFIG=$(BASE_CONFIG)
NSIS_DEFINES=
ifdef NMAP_OEM
PRODUCT_NAME=Nmap OEM
OEM_SUFFIX=-oem
VCCONFIG=$(BASE_CONFIG)OEM
NSIS_DEFINES="/DNMAP_OEM=1"
endif

bundle-nmap: bundle-zip bundle-nsis

build-nmap: nmap.sln nmap.rc
"$(VCEXPRESS)" nmap.sln /build release /out $(LOGLOC)
"$(VCEXPRESS)" nmap.sln /build "$(VCCONFIG)|$(PLATFORM)" /out $(LOGLOC)
#"$(VCEXPRESS)" nmap.sln /build release /project nmap-update /out $(LOGLOC)

stage-nmap: build-nmap LICENSE
rm -rf nmap-$(NMAP_VERSION)
mkdir nmap-$(NMAP_VERSION)
cd Release && cp -r ../../CHANGELOG ../../COPYING nmap-mac-prefixes nmap-os-db nmap-payloads nmap-protocols nmap-rpc nmap-service-probes nmap-services nmap.exe nmap.xsl nse_main.lua ../nmap_performance.reg ../../README-WIN32 ../../docs/3rd-party-licenses.txt ../nmap-$(NMAP_VERSION)/
cp ../CHANGELOG ../COPYING ../nmap-mac-prefixes ../nmap-os-db ../nmap-payloads ../nmap-protocols ../nmap-rpc ../nmap-service-probes ../nmap-services $(VCCONFIG)/nmap.exe ../docs/nmap.xsl ../nse_main.lua nmap_performance.reg ../README-WIN32 ../docs/3rd-party-licenses.txt nmap-$(NMAP_VERSION)/
# Use "cmd /c copy" rather than "cp" to preserve Windows ACLs. Using
# "cp" means that the copied DLLs don't have the same ACL and cause an
# error on startup: 0xc0000022.
cmd /c copy $(subst /,\\,$(NMAP_MSWIN32_AUX))\\OpenSSL\\bin\\*.dll nmap-$(NMAP_VERSION)
cmd /c copy Release\\libssh2.dll Release\\zlibwapi.dll nmap-$(NMAP_VERSION)
cmd /c copy ..\\libssh2\\win32\\$(BASE_CONFIG)_dll\\libssh2.dll nmap-$(NMAP_VERSION)
cmd /c copy ..\\libz\\contrib\\vstudio\\vc12\\x86\\ZlibDll$(BASE_CONFIG)\\zlibwapi.dll nmap-$(NMAP_VERSION)
mkdir nmap-$(NMAP_VERSION)/scripts
cd Release && cp -f $(NSE_FILES) ../nmap-$(NMAP_VERSION)/scripts/
cd Release && for f in `find nselib -name .svn -prune -o -type d -print`; do \
mkdir -p ../nmap-$(NMAP_VERSION)/$$f; \
cp -f $(NSE_FILES) nmap-$(NMAP_VERSION)/scripts/
for f in `cd .. && find nselib -name .svn -prune -o -type d -print`; do \
mkdir -p nmap-$(NMAP_VERSION)/$$f; \
done
cd Release && for f in `find nselib -name .svn -prune -o -type f -print`; do \
cp -f $$f ../nmap-$(NMAP_VERSION)/$$f; \
for f in `cd .. && find nselib -name .svn -prune -o -type f -print`; do \
cp -f ../$$f nmap-$(NMAP_VERSION)/$$f; \
done
cd Release && cp -r ../../docs/licenses ../nmap-$(NMAP_VERSION)/
cp -r ../docs/licenses nmap-$(NMAP_VERSION)/
rm -rf nmap-$(NMAP_VERSION)/licenses/.svn
cp npcap-$(NPCAP_VERSION).exe nmap-$(NMAP_VERSION)
# TODO: change "-oem" to "$(OEM_SUFFIX)" when Npcap OEM is no longer needed for standard Nmap.
cp npcap-$(NPCAP_VERSION)-oem.exe nmap-$(NMAP_VERSION)
cp $(NMAP_MSWIN32_AUX)/vcredist_x86.exe nmap-$(NMAP_VERSION)
cp $(NMAP_MSWIN32_AUX)/vcredist2008_x86.exe nmap-$(NMAP_VERSION)
cp ../ncat/Release/ncat.exe nmap-$(NMAP_VERSION)
cp ../ncat/Release/ca-bundle.crt nmap-$(NMAP_VERSION)
cp ../nping/Release/nping.exe nmap-$(NMAP_VERSION)
cp ../ncat/$(BASE_CONFIG)/ncat.exe nmap-$(NMAP_VERSION)
cp ../ncat/$(BASE_CONFIG)/ca-bundle.crt nmap-$(NMAP_VERSION)
cp ../nping/$(BASE_CONFIG)/nping.exe nmap-$(NMAP_VERSION)
#cp ../nmap-update/Release/nmap-update.exe nmap-$(NMAP_VERSION)
# Install the ndiff batch file wrapper in the zip distribution.
cp ../ndiff/ndiff.py nmap-$(NMAP_VERSION)/ndiff.py
Expand All @@ -61,25 +75,27 @@ sign-files: nmap-$(NMAP_VERSION)/nmap.exe nmap-$(NMAP_VERSION)/ncat.exe nmap-$(N

bundle-nsis: nsis/Nmap.nsi sign-files
cp nsis/AddToPath.nsh nsis/Nmap.nsi nsis/shortcuts.ini nsis/final.ini nmap-$(NMAP_VERSION)
$(MAKENSIS) nmap-$(NMAP_VERSION)/Nmap.nsi
mv nmap-$(NMAP_VERSION)/NmapInstaller.exe nmap-$(NMAP_VERSION)-setup.exe
"$(SIGNTOOL)" $(SIGNTOOL_ARGS) nmap-$(NMAP_VERSION)-setup.exe
$(MAKENSIS) "/XOutFile nmap-$(NMAP_VERSION)$(OEM_SUFFIX)-setup.exe" $(NSIS_DEFINES) nmap-$(NMAP_VERSION)/Nmap.nsi
mv nmap-$(NMAP_VERSION)/nmap-$(NMAP_VERSION)$(OEM_SUFFIX)-setup.exe .
"$(SIGNTOOL)" $(SIGNTOOL_ARGS) nmap-$(NMAP_VERSION)$(OEM_SUFFIX)-setup.exe

bundle-zip: sign-files
rm -f nmap-$(NMAP_VERSION)-win32.zip
rm -f nmap-$(NMAP_VERSION)$(OEM_SUFFIX)-win32.zip
zip -x nmap-$(NMAP_VERSION)/ZENMAP_README nmap-$(NMAP_VERSION)/zenmap/\* \
nmap-$(NMAP_VERSION)/zenmap.exe nmap-$(NMAP_VERSION)/share/\* \
nmap-$(NMAP_VERSION)/python27.dll nmap-$(NMAP_VERSION)/py2exe/\* \
nmap-$(NMAP_VERSION)/COPYING_HIGWIDGETS nmap-$(NMAP_VERSION)/w9xpopen.exe \
nmap-$(NMAP_VERSION)/vcredist2008_x86.exe \
nmap-$(NMAP_VERSION)/ndiff.exe nmap-$(NMAP_VERSION)/\*.ini \
nmap-$(NMAP_VERSION)/Uninstall.exe nmap-$(NMAP_VERSION)/\*.nsi \
nmap-$(NMAP_VERSION)/\*.nsh \
-r nmap-$(NMAP_VERSION)-win32.zip nmap-$(NMAP_VERSION)
-r nmap-$(NMAP_VERSION)$(OEM_SUFFIX)-win32.zip nmap-$(NMAP_VERSION)

nmap.rc: nmap.rc.in ../nmap.h
sed -e '1i// Automatically generated from $<.' \
-e 's/@@FILEVERSION@@/"$(NMAP_VERSION)\\0"/' \
-e 's/@@COMMAVERSION@@/$(COMMA_VERSION)/' \
-e 's/@@PRODUCT_NAME@@/$(PRODUCT_NAME)/' \
"$<" > "$@"

nsis/Nmap.nsi: nsis/Nmap.nsi.in ../nmap.h
Expand All @@ -89,11 +105,13 @@ nsis/Nmap.nsi: nsis/Nmap.nsi.in ../nmap.h
-e 's/@@VERSION@@/"$(NMAP_VERSION)"/' \
-e 's/@@NPCAP_VERSION@@/$(NPCAP_VERSION)/' \
-e 's/@@SIGNTOOL@@/$(SIGNTOOL_SUBST)/' \
-e 's/@@OEM_SUFFIX@@/$(OEM_SUFFIX)/' \
-e 's/@@PRODUCT_NAME@@/$(PRODUCT_NAME)/' \
"$<" > "$@"

LICENSE: ../COPYING
./license-format/licformat.sh "$<" > "$@"

clean:
"$(VCEXPRESS)" nmap.sln /clean
rm -rf Debug Release nmapbuild.log nmap.rc nsis/Nmap.nsi LICENSE
rm -rf Debug Release ReleaseOEM nmapbuild.log nmap.rc nsis/Nmap.nsi LICENSE
54 changes: 0 additions & 54 deletions mswin32/nmap.rc

This file was deleted.

6 changes: 3 additions & 3 deletions mswin32/nmap.rc.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Insecure.Org\0"
VALUE "FileDescription", "Nmap\0"
VALUE "FileDescription", "@@PRODUCT_NAME@@\0"
VALUE "FileVersion", @@FILEVERSION@@
VALUE "InternalName", "Nmap\0"
VALUE "InternalName", "@@PRODUCT_NAME@@\0"
VALUE "LegalCopyright", "Copyright (c) Insecure.Com LLC ([email protected])\0"
VALUE "LegalTrademarks", "NMAP\0"
VALUE "OriginalFilename", "nmap.exe\0"
VALUE "ProductName", "Nmap\0"
VALUE "ProductName", "@@PRODUCT_NAME@@\0"
END
END
BLOCK "VarFileInfo"
Expand Down

0 comments on commit f05296d

Please sign in to comment.