mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 20:51:30 +00:00
Unify installer and uninstaller file lists
Recent uninstallers were missing some new files.
This commit is contained in:
@@ -42,6 +42,7 @@
|
|||||||
!include "MUI.nsh"
|
!include "MUI.nsh"
|
||||||
!include "AddToPath.nsh"
|
!include "AddToPath.nsh"
|
||||||
!include "FileFunc.nsh"
|
!include "FileFunc.nsh"
|
||||||
|
!include "nmap-common.nsh"
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
;General
|
;General
|
||||||
@@ -185,29 +186,15 @@ FunctionEnd
|
|||||||
;--------------------------------
|
;--------------------------------
|
||||||
;Installer Sections
|
;Installer Sections
|
||||||
|
|
||||||
|
!insertmacro SanityCheckInstdir
|
||||||
|
!insertmacro SecCoreFiles
|
||||||
|
!insertmacro SecZenmapFiles
|
||||||
|
!insertmacro SecNdiffFiles
|
||||||
|
!insertmacro SecNcatFiles
|
||||||
|
!insertmacro SecNpingFiles
|
||||||
|
|
||||||
Section "Nmap Core Files" SecCore
|
Section "Nmap Core Files" SecCore
|
||||||
|
Call SanityCheckInstdir
|
||||||
StrCpy $R0 $INSTDIR "" -2
|
|
||||||
StrCmp $R0 ":\" bad_key_install
|
|
||||||
StrCpy $R0 $INSTDIR "" -14
|
|
||||||
StrCmp $R0 "\Program Files" bad_key_install
|
|
||||||
StrCpy $R0 $INSTDIR "" -8
|
|
||||||
StrCmp $R0 "\Windows" bad_key_install
|
|
||||||
StrCpy $R0 $INSTDIR "" -6
|
|
||||||
StrCmp $R0 "\WinNT" bad_key_install
|
|
||||||
StrCpy $R0 $INSTDIR "" -9
|
|
||||||
StrCmp $R0 "\system32" bad_key_install
|
|
||||||
StrCpy $R0 $INSTDIR "" -8
|
|
||||||
StrCmp $R0 "\Desktop" bad_key_install
|
|
||||||
StrCpy $R0 $INSTDIR "" -22
|
|
||||||
StrCmp $R0 "\Documents and Settings" bad_key_install
|
|
||||||
StrCpy $R0 $INSTDIR "" -13
|
|
||||||
StrCmp $R0 "\My Documents" bad_key_install probably_safe_key_install
|
|
||||||
bad_key_install:
|
|
||||||
MessageBox MB_YESNO "It may not be safe to uninstall the previous installation of ${NMAP_NAME} from the directory '$INSTDIR'.$\r$\nContinue anyway (not recommended)?" IDYES probably_safe_key_install
|
|
||||||
Abort "Install aborted by user"
|
|
||||||
probably_safe_key_install:
|
|
||||||
|
|
||||||
;Delete specific subfolders (NB: custom scripts in scripts folder will be lost)
|
;Delete specific subfolders (NB: custom scripts in scripts folder will be lost)
|
||||||
RMDir /r "$INSTDIR\nselib"
|
RMDir /r "$INSTDIR\nselib"
|
||||||
; nselib-bin held NSE C modules up through version 4.68.
|
; nselib-bin held NSE C modules up through version 4.68.
|
||||||
@@ -221,28 +208,7 @@ Section "Nmap Core Files" SecCore
|
|||||||
SetOutPath "$INSTDIR"
|
SetOutPath "$INSTDIR"
|
||||||
|
|
||||||
SetOverwrite on
|
SetOverwrite on
|
||||||
File ${STAGE_DIR}\CHANGELOG
|
Call SecCoreFiles
|
||||||
File ${STAGE_DIR}\LICENSE
|
|
||||||
File ${STAGE_DIR}\nmap-mac-prefixes
|
|
||||||
File ${STAGE_DIR}\nmap-os-db
|
|
||||||
File ${STAGE_DIR}\nmap-protocols
|
|
||||||
File ${STAGE_DIR}\nmap-rpc
|
|
||||||
File ${STAGE_DIR}\nmap-service-probes
|
|
||||||
File ${STAGE_DIR}\nmap-services
|
|
||||||
File ${STAGE_DIR_OEM}\nmap.exe
|
|
||||||
File ${STAGE_DIR}\nse_main.lua
|
|
||||||
File ${STAGE_DIR}\nmap.xsl
|
|
||||||
File ${STAGE_DIR}\nmap_performance.reg
|
|
||||||
File ${STAGE_DIR}\README-WIN32
|
|
||||||
File ${STAGE_DIR}\3rd-party-licenses.txt
|
|
||||||
File /r /x .svn ${STAGE_DIR}\licenses
|
|
||||||
File ${STAGE_DIR}\libssh2.dll
|
|
||||||
File ${STAGE_DIR}\zlibwapi.dll
|
|
||||||
File ${STAGE_DIR}\libcrypto-3.dll
|
|
||||||
File ${STAGE_DIR}\libssl-3.dll
|
|
||||||
File /r /x mswin32 /x .svn /x ncat ${STAGE_DIR}\scripts
|
|
||||||
File /r /x mswin32 /x .svn ${STAGE_DIR}\nselib
|
|
||||||
File ${STAGE_DIR}\icon1.ico
|
|
||||||
|
|
||||||
Call vcredistinstaller
|
Call vcredistinstaller
|
||||||
Call create_uninstaller
|
Call create_uninstaller
|
||||||
@@ -285,9 +251,7 @@ SectionEnd
|
|||||||
Section "Zenmap (GUI Frontend)" SecZenmap
|
Section "Zenmap (GUI Frontend)" SecZenmap
|
||||||
SetOutPath "$INSTDIR"
|
SetOutPath "$INSTDIR"
|
||||||
SetOverwrite on
|
SetOverwrite on
|
||||||
File ${STAGE_DIR}\ZENMAP_README
|
Call SecZenmapFiles
|
||||||
File ${STAGE_DIR}\COPYING_HIGWIDGETS
|
|
||||||
File /r ${STAGE_DIR}\zenmap
|
|
||||||
WriteINIStr "$INSTDIR\zenmap\share\zenmap\config\zenmap.conf" paths nmap_command_path "$INSTDIR\nmap.exe"
|
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"
|
WriteINIStr "$INSTDIR\zenmap\share\zenmap\config\zenmap.conf" paths ndiff_command_path "$INSTDIR\ndiff.bat"
|
||||||
!insertmacro writeZenmapShortcut "$INSTDIR\Zenmap.lnk"
|
!insertmacro writeZenmapShortcut "$INSTDIR\Zenmap.lnk"
|
||||||
@@ -302,9 +266,7 @@ SectionEnd
|
|||||||
Section "Ndiff (Scan comparison tool)" SecNdiff
|
Section "Ndiff (Scan comparison tool)" SecNdiff
|
||||||
SetOutPath "$INSTDIR"
|
SetOutPath "$INSTDIR"
|
||||||
SetOverwrite on
|
SetOverwrite on
|
||||||
File ${STAGE_DIR}\ndiff.py
|
Call SecNdiffFiles
|
||||||
File ${STAGE_DIR}\ndiff.bat
|
|
||||||
File ${STAGE_DIR}\NDIFF_README
|
|
||||||
Call create_uninstaller
|
Call create_uninstaller
|
||||||
SectionEnd
|
SectionEnd
|
||||||
!endif
|
!endif
|
||||||
@@ -312,8 +274,7 @@ SectionEnd
|
|||||||
Section "Ncat (Modern Netcat reincarnation)" SecNcat
|
Section "Ncat (Modern Netcat reincarnation)" SecNcat
|
||||||
SetOutPath "$INSTDIR"
|
SetOutPath "$INSTDIR"
|
||||||
SetOverwrite on
|
SetOverwrite on
|
||||||
File ${STAGE_DIR}\ncat.exe
|
Call SecNcatFiles
|
||||||
File ${STAGE_DIR}\ca-bundle.crt
|
|
||||||
Call vcredistinstaller
|
Call vcredistinstaller
|
||||||
Call create_uninstaller
|
Call create_uninstaller
|
||||||
SectionEnd
|
SectionEnd
|
||||||
@@ -321,7 +282,7 @@ SectionEnd
|
|||||||
Section "Nping (Packet generator)" SecNping
|
Section "Nping (Packet generator)" SecNping
|
||||||
SetOutPath "$INSTDIR"
|
SetOutPath "$INSTDIR"
|
||||||
SetOverwrite on
|
SetOverwrite on
|
||||||
File ${STAGE_DIR}\nping.exe
|
Call SecNpingFiles
|
||||||
Call vcredistinstaller
|
Call vcredistinstaller
|
||||||
Call create_uninstaller
|
Call create_uninstaller
|
||||||
SectionEnd
|
SectionEnd
|
||||||
@@ -651,28 +612,16 @@ Function .onInit
|
|||||||
Quit ; just bail out quickly when running the "inner" installer
|
Quit ; just bail out quickly when running the "inner" installer
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
!insertmacro SanityCheckInstdir "un."
|
||||||
|
!insertmacro SecCoreFiles "un."
|
||||||
|
!insertmacro SecZenmapFiles "un."
|
||||||
|
!insertmacro SecNdiffFiles "un."
|
||||||
|
!insertmacro SecNcatFiles "un."
|
||||||
|
!insertmacro SecNpingFiles "un."
|
||||||
|
|
||||||
Section "Uninstall"
|
Section "Uninstall"
|
||||||
|
|
||||||
StrCpy $R0 $INSTDIR "" -2
|
Call un.SanityCheckInstdir
|
||||||
StrCmp $R0 ":\" bad_key_uninstall
|
|
||||||
StrCpy $R0 $INSTDIR "" -14
|
|
||||||
StrCmp $R0 "\Program Files" bad_key_uninstall
|
|
||||||
StrCpy $R0 $INSTDIR "" -8
|
|
||||||
StrCmp $R0 "\Windows" bad_key_uninstall
|
|
||||||
StrCpy $R0 $INSTDIR "" -6
|
|
||||||
StrCmp $R0 "\WinNT" bad_key_uninstall
|
|
||||||
StrCpy $R0 $INSTDIR "" -9
|
|
||||||
StrCmp $R0 "\system32" bad_key_uninstall
|
|
||||||
StrCpy $R0 $INSTDIR "" -8
|
|
||||||
StrCmp $R0 "\Desktop" bad_key_uninstall
|
|
||||||
StrCpy $R0 $INSTDIR "" -22
|
|
||||||
StrCmp $R0 "\Documents and Settings" bad_key_uninstall
|
|
||||||
StrCpy $R0 $INSTDIR "" -13
|
|
||||||
StrCmp $R0 "\My Documents" bad_key_uninstall probably_safe_key_uninstall
|
|
||||||
bad_key_uninstall:
|
|
||||||
MessageBox MB_YESNO "It may not be safe to uninstall ${NMAP_NAME} from the directory '$INSTDIR'.$\r$\nContinue anyway (not recommended)?" IDYES probably_safe_key_uninstall
|
|
||||||
Abort "Uninstall aborted by user"
|
|
||||||
probably_safe_key_uninstall:
|
|
||||||
|
|
||||||
IfFileExists $INSTDIR\nmap.exe nmap_installed
|
IfFileExists $INSTDIR\nmap.exe nmap_installed
|
||||||
IfFileExists $INSTDIR\zenmap.exe nmap_installed
|
IfFileExists $INSTDIR\zenmap.exe nmap_installed
|
||||||
@@ -687,43 +636,12 @@ Section "Uninstall"
|
|||||||
SetDetailsPrint listonly
|
SetDetailsPrint listonly
|
||||||
|
|
||||||
nmap_installed:
|
nmap_installed:
|
||||||
Delete "$INSTDIR\3rd-party-licenses.txt"
|
Call un.SecCoreFiles
|
||||||
Delete "$INSTDIR\CHANGELOG"
|
Call un.SecZenmapFiles
|
||||||
Delete "$INSTDIR\LICENSE"
|
Call un.SecNdiffFiles
|
||||||
Delete "$INSTDIR\nmap-mac-prefixes"
|
Call un.SecNcatFiles
|
||||||
Delete "$INSTDIR\nmap-os-db"
|
Call un.SecNpingFiles
|
||||||
Delete "$INSTDIR\nmap-payloads"
|
|
||||||
Delete "$INSTDIR\nmap-protocols"
|
|
||||||
Delete "$INSTDIR\nmap-rpc"
|
|
||||||
Delete "$INSTDIR\nmap-service-probes"
|
|
||||||
Delete "$INSTDIR\nmap-services"
|
|
||||||
Delete "$INSTDIR\nmap.exe"
|
|
||||||
Delete "$INSTDIR\nmap.xsl"
|
|
||||||
Delete "$INSTDIR\nmap_performance.reg"
|
Delete "$INSTDIR\nmap_performance.reg"
|
||||||
Delete "$INSTDIR\nse_main.lua"
|
|
||||||
Delete "$INSTDIR\README-WIN32"
|
|
||||||
Delete "$INSTDIR\icon1.ico"
|
|
||||||
Delete "$INSTDIR\libssh2.dll"
|
|
||||||
Delete "$INSTDIR\zlibwapi.dll"
|
|
||||||
Delete "$INSTDIR\libcrypto-*dll"
|
|
||||||
Delete "$INSTDIR\libssl-*dll"
|
|
||||||
Delete "$INSTDIR\npcap-*.exe"
|
|
||||||
Delete "$INSTDIR\Zenmap.lnk"
|
|
||||||
Delete "$INSTDIR\ndiff.py"
|
|
||||||
Delete "$INSTDIR\ndiff.bat"
|
|
||||||
Delete "$INSTDIR\python27.dll"
|
|
||||||
Delete "$INSTDIR\NDIFF_README"
|
|
||||||
Delete "$INSTDIR\ZENMAP_README"
|
|
||||||
Delete "$INSTDIR\COPYING_HIGWIDGETS"
|
|
||||||
Delete "$INSTDIR\ncat.exe"
|
|
||||||
Delete "$INSTDIR\nping.exe"
|
|
||||||
Delete "$INSTDIR\ca-bundle.crt"
|
|
||||||
;Delete specific subfolders (NB: custom scripts in scripts folder will be lost)
|
|
||||||
RMDir /r "$INSTDIR\nselib"
|
|
||||||
RMDir /r "$INSTDIR\scripts"
|
|
||||||
RMDir /r "$INSTDIR\share"
|
|
||||||
RMDir /r "$INSTDIR\zenmap"
|
|
||||||
RMDir /r "$INSTDIR\licenses"
|
|
||||||
|
|
||||||
Delete "$INSTDIR\Uninstall.exe"
|
Delete "$INSTDIR\Uninstall.exe"
|
||||||
|
|
||||||
|
|||||||
108
mswin32/nsis/nmap-common.nsh
Normal file
108
mswin32/nsis/nmap-common.nsh
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
!macro SanityCheckInstdir un
|
||||||
|
Function ${un}SanityCheckInstdir
|
||||||
|
StrCpy $R0 $INSTDIR "" -2
|
||||||
|
StrCmp $R0 ":\" bad_key_install
|
||||||
|
StrCpy $R0 $INSTDIR "" -14
|
||||||
|
StrCmp $R0 "\Program Files" bad_key_install
|
||||||
|
StrCpy $R0 $INSTDIR "" -8
|
||||||
|
StrCmp $R0 "\Windows" bad_key_install
|
||||||
|
StrCpy $R0 $INSTDIR "" -6
|
||||||
|
StrCmp $R0 "\WinNT" bad_key_install
|
||||||
|
StrCpy $R0 $INSTDIR "" -9
|
||||||
|
StrCmp $R0 "\system32" bad_key_install
|
||||||
|
StrCpy $R0 $INSTDIR "" -8
|
||||||
|
StrCmp $R0 "\Desktop" bad_key_install
|
||||||
|
StrCpy $R0 $INSTDIR "" -22
|
||||||
|
StrCmp $R0 "\Documents and Settings" bad_key_install
|
||||||
|
StrCpy $R0 $INSTDIR "" -13
|
||||||
|
StrCmp $R0 "\My Documents" bad_key_install probably_safe_key_install
|
||||||
|
bad_key_install:
|
||||||
|
MessageBox MB_YESNO "It may not be safe to uninstall ${NMAP_NAME} from the directory '$INSTDIR'.$\r$\nContinue anyway (not recommended)?" /SD IDYES IDYES probably_safe_key_install
|
||||||
|
Abort "Install aborted by user"
|
||||||
|
probably_safe_key_install:
|
||||||
|
FunctionEnd
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
!ifdef INNER
|
||||||
|
; building uninstaller
|
||||||
|
!macro DoFile _from _name
|
||||||
|
Delete "$INSTDIR\${_name}"
|
||||||
|
!macroend
|
||||||
|
!define _File "!insertmacro DoFile"
|
||||||
|
|
||||||
|
!macro DoDir _from _name
|
||||||
|
RMDir /r "$INSTDIR\${_name}"
|
||||||
|
!macroend
|
||||||
|
!define _Dir "!insertmacro DoDir"
|
||||||
|
|
||||||
|
!else ; INNER
|
||||||
|
; building installer
|
||||||
|
!macro DoFile _from _name
|
||||||
|
File "${_from}\${_name}"
|
||||||
|
!macroend
|
||||||
|
!define _File "!insertmacro DoFile"
|
||||||
|
|
||||||
|
!macro DoDir _from _name
|
||||||
|
File /r /x mswin32 /x .svn "${_from}\${_name}"
|
||||||
|
!macroend
|
||||||
|
!define _Dir "!insertmacro DoDir"
|
||||||
|
!endif ; INNER
|
||||||
|
|
||||||
|
!macro SecCoreFiles un
|
||||||
|
Function ${un}SecCoreFiles
|
||||||
|
${_File} ${STAGE_DIR} CHANGELOG
|
||||||
|
${_File} ${STAGE_DIR} LICENSE
|
||||||
|
${_File} ${STAGE_DIR} nmap-mac-prefixes
|
||||||
|
${_File} ${STAGE_DIR} nmap-os-db
|
||||||
|
${_File} ${STAGE_DIR} nmap-protocols
|
||||||
|
${_File} ${STAGE_DIR} nmap-rpc
|
||||||
|
${_File} ${STAGE_DIR} nmap-service-probes
|
||||||
|
${_File} ${STAGE_DIR} nmap-services
|
||||||
|
${_File} ${STAGE_DIR_OEM} nmap.exe
|
||||||
|
${_File} ${STAGE_DIR} nse_main.lua
|
||||||
|
${_File} ${STAGE_DIR} nmap.xsl
|
||||||
|
${_File} ${STAGE_DIR} nmap_performance.reg
|
||||||
|
${_File} ${STAGE_DIR} README-WIN32
|
||||||
|
${_File} ${STAGE_DIR} 3rd-party-licenses.txt
|
||||||
|
${_Dir} ${STAGE_DIR} licenses
|
||||||
|
${_File} ${STAGE_DIR} libssh2.dll
|
||||||
|
${_File} ${STAGE_DIR} zlibwapi.dll
|
||||||
|
${_File} ${STAGE_DIR} libcrypto-3.dll
|
||||||
|
${_File} ${STAGE_DIR} libssl-3.dll
|
||||||
|
${_Dir} ${STAGE_DIR} scripts
|
||||||
|
${_Dir} ${STAGE_DIR} nselib
|
||||||
|
${_File} ${STAGE_DIR} icon1.ico
|
||||||
|
FunctionEnd
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
!macro SecZenmapFiles un
|
||||||
|
Function ${un}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
|
||||||
|
${_File} ${STAGE_DIR} ndiff.py
|
||||||
|
${_File} ${STAGE_DIR} ndiff.bat
|
||||||
|
${_File} ${STAGE_DIR} NDIFF_README
|
||||||
|
FunctionEnd
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
!macro SecNcatFiles un
|
||||||
|
Function ${un}SecNcatFiles
|
||||||
|
${_File} ${STAGE_DIR} ncat.exe
|
||||||
|
${_File} ${STAGE_DIR} ca-bundle.crt
|
||||||
|
FunctionEnd
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
!macro SecNpingFiles un
|
||||||
|
Function ${un}SecNpingFiles
|
||||||
|
${_File} ${STAGE_DIR} nping.exe
|
||||||
|
FunctionEnd
|
||||||
|
!macroend
|
||||||
Reference in New Issue
Block a user