Remove VC++ 2008 runtime; Python uses VC 14+ same as our builds now.

This commit is contained in:
dmiller 2021-08-03 19:29:10 +00:00
parent 0dc7df9573
commit 76b25678d1
3 changed files with 50 additions and 103 deletions

View file

@ -788,7 +788,7 @@ specific release). Most Nmap users choose this option since it is so
easy. Another advantage of the self-installer is that it provides the option to install the Zenmap GUI and other tools. Simply run the installer file and let it walk you through
panels for choosing an install path and installing Npcap. The
installer was created with the open-source <ulink
url="http://nsis.sourceforge.net/Main_Page">Nullsoft Scriptable
url="http://nsis.sourceforge.io/Main_Page">Nullsoft Scriptable
Install System</ulink>. After it completes, read <xref
linkend="inst-win-exec"/> for instructions on executing Nmap on the
command-line or through Zenmap.</para>
@ -807,24 +807,18 @@ graphical interface is included, so you need to run
download and install a superior command shell such as those included
with the free
Cygwin<indexterm><primary>Cygwin</primary></indexterm>
system available from <ulink url="http://www.cygwin.com" />. Here are the step-by-step instructions for installing and executing the Nmap .zip binaries.</para>
system available from <ulink url="https://www.cygwin.com" />. Here are the step-by-step instructions for installing and executing the Nmap .zip binaries.</para>
<sect3 id="inst-win-zip-install"><title>Installing the Nmap zip binaries</title>
<orderedlist>
<listitem><para>Download the .zip binaries from <ulink url="https://nmap.org/download.html" />.</para></listitem>
<listitem><para>Uncompress the zip file into the directory you want
<listitem><para>Extract the zip file into the directory you want
Nmap to reside in. An example would be <filename>C:\Program
Files</filename>. A directory called
<filename>nmap-<replaceable>version</replaceable></filename> should be created, which includes
the Nmap executable and data files. Microsoft Windows XP and later
includes zip extraction&mdash;just right-click on the file in
<application>Explorer</application>. If you do not have a Zip
decompression program, there is one (called unzip) in Cygwin described
above, or you can download the open-source and free <ulink
url="http://www.7-zip.org">7-Zip utility</ulink>. Commercial
alternatives are <ulink url="http://www.winzip.com">WinZip</ulink> and
<ulink url="http://www.pkware.com">PKZIP</ulink>.</para></listitem>
the Nmap executable and data files.
</para></listitem>
<listitem><para>For improved performance, apply the Nmap Registry
changes discussed previously.</para></listitem>
@ -838,9 +832,9 @@ the latest version from <ulink url="https://npcap.org" />.
</para></listitem>
<listitem><para>Due to the way Nmap is compiled, it requires the
<ulink role="hidepdf" url="http://www.microsoft.com/download/details.aspx?id=40784">Microsoft Visual C++ 2013 Redistributable Package</ulink> of runtime
<ulink role="hidepdf" url="https://aka.ms/vs/16/release/vc_redist.x86.exe">Microsoft Visual C++ Redistributable Package</ulink> of runtime
components. Many systems already have this installed from other
packages, but you should run <filename>vcredist_x86.exe</filename>
packages, but you should run <filename>VC_redist.x86.exe</filename>
from the zip file just in case you need it.
Pass the <option>/q</option> option to run these installers in quiet (non interactive) mode.</para></listitem>
@ -857,10 +851,9 @@ given in <xref linkend="inst-win-exec"/>.</para></listitem>
<para>Most Windows users prefer to use the Nmap binary self-installer,
but compilation from source code is an option, particularly if you plan to help with Nmap development. Compilation requires
Microsoft Visual C++ 2013, which is part of their commercial Visual Studio
suite. Any of the Visual Studio 2013 editions should work, including the free
<ulink url="https://www.microsoft.com/en-us/download/details.aspx?id=48131">
Visual C++ 2013 Express</ulink>.</para>
Microsoft Visual C++ 2019, which is part of their commercial <ulink url="https://visualstudio.microsoft.com/vs/">Visual Studio</ulink>
suite. Any of the Visual Studio 2019 editions should work, including the free
Visual Studio 2019 Community.</para>
<para>
Some of Nmap's dependencies on Windows are inconvenient to build. For
@ -893,7 +886,7 @@ point to the alternate directory.
<listitem><para>Uncompress the source code file you just downloaded. The
source code directory and the <filename>nmap-mswin32-aux</filename> must
be in the same parent directory.
Recent releases of the free <ulink url="http://www.cygwin.com/">Cygwin distribution</ulink><indexterm><primary>Cygwin</primary></indexterm> can handle both the <filename>.tar.bz2</filename> and <literal>.tgz</literal> formats. Use the command <command>tar xvjf nmap-version.tar.bz2</command> or <command>tar xvzf nmap-version.tgz</command>, respectively. Alternatively, the common <application>WinZip</application> application can decompress these files.</para></listitem>
Recent releases of the free <ulink url="https://www.cygwin.com/">Cygwin distribution</ulink><indexterm><primary>Cygwin</primary></indexterm> can handle both the <filename>.tar.bz2</filename> and <literal>.tgz</literal> formats. Use the command <command>tar xvjf nmap-version.tar.bz2</command> or <command>tar xvzf nmap-version.tgz</command>, respectively. Alternatively, the common <application>WinZip</application> application can decompress these files.</para></listitem>
<listitem><para>Open Visual Studio and the Nmap solution file (<filename>nmap-<replaceable>version</replaceable>/mswin32/nmap.sln</filename>).</para></listitem>
@ -977,18 +970,12 @@ the program menu tree, the simplest approach is to choose <guimenu>Start</guimen
</figure>
<para>If you execute Nmap frequently, you can add the Nmap directory
(<filename>c:\Program Files (x86)\Nmap</filename> by default on
Windows 7) to your command execution path. The exact place
to set this varies by Windows platform. On my Windows XP box, which
installs Nmap in <filename>c:\Program Files\Nmap</filename>, I do the
following:</para>
(<filename>c:\Program Files (x86)\Nmap</filename> by default) to your command execution path:
<para>
<orderedlist>
<listitem><para>From the desktop, right click on <literal>My
Computer</literal> and then click <guimenuitem>properties</guimenuitem>.</para></listitem>
<listitem><para>In the System Properties window, click the
<guimenuitem>Advanced</guimenuitem> tab.</para></listitem>
<listitem><para>Open the System Properties window to the Advanced tab by running <literal>SystemPropertiesAdvanced.exe</literal>.
</para></listitem>
<listitem><para>Click the <guimenuitem>Environment
Variables</guimenuitem> button.</para></listitem>
@ -1000,9 +987,9 @@ Choose <literal>Path</literal> from the
<literal>System variables</literal> section, then hit
edit.</para></listitem>
<listitem><para>Add a semi-colon and then your Nmap directory (e.g. <filename>c:\Program Files\Nmap</filename>) to the end of the value.</para></listitem>
<listitem><para>Add a semi-colon and then your Nmap directory (e.g. <filename>c:\Program Files (x86)\Nmap</filename>) to the end of the value.</para></listitem>
<listitem><para>Open a new DOS window and you should be able to execute a
<listitem><para>Open a new command prompt and you should be able to execute a
command such as <command>nmap scanme.nmap.org</command> from any directory.</para></listitem>
</orderedlist>

