mirror of
https://github.com/nmap/nmap.git
synced 2025-12-25 08:59:01 +00:00
Merge Nmap 7.96 release branch
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
export MSYS2_ARG_CONV_EXCL=*
|
||||
MAKENSIS=C:/Program Files (x86)/NSIS/makensis.exe
|
||||
SIGNTOOL := $(shell reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0" /v "InstallationFolder" | egrep InstallationFolder | cut -d ' ' -f13- | sed 's%\\%/%g' | tr -d '\r\n' | sed 's%$$%bin/10.0.0.22000/x86/signtool.exe%')
|
||||
SIGNTOOL := $(shell powershell.exe -NoProfile -WindowStyle Hidden -NonInteractive -Command '$$vs=Get-VSSetupInstance -All | Select-VSSetupInstance -Latest; $$vsp=$$vs.InstallationPath; & "$$env:comspec" /c "`"$$vsp\\VC\\Auxiliary\\Build\\vcvarsall.bat`" x86 & where signtool"' | tail -n 1)
|
||||
NMAPDIR=..
|
||||
NMAPDIR_WIN=$(shell echo '$(NMAPDIR)' | sed 's|/cygdrive/\(.\)|\1:|;s|/|\\|g')
|
||||
ZENMAP_WINDIR=$(NMAPDIR)/zenmap/install_scripts/windows
|
||||
@@ -10,7 +10,7 @@ export NPCAP_VERSION := $(shell ls npcap-*.exe | sed -e 's/npcap-\([0-9.]*\)[-oe
|
||||
|
||||
NSE_FILES = $(NMAPDIR)/scripts/script.db $(NMAPDIR)/scripts/*.nse
|
||||
NMAP_MSWIN32_AUX = $(NMAPDIR)/../nmap-mswin32-aux
|
||||
SIGNTOOL_ARGS = sign /a /n "Insecure.Com LLC" /tr http://timestamp.digicert.com /td sha256 /fd sha256
|
||||
SIGNTOOL_ARGS = sign /a /n "Nmap Software LLC" /tr http://timestamp.digicert.com /td sha256 /fd sha256
|
||||
NSIS_COMMON_ARGS = "/DVERSION=$(NMAP_VERSION)" "/DNUM_VERSION=$(NMAP_NUM_VERSION)" "/DNPCAP_VERSION=$(NPCAP_VERSION)"
|
||||
NSIS_OEM_ARGS = "/DNMAP_NAME=$(NMAP_OEM_NAME)" "/DNMAP_OEM=1"
|
||||
NSIS_STD_ARGS = "/DNMAP_NAME=$(NMAP_NAME)"
|
||||
@@ -83,7 +83,7 @@ stage-nmap:
|
||||
stage-nmap-oem:
|
||||
$(MAKE) OEM_SUFFIX=-oem stage-nmap-main
|
||||
|
||||
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/Uninstall.exe: nsis/Nmap.nsi
|
||||
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/Uninstall.exe: nsis/Nmap.nsi LICENSE.formatted
|
||||
mkdir -p nmap-$(NMAP_VERSION)${OEM_SUFFIX}
|
||||
"$(MAKENSIS)" /DINNER $(NSIS_ARGS) nsis/Nmap.nsi
|
||||
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/tempinstaller.exe || test $$? -eq 2
|
||||
@@ -94,7 +94,7 @@ stage-nmap-main: build-nmap${OEM_SUFFIX} nmap-$(NMAP_VERSION)${OEM_SUFFIX}/Unins
|
||||
|
||||
sign-files: nmap-$(NMAP_VERSION)-oem/nmap.exe nmap-$(NMAP_VERSION)/nmap.exe nmap-$(NMAP_VERSION)-oem/Uninstall.exe nmap-$(NMAP_VERSION)/Uninstall.exe nmap-$(NMAP_VERSION)/ncat.exe nmap-$(NMAP_VERSION)/nping.exe nmap-$(NMAP_VERSION)/libssh2.dll nmap-$(NMAP_VERSION)/libcrypto-3.dll nmap-$(NMAP_VERSION)/libssl-3.dll nmap-$(NMAP_VERSION)/zlibwapi.dll
|
||||
# TODO: evaluate whether we should also sign the Python stuff for Zenmap, Ndiff
|
||||
"$(SIGNTOOL)" $(SIGNTOOL_ARGS) $^ nmap-$(NMAP_VERSION)/zenmap/bin/* nmap-$(NMAP_VERSION)/zenmap/lib/gdk-pixbuf-2.0/*/*.dll
|
||||
"$(SIGNTOOL)" $(SIGNTOOL_ARGS) $^ nmap-$(NMAP_VERSION)/zenmap/bin/* nmap-$(NMAP_VERSION)/zenmap/lib/gdk-pixbuf-2.0/*/loaders/*.dll
|
||||
touch sign-files
|
||||
|
||||
bundle-nsis: sign-files
|
||||
|
||||
@@ -193,19 +193,9 @@ FunctionEnd
|
||||
;--------------------------------
|
||||
;Installer Sections
|
||||
|
||||
; These functions contain the actual File instructions, so their order
|
||||
; determines the order of files in the datablock. Grouping similar file types
|
||||
; (e.g. EXE vs text) results in better compression ratios.
|
||||
!insertmacro SecCoreFiles ""
|
||||
!insertmacro SecNcatFiles ""
|
||||
!insertmacro SecNpingFiles ""
|
||||
ReserveFile "${STAGE_DIR_OEM}\Uninstall.exe"
|
||||
ReserveFile "..\npcap-${NPCAP_VERSION}.exe"
|
||||
ReserveFile ..\${VCREDISTEXE}
|
||||
!ifndef NMAP_OEM
|
||||
!insertmacro SecZenmapFiles ""
|
||||
!insertmacro SecNdiffFiles ""
|
||||
!endif
|
||||
|
||||
!insertmacro SanityCheckInstdir ""
|
||||
Section "Nmap Core Files" SecCore
|
||||
@@ -223,7 +213,7 @@ Section "Nmap Core Files" SecCore
|
||||
SetOutPath "$INSTDIR"
|
||||
|
||||
SetOverwrite on
|
||||
Call SecCoreFiles
|
||||
!insertmacro SecCoreFiles
|
||||
|
||||
Call vcredistinstaller
|
||||
Call create_uninstaller
|
||||
@@ -265,7 +255,7 @@ SectionEnd
|
||||
Section "Ncat (Modern Netcat reincarnation)" SecNcat
|
||||
SetOutPath "$INSTDIR"
|
||||
SetOverwrite on
|
||||
Call SecNcatFiles
|
||||
!insertmacro SecNcatFiles
|
||||
Call vcredistinstaller
|
||||
Call create_uninstaller
|
||||
SectionEnd
|
||||
@@ -273,7 +263,7 @@ SectionEnd
|
||||
Section "Nping (Packet generator)" SecNping
|
||||
SetOutPath "$INSTDIR"
|
||||
SetOverwrite on
|
||||
Call SecNpingFiles
|
||||
!insertmacro SecNpingFiles
|
||||
Call vcredistinstaller
|
||||
Call create_uninstaller
|
||||
SectionEnd
|
||||
@@ -282,7 +272,7 @@ SectionEnd
|
||||
Section "Zenmap (GUI Frontend)" SecZenmap
|
||||
SetOutPath "$INSTDIR"
|
||||
SetOverwrite on
|
||||
Call SecZenmapFiles
|
||||
!insertmacro SecZenmapFiles
|
||||
WriteINIStr "$INSTDIR\zenmap\share\zenmap\config\zenmap.conf" paths nmap_command_path "$INSTDIR\nmap.exe"
|
||||
WriteINIStr "$INSTDIR\zenmap\share\zenmap\config\zenmap.conf" paths ndiff_command_path "$INSTDIR\ndiff.bat"
|
||||
!insertmacro writeZenmapShortcut "$INSTDIR\Zenmap.lnk"
|
||||
@@ -297,7 +287,7 @@ SectionEnd
|
||||
Section "Ndiff (Scan comparison tool)" SecNdiff
|
||||
SetOutPath "$INSTDIR"
|
||||
SetOverwrite on
|
||||
Call SecNdiffFiles
|
||||
!insertmacro SecNdiffFiles
|
||||
Call create_uninstaller
|
||||
SectionEnd
|
||||
!endif
|
||||
@@ -360,11 +350,12 @@ Function _GetFileVersionProductName
|
||||
${If} $2 == 0
|
||||
${AndIf} $0 <> 0
|
||||
; 0409 = English; 04b0 = Unicode
|
||||
System::Call 'version::VersionQueryValue(ir1, t"\StringFileInfo\040904b0\ProductName", *i0r2, *i0r3) i.r0'
|
||||
System::Call 'version::VerQueryValue(ir1, t"\StringFileInfo\040904b0\ProductName", *i0r2, *i0r3) i.r0'
|
||||
${If} $0 <> 0
|
||||
Pop $0 ; Take the "" off the stack
|
||||
; Push the Unicode string at r2 of length r3
|
||||
System::Call '*$2(&w$3.s)'
|
||||
System::Call '*$2(&t$3.r0)'
|
||||
Push $0
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
System::Free $1
|
||||
@@ -416,9 +407,11 @@ Function RepairBug2982
|
||||
ReadRegStr $0 HKLM "${REG_UNINSTALL_KEY}\Nmap" "UninstallString"
|
||||
; Nothing? Done.
|
||||
StrCmp $0 "" repair_2982_done
|
||||
Push $0 ; UninstallString
|
||||
; Check product name on the uninstaller
|
||||
!insertmacro stripQuotes $0
|
||||
${GetFileVersionProductName} $0 $3
|
||||
Push $3 ; ProductName
|
||||
; If it's not "Nmap OEM" it's not a buggy install
|
||||
StrCmp $3 "Nmap OEM" 0 repair_2982_done
|
||||
; Ok, it's a screwed-up install. We need to fix it up first.
|
||||
@@ -449,25 +442,27 @@ FunctionEnd
|
||||
|
||||
Function _TryUninstall
|
||||
System::Store S ; stash registers
|
||||
Pop $3 ; ProductName
|
||||
Pop $2 ; Old version
|
||||
Pop $1 ; Uninstall dir
|
||||
Pop $0 ; Uninstaller path
|
||||
${GetFileVersionProductName} $0 $3
|
||||
${If} ${Silent}
|
||||
StrCpy $5 $3 4
|
||||
${If} $5 <> "Nmap"
|
||||
${If} $5 != "Nmap"
|
||||
; In silent mode, abort the install
|
||||
; if INSTDIR contains an uninstaller that's not Nmap.
|
||||
Abort
|
||||
${EndIf}
|
||||
${Else}
|
||||
${If} $2 == ""
|
||||
${If} $2 == "UNKNOWN"
|
||||
${GetFileVersion} $0 $2
|
||||
${EndIf}
|
||||
MessageBox MB_YESNOCANCEL|MB_ICONQUESTION \
|
||||
'$3 $2 is already installed in "$1". $\n$\nWould you like to uninstall it first?' \
|
||||
/SD IDYES IDYES 0 IDNO tryuninstall_end
|
||||
/SD IDYES IDYES tryuninstall_go IDNO tryuninstall_end
|
||||
Abort
|
||||
${EndIf}
|
||||
tryuninstall_go:
|
||||
Push $0 ; Uninstaller
|
||||
Push "/S" ; Params
|
||||
Push $1 ; Old instdir
|
||||
@@ -478,10 +473,11 @@ Function _TryUninstall
|
||||
FunctionEnd
|
||||
; If _version is "", we use the uninstaller's file version, which is X.X.X.X
|
||||
; so for Nmap itself, use the DisplayVersion if known.
|
||||
!macro TryUninstall _uninstaller _uninstdir _version
|
||||
Push _uninstaller
|
||||
Push _uninstdir
|
||||
Push _version
|
||||
!macro TryUninstall _uninstaller _uninstdir _version _productname
|
||||
Push ${_uninstaller}
|
||||
Push ${_uninstdir}
|
||||
Push ${_version}
|
||||
Push ${_productname}
|
||||
Call _TryUninstall
|
||||
!macroend
|
||||
|
||||
@@ -532,15 +528,26 @@ Function .onInit
|
||||
!insertmacro OptionDisableSection $R0 "/NPING=" ${SecNping}
|
||||
|
||||
Call RepairBug2982
|
||||
ClearErrors
|
||||
Pop $3 ; ProductName?
|
||||
Pop $0 ; UninstallString?
|
||||
${If} ${Errors}
|
||||
${OrIf} $3 != "${NMAP_NAME}"
|
||||
; RepairBug2982 did not get info, so we get it here instead
|
||||
; $0 = old uninstall.exe path
|
||||
ReadRegStr $1 HKLM "${NMAP_UNINSTALL_KEY}" "UninstallString"
|
||||
; If it's the same as what RepairBug2982 got, then $3 is valid, too.
|
||||
${If} $1 != $0
|
||||
StrCpy $0 $1
|
||||
; $3 is obviously not valid
|
||||
StrCpy $3 ""
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
|
||||
; Check for existing install
|
||||
; $3 = old product name
|
||||
StrCpy $3 "${NMAP_NAME}"
|
||||
; $0 = old uninstall.exe path
|
||||
ReadRegStr $0 HKLM "${NMAP_UNINSTALL_KEY}" "UninstallString"
|
||||
; If no uninstall key was found, assume it's a new install
|
||||
StrCmp $0 "" 0 set_instdir
|
||||
StrCmp $0 "" set_instdir
|
||||
|
||||
!insertmacro stripQuotes $0
|
||||
; $1 = old instdir
|
||||
; We want to use this location going forward:
|
||||
ReadRegStr $1 HKLM "${NMAP_UNINSTALL_KEY}" "InstallLocation"
|
||||
@@ -549,20 +556,22 @@ Function .onInit
|
||||
ReadRegStr $1 HKCU "Software\${NMAP_NAME}" ""
|
||||
StrCmp $1 "" 0 get_old_version
|
||||
; Last chance, parent dir of uninstaller
|
||||
!insertmacro stripQuotes $0
|
||||
${GetParent} $0 $1
|
||||
|
||||
get_old_version:
|
||||
; $2 = old version
|
||||
ReadRegStr $2 HKLM "${NMAP_UNINSTALL_KEY}" "DisplayVersion"
|
||||
|
||||
!insertmacro TryUninstall $0 $1 $2
|
||||
${If} $3 == ""
|
||||
${GetFileVersionProductName} $0 $3
|
||||
${EndIf}
|
||||
!insertmacro TryUninstall $0 $1 $2 $3
|
||||
|
||||
set_instdir:
|
||||
; If it's already set, user specified with /D=
|
||||
StrCmp $INSTDIR "" 0 done
|
||||
; If we got the old instdir from the registry, use that.
|
||||
${If} $1 <> ""
|
||||
${If} $1 != ""
|
||||
StrCpy $INSTDIR $1
|
||||
${Else}
|
||||
; Default InstallDir set here
|
||||
@@ -572,9 +581,12 @@ set_instdir:
|
||||
done:
|
||||
; If we didn't already try to uninstall, check to see if there's something in
|
||||
; $INSTDIR that needs to be uninstalled.
|
||||
${If} $INSTDIR <> $1
|
||||
${If} $INSTDIR != $1
|
||||
${AndIf} ${FileExists} "$INSTDIR\Uninstall.exe"
|
||||
!insertmacro TryUninstall "$INSTDIR\Uninstall.exe" $INSTDIR ""
|
||||
${If} $3 == ""
|
||||
${GetFileVersionProductName} $INSTDIR\Uninstall.exe $3
|
||||
${EndIf}
|
||||
!insertmacro TryUninstall "$INSTDIR\Uninstall.exe" $INSTDIR "UNKNOWN" $3
|
||||
${EndIf}
|
||||
|
||||
FunctionEnd
|
||||
@@ -654,13 +666,6 @@ Function .onInit
|
||||
FunctionEnd
|
||||
|
||||
!insertmacro SanityCheckInstdir "un."
|
||||
!insertmacro SecCoreFiles "un."
|
||||
!insertmacro SecNcatFiles "un."
|
||||
!insertmacro SecNpingFiles "un."
|
||||
!ifndef NMAP_OEM
|
||||
!insertmacro SecZenmapFiles "un."
|
||||
!insertmacro SecNdiffFiles "un."
|
||||
!endif
|
||||
|
||||
Section "Uninstall"
|
||||
|
||||
@@ -679,12 +684,12 @@ Section "Uninstall"
|
||||
SetDetailsPrint listonly
|
||||
|
||||
nmap_installed:
|
||||
Call un.SecCoreFiles
|
||||
Call un.SecNcatFiles
|
||||
Call un.SecNpingFiles
|
||||
!insertmacro SecCoreFiles
|
||||
!insertmacro SecNcatFiles
|
||||
!insertmacro SecNpingFiles
|
||||
!ifndef NMAP_OEM
|
||||
Call un.SecZenmapFiles
|
||||
Call un.SecNdiffFiles
|
||||
!insertmacro SecZenmapFiles
|
||||
!insertmacro SecNdiffFiles
|
||||
!endif
|
||||
Delete "$INSTDIR\nmap_performance.reg"
|
||||
|
||||
|
||||
@@ -48,8 +48,7 @@ FunctionEnd
|
||||
!define _Dir "!insertmacro DoDir"
|
||||
!endif ; INNER
|
||||
|
||||
!macro SecCoreFiles un
|
||||
Function ${un}SecCoreFiles
|
||||
!macro SecCoreFiles
|
||||
${_File} ${STAGE_DIR} CHANGELOG
|
||||
${_File} ${STAGE_DIR} LICENSE
|
||||
${_File} ${STAGE_DIR} nmap-mac-prefixes
|
||||
@@ -72,37 +71,28 @@ Function ${un}SecCoreFiles
|
||||
${_Dir} ${STAGE_DIR} scripts
|
||||
${_Dir} ${STAGE_DIR} nselib
|
||||
${_File} ${STAGE_DIR} icon1.ico
|
||||
FunctionEnd
|
||||
!macroend
|
||||
|
||||
!macro SecZenmapFiles un
|
||||
Function ${un}SecZenmapFiles
|
||||
!macro SecZenmapFiles
|
||||
${_File} ${STAGE_DIR} ZENMAP_README
|
||||
${_File} ${STAGE_DIR} COPYING_HIGWIDGETS
|
||||
${_Dir} ${STAGE_DIR} zenmap
|
||||
; always remove Zenmap.lnk
|
||||
; It'll be created by the installer after this.
|
||||
Delete "$INSTDIR\Zenmap.lnk"
|
||||
FunctionEnd
|
||||
!macroend
|
||||
|
||||
!macro SecNdiffFiles un
|
||||
Function ${un}SecNdiffFiles
|
||||
!macro SecNdiffFiles
|
||||
${_File} ${STAGE_DIR} ndiff.py
|
||||
${_File} ${STAGE_DIR} ndiff.bat
|
||||
${_File} ${STAGE_DIR} NDIFF_README
|
||||
FunctionEnd
|
||||
!macroend
|
||||
|
||||
!macro SecNcatFiles un
|
||||
Function ${un}SecNcatFiles
|
||||
!macro SecNcatFiles
|
||||
${_File} ${STAGE_DIR} ncat.exe
|
||||
${_File} ${STAGE_DIR} ca-bundle.crt
|
||||
FunctionEnd
|
||||
!macroend
|
||||
|
||||
!macro SecNpingFiles un
|
||||
Function ${un}SecNpingFiles
|
||||
!macro SecNpingFiles
|
||||
${_File} ${STAGE_DIR} nping.exe
|
||||
FunctionEnd
|
||||
!macroend
|
||||
|
||||
Reference in New Issue
Block a user