View file

@ -1,4 +1,4 @@
MAKENSIS=C:/Program Files (x86)/NSIS-strlen/makensis.exe
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/x86/signtool.exe%')
NMAPDIR=..
NMAPDIR_WIN=$(shell echo '$(NMAPDIR)' | sed 's|/cygdrive/\(.\)|\1:|;s|/|\\|g')
@ -49,7 +49,6 @@ stage-common: $(NMAPDIR)/CHANGELOG $(NMAPDIR)/LICENSE $(NMAPDIR)/nmap-mac-prefix
cp -r $(NMAPDIR)/docs/licenses nmap-$(NMAP_VERSION)/
rm -rf nmap-$(NMAP_VERSION)/licenses/.svn
cp VC_redist.x86.exe nmap-$(NMAP_VERSION)
#cp $(NMAP_MSWIN32_AUX)/vcredist2008_x86.exe nmap-$(NMAP_VERSION)
cp $(NMAPDIR)/ncat/$(VCCONFIG)/ncat.exe nmap-$(NMAP_VERSION)
cp $(NMAPDIR)/ncat/$(VCCONFIG)/ca-bundle.crt nmap-$(NMAP_VERSION)
cp $(NMAPDIR)/nping/$(VCCONFIG)/nping.exe nmap-$(NMAP_VERSION)
@ -79,10 +78,21 @@ sign-files: nmap-$(NMAP_VERSION)-oem/nmap.exe nmap-$(NMAP_VERSION)/nmap.exe nmap
"$(SIGNTOOL)" $(SIGNTOOL_ARGS) $^
touch sign-files
NSIS_COMMON_ARGS = "/DVERSION=$(NMAP_VERSION)" "/DNUM_VERSION=$(NMAP_NUM_VERSION)" "/DNPCAP_VERSION=$(NPCAP_VERSION)" '/DSIGNTOOL_CMD="$(SIGNTOOL)" $(SIGNTOOL_ARGS)'
NSIS_COMMON_ARGS = "/DVERSION=$(NMAP_VERSION)" "/DNUM_VERSION=$(NMAP_NUM_VERSION)" "/DNPCAP_VERSION=$(NPCAP_VERSION)"
bundle-nsis: sign-files
"$(MAKENSIS)" $(NSIS_COMMON_ARGS) "/DNMAP_NAME=$(NMAP_NAME)" nmap-$(NMAP_VERSION)/Nmap.nsi
"$(MAKENSIS)" $(NSIS_COMMON_ARGS) "/DNMAP_NAME=$(NMAP_OEM_NAME)" "/DNMAP_OEM=1" nmap-$(NMAP_VERSION)/Nmap.nsi
rm -f nmap-$(NMAP_VERSION)*/tempinstaller.exe nmap-$(NMAP_VERSION)*/Uninstall.exe
# Make the uninstallers
"$(MAKENSIS)" /DINNER $(NSIS_COMMON_ARGS) "/DNMAP_NAME=$(NMAP_NAME)" nsis/Nmap.nsi
nmap-$(NMAP_VERSION)/tempinstaller.exe || test $$? -eq 2
test -f nmap-$(NMAP_VERSION)/Uninstall.exe
"$(MAKENSIS)" /DINNER $(NSIS_COMMON_ARGS) "/DNMAP_NAME=$(NMAP_OEM_NAME)" "/DNMAP_OEM=1" nsis/Nmap.nsi
nmap-$(NMAP_VERSION)-oem/tempinstaller.exe || test $$? -eq 2
test -f nmap-$(NMAP_VERSION)-oem/Uninstall.exe
# Sign uninstallers
"$(SIGNTOOL)" $(SIGNTOOL_ARGS) nmap-$(NMAP_VERSION)/Uninstall.exe nmap-$(NMAP_VERSION)-oem/Uninstall.exe
# Now build the installers
"$(MAKENSIS)" $(NSIS_COMMON_ARGS) "/DNMAP_NAME=$(NMAP_NAME)" nsis/Nmap.nsi
"$(MAKENSIS)" $(NSIS_COMMON_ARGS) "/DNMAP_NAME=$(NMAP_OEM_NAME)" "/DNMAP_OEM=1" nsis/Nmap.nsi
"$(SIGNTOOL)" $(SIGNTOOL_ARGS) nmap-$(NMAP_VERSION)-setup.exe nmap-$(NMAP_VERSION)-oem-setup.exe
bundle-zip: bundle-zip-public bundle-zip-oem
@ -107,7 +117,6 @@ bundle-zip-main: sign-files
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/py2exe/\* \
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/COPYING_HIGWIDGETS \
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/w9xpopen.exe \
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/vcredist2008_x86.exe \
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/ndiff.exe \
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/Uninstall.exe \
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/icon1.ico \

View file

@ -27,7 +27,7 @@
!define STAGE_DIR ..\nmap-${VERSION}
!ifdef NMAP_OEM
!include "..\..\nmap-build\nmap-oem.nsh"
!include "..\..\..\nmap-build\nmap-oem.nsh"
!define STAGE_DIR_OEM ${STAGE_DIR}-oem
!else
!define STAGE_DIR_OEM ${STAGE_DIR}
@ -45,39 +45,19 @@
;General
;Name and file
Name "${NMAP_NAME}"
;--------------------------------
; Sign the uninstaller
; http://nsis.sourceforge.net/Signing_an_Uninstaller
Unicode true
!ifdef INNER
# Write an uninstaller only
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!echo "Inner invocation" ; just to see what's going on
OutFile "$%TEMP%\tempinstaller.exe" ; not really important where this is
OutFile "${STAGE_DIR_OEM}\tempinstaller.exe" ; Ensure we don't confuse these
SetCompress off ; for speed
RequestExecutionLevel user
!else
!echo "Outer invocation"
; Call makensis again, defining INNER. This writes an installer for us which, when
; it is invoked, will just write the uninstaller to some location, and then exit.
; Be sure to substitute the name of this script here.
!system `"${NSISDIR}\makensis.exe" /DINNER Nmap.nsi` = 0
; So now run that installer we just created as %TEMP%\tempinstaller.exe. Since it
; calls quit the return value isn't zero.
!system "$\"$%TEMP%\tempinstaller.exe$\"" = 2
; That will have written an uninstaller binary for us. Now we sign it with your
; favourite code signing tool.
;!system "icacls.exe $\"$%TEMP%\Uninstall.exe$\" /grant $\"$%USER%$\":M"
!system `copy /b "$%TEMP%\Uninstall.exe" "${STAGE_DIR_OEM}\Uninstall.exe"`
!system `${SIGNTOOL_CMD} "${STAGE_DIR_OEM}\Uninstall.exe"` = 0
; Good. Now we can carry on writing the real installer.
OutFile ${STAGE_DIR_OEM}-setup.exe
@ -132,7 +112,6 @@
!ifndef NMAP_OEM
Var zenmapset
Var vcredist2008set
!endif
Var addremoveset
Var vcredistset
@ -308,7 +287,7 @@ Section "Zenmap (GUI Frontend)" SecZenmap
File /r ${STAGE_DIR}\share
File /r ${STAGE_DIR}\py2exe
StrCpy $zenmapset "true"
Call vcredist2008installer
Call vcredistinstaller
Call create_uninstaller
SectionEnd
@ -319,7 +298,7 @@ Section "Ndiff (Scan comparison tool)" SecNdiff
File ${STAGE_DIR}\NDIFF_README
File ${STAGE_DIR}\python27.dll
File /r ${STAGE_DIR}\py2exe
Call vcredist2008installer
Call vcredistinstaller
Call create_uninstaller
SectionEnd
!endif
@ -341,13 +320,19 @@ Section "Nping (Packet generator)" SecNping
Call create_uninstaller
SectionEnd
!macro VCRuntimeInstalled _a _b _t _f
# Custom LogicLib test macro
!macro _VCRedistInstalled _a _b _t _f
SetRegView 32
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\VisualStudio\${VCREDISTVER}\VC\Runtimes\${NMAP_ARCH}" "Installed"
StrCmp $0 "1" `${_t}` `${_f}`
!macroend
# add dummy parameters for our test
!define VCRedistInstalled `"" VCRedistInstalled ""`
Function vcredistinstaller
StrCmp $vcredistset "" 0 vcredist_done
${If} $vcredistset != ""
Return
${EndIf}
StrCpy $vcredistset "true"
;Check if VC++ runtimes are already installed.
;This version creates a registry key that makes it easy to check whether a version (not necessarily the
@ -371,42 +356,6 @@ Function vcredistinstaller
${EndIf}
FunctionEnd
!ifndef NMAP_OEM
Function vcredist2008installer
StrCmp $vcredist2008set "" 0 vcredist2008_done
StrCpy $vcredist2008set "true"
;Check if VC++ 2008 runtimes are already installed.
;NOTE Both the UID in the registry key and the DisplayName string must be updated here (and below)
;whenever the Redistributable package is upgraded:
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{9BE518E6-ECC6-35A9-88E4-87755C07200F}" "DisplayName"
StrCmp $0 "Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.6161" vcredist2008_done vcredist2008_check_wow6432node
;On x64 systems we need to check the Wow6432Node registry key instead
vcredist2008_check_wow6432node:
ReadRegStr $0 HKLM "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{9BE518E6-ECC6-35A9-88E4-87755C07200F}" "DisplayName"
StrCmp $0 "Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.6161" vcredist2008_done vcredist2008_silent_install
;If VC++ 2008 runtimes are not installed...
vcredist2008_silent_install:
DetailPrint "Installing Microsoft Visual C++ 2008 Redistributable"
SetOutPath $PLUGINSDIR
File ${STAGE_DIR}\vcredist2008_x86.exe
ExecWait '"$PLUGINSDIR\vcredist2008_x86.exe" /q' $0
;Check for successful installation of our 2008 version of vcredist_x86.exe...
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{9BE518E6-ECC6-35A9-88E4-87755C07200F}" "DisplayName"
StrCmp $0 "Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.6161" vcredist2008_success vcredist2008_not_present_check_wow6432node
vcredist2008_not_present_check_wow6432node:
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{9BE518E6-ECC6-35A9-88E4-87755C07200F}" "DisplayName"
StrCmp $0 "Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.6161" vcredist2008_success vcredist2008_not_present
vcredist2008_not_present:
DetailPrint "Microsoft Visual C++ 2008 Redistributable failed to install"
MessageBox MB_OK "Microsoft Visual C++ 2008 Redistributable Package (x86) failed to install. Please ensure your system meets the minimum requirements before running the installer again."
Goto vcredist2008_done
vcredist2008_success:
Delete "$PLUGINSDIR\vcredist2008_x86.exe"
DetailPrint "Microsoft Visual C++ 2008 Redistributable was successfully installed"
vcredist2008_done:
FunctionEnd
!endif
Function create_uninstaller
StrCmp $addremoveset "" 0 skipaddremove
; Register Nmap with add/remove programs
@ -450,7 +399,9 @@ Function .onInit
; the installer. This is better than processing a command line option as it means
; this entire code path is not present in the final (real) installer.
WriteUninstaller "$%TEMP%\Uninstall.exe"
${GetParent} "$EXEPATH" $0
MessageBox MB_OK "Writing '$0\Uninstall.exe'"
WriteUninstaller "$0\Uninstall.exe"
Quit ; just bail out quickly when running the "inner" installer
!endif
@ -491,7 +442,7 @@ FunctionEnd
LangString DESC_SecNpcap ${LANG_ENGLISH} "Installs Npcap ${NPCAP_VERSION} (required for most Nmap scans unless it is already installed)"
LangString DESC_SecPerfRegistryMods ${LANG_ENGLISH} "Modifies Windows registry values to improve TCP connect scan performance. Recommended."
!ifndef NMAP_OEM
LangString DESC_SecZenmap ${LANG_ENGLISH} "Installs Zenmap, the official Nmap graphical user interface, and Visual C++ 2008 runtime components. Recommended."
LangString DESC_SecZenmap ${LANG_ENGLISH} "Installs Zenmap, the official Nmap graphical user interface. Recommended."
LangString DESC_SecNdiff ${LANG_ENGLISH} "Installs Ndiff, a tool for comparing Nmap XML files."
!endif
LangString DESC_SecNcat ${LANG_ENGLISH} "Installs Ncat, Nmap's Netcat replacement."