diff --git a/CHANGELOG b/CHANGELOG index 033ffbc35..33b8e1e33 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ # Nmap Changelog ($Id$); -*-text-*- +o Upgraded our Winpcap installer to use the new WinPcap version 4.1.1. + A bug which could prevent proper uninstallation of previous versions + was fixed at the same time. [Rob Nicholls] + o [NSE] Modified NSE script ssl-cert.nse to support TLS negotiation against SMTP ports that support it. Depends on Patrick's addition of the reconnect_ssl method. [Tom Sellers, David] diff --git a/mswin32/lib/Packet.lib b/mswin32/lib/Packet.lib index 3f3cb56ea..c2b2a399b 100644 Binary files a/mswin32/lib/Packet.lib and b/mswin32/lib/Packet.lib differ diff --git a/mswin32/lib/Wpcap.lib b/mswin32/lib/Wpcap.lib index a6c72a230..2605753e0 100644 Binary files a/mswin32/lib/Wpcap.lib and b/mswin32/lib/Wpcap.lib differ diff --git a/mswin32/nsis/Nmap.nsi b/mswin32/nsis/Nmap.nsi index 585f5dcb4..722250634 100644 --- a/mswin32/nsis/Nmap.nsi +++ b/mswin32/nsis/Nmap.nsi @@ -214,19 +214,31 @@ Section "Register Nmap Path" SecRegisterPath Call AddToPath SectionEnd -Section "WinPcap 4.02" SecWinPcap +Section "WinPcap 4.1.1" SecWinPcap SetOutPath "$INSTDIR" SetOverwrite on - File ..\winpcap\winpcap-nmap-4.02.exe + File ..\winpcap\winpcap-nmap-4.11.exe ; If the Nmap installer was launched using /S then pass some arguments to WinPcap IfSilent winpcap_silent winpcap_loud winpcap_silent: - ExecWait '"$INSTDIR\winpcap-nmap-4.02.exe" /S /D=$\""$PROGRAMFILES\WinPcap\"$\"' + ; check for x64 so we install files into C:\Program Files on both platforms + ; as this is consistent with WinPcap 4.1 (even though rpcapd is a 32-bit + ; executable that probably should be in C:\Program Files (x86)\ (where we've + ; installed it in the past). Otherwise install in the normal x86 location. + System::Call "kernel32::GetCurrentProcess() i .s" + System::Call "kernel32::IsWow64Process(i s, *i .r0)" + StrCmp $0 "0" InstDir32bit InstDir64bit + InstDir64bit: + ExecWait '"$INSTDIR\winpcap-nmap-4.11.exe" /S /D=$\""$PROGRAMFILES64\WinPcap\"$\"' + Goto InstDirDone + InstDir32bit: + ExecWait '"$INSTDIR\winpcap-nmap-4.11.exe" /S /D=$\""$PROGRAMFILES\WinPcap\"$\"' + InstDirDone: Goto delete_winpcap winpcap_loud: - ExecWait '"$INSTDIR\winpcap-nmap-4.02.exe"' + ExecWait '"$INSTDIR\winpcap-nmap-4.11.exe"' delete_winpcap: - Delete "$INSTDIR\winpcap-nmap-4.02.exe" + Delete "$INSTDIR\winpcap-nmap-4.11.exe" SectionEnd Section "Network Performance Improvements" SecPerfRegistryMods @@ -270,7 +282,7 @@ SectionEnd ;Component strings LangString DESC_SecCore ${LANG_ENGLISH} "Installs Nmap executable, NSE scripts and Visual C++ 2008 runtime components" LangString DESC_SecRegisterPath ${LANG_ENGLISH} "Registers Nmap path to System path so you can execute it from any directory" - LangString DESC_SecWinPcap ${LANG_ENGLISH} "Installs WinPcap 4.0 (required for most Nmap scans unless it is already installed)" + LangString DESC_SecWinPcap ${LANG_ENGLISH} "Installs WinPcap 4.1 (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." LangString DESC_SecZenmap ${LANG_ENGLISH} "Installs Zenmap, the official Nmap graphical user interface. Recommended." LangString DESC_SecNcat ${LANG_ENGLISH} "Installs Ncat, Nmap's Netcat replacement." diff --git a/mswin32/winpcap/LICENSE b/mswin32/winpcap/LICENSE index c960a775d..9b14b6bad 100644 --- a/mswin32/winpcap/LICENSE +++ b/mswin32/winpcap/LICENSE @@ -1,5 +1,5 @@ Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy). -Copyright (c) 2005 - 2007 CACE Technologies, Davis (California). +Copyright (c) 2005 - 2009 CACE Technologies, Davis (California). All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -11,7 +11,7 @@ Redistribution and use in source and binary forms, with or without modification, THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This product includes software developed by the University of California, Lawrence Berkeley Laboratory and its contributors. -This product includes software developed by the Kungliga Tekniska Hgskolan and its contributors. +This product includes software developed by the Kungliga Tekniska Högskolan and its contributors. This product includes software developed by Yen Yen Lim and North Dakota State University. ------------------------------------------ @@ -28,12 +28,12 @@ Portions Copyright (c) 1983 Regents of the University of California. All rights Redistribution and use in source and binary forms are permitted provided that the above copyright notice and this paragraph are duplicated in all such forms and that any documentation, advertising materials, and other materials related to such distribution and use acknowledge that the software was developed by the University of California, Berkeley. The name of the University may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. ------------------------------------------ -Portions Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Hgskolan (Royal Institute of Technology, Stockholm, Sweden). All rights reserved. +Portions Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan (Royal Institute of Technology, Stockholm, Sweden). All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -3. All advertising materials mentioning features or use of this software must display the following acknowledgement: "This product includes software developed by the Kungliga Tekniska Hgskolan and its contributors." +3. All advertising materials mentioning features or use of this software must display the following acknowledgement: "This product includes software developed by the Kungliga Tekniska Högskolan and its contributors." 4. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ------------------------------------------ @@ -75,4 +75,3 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTOR "AS IS" AND A Portions Copyright 1989 by Carnegie Mellon. Permission to use, copy, modify, and distribute this program for any purpose and without fee is hereby granted, provided that this copyright and permission notice appear on all copies and supporting documentation, the name of Carnegie Mellon not be used in advertising or publicity pertaining to distribution of the program without specific prior permission, and notice be given in supporting documentation that copying and distribution is by permission of Carnegie Mellon and Stanford University. Carnegie Mellon makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. - diff --git a/mswin32/winpcap/Packet.dll b/mswin32/winpcap/Packet.dll index 7cec47c66..7975174c4 100644 Binary files a/mswin32/winpcap/Packet.dll and b/mswin32/winpcap/Packet.dll differ diff --git a/mswin32/winpcap/Upgrading-Instructions.txt b/mswin32/winpcap/Upgrading-Instructions.txt index f21bc50dc..73144fc16 100644 --- a/mswin32/winpcap/Upgrading-Instructions.txt +++ b/mswin32/winpcap/Upgrading-Instructions.txt @@ -1,51 +1,51 @@ -How to upgrade Nmap to a new WinPcap release (2007) +How to upgrade Nmap to a new WinPcap release (2009) --------------------------------------------------- 1) Download the latest version of WinPcap from www.winpcap.org and make - a note of the version (for example 4.0). + a note of the version (for example 4.1). -2) Remove all instances of WinPcap (through Add/Remove Programs), then - install the new version. +2) Update the LICENSE file, if necessary. I couldn't find a plain + WinPcap license file anywhere. There's an HTML version at + http://www.winpcap.org/misc/copyright.htm. You can copy and paste + the license text from the installer into the LICENSE file. - 2a) Update the LICENSE file, if necessary. I couldn't find a plain - WinPcap license file anywhere. There's an HTML version at - http://www.winpcap.org/misc/copyright.htm. You can copy and paste - the license text from the installer into the LICENSE file. - -3) Copy the installed files into the mswin32/winpcap directory. The - installed files at time of writing are +3) Extract all the files from the setup file using 7-Zip + (http://www.7-zip.org/). Enter the $SYSDIR subdirectory. One by one, + extract (you can drag and drop) the different copies of the files. + Copy the files into the mswin32/winpcap directory (you may need to + install WinPcap in order to determine the correct files; if you get + two similar looking files it's usually the smaller one). The installed + files at time of writing are: C:\Program Files\WinPcap\rpcapd.exe C:\Windows\system32\Packet.dll C:\Windows\system32\pthreadVC.dll - C:\Windows\system32\WanPacket.dll C:\Windows\system32\wpcap.dll C:\Windows\system32\drivers\npf.sys -4) Copy the Vista version of Packet.dll. This is tricky because there - are several (three, as of this writing) versions of Packet.dll in the - installer but only one is installed at a time. You can see all the - versions by opening the installer with 7-Zip (http://www.7-zip.org/). - Select the installer within 7-Zip and click "File", "Open Inside". - Enter the $SYSDIR subdirectory. One by one, extract (you can drag and - drop) the copies of Packet.dll somewhere. Right-click on each - Packet.dll, click "Properties", then select the "Version" tab. The + The Vista version of Packet.dll needs to be extracted into the + mswin32/winpcap/vista subdirectory. Right click on each Packet.dll, + click "Properties", then select the "Version" tab. The "Description:" field will have a string containing "NT4", "NT5", or - "Vista". When you find the Vista file copy it to vista/Packet.dll. + "Vista". We don't support NT4, so those files are not required. -5) Open winpcap-nmap.nsi. - 5a) Change the version for the following lines: + The AMD64 version of npf.sys needs to be extracted into the + mswin32/winpcap/x64 subdirectory. Right click on each npf.sys, + click "Properties", then select the "Version" tab. The + "Description:" field will have a string containing "AMD64". - Name "WinPcap (Nmap) X.X" - OutFile "winpcap-nmap-X.X.exe - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\winpcap-nmap" "DisplayName" "winpcap-nmap X.X" +4) Open winpcap-nmap.nsi. Change the version for the following lines: - 5b) Get the internal 'FileVersion' from wpcap.dll. Right-click on - wpcap.dll and select "Properties", then select the "Version" tab. - Copy the number there into this part of winpcap-nmap.nsi: + Name "WinPcap (Nmap) X.X.X" + OutFile "winpcap-nmap-X.XX.exe + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\winpcap-nmap" "DisplayName" "winpcap-nmap X.XX" - var /GLOBAL my_ver - StrCpy $my_ver "X.X.X.X" <-- file version goes here +5) Get the internal 'FileVersion' from wpcap.dll. Right-click on + wpcap.dll and select "Properties", then select the "Version" tab. + Copy the number there into this part of winpcap-nmap.nsi: + + var /GLOBAL my_ver + StrCpy $my_ver "X.X.X.X" <-- file version goes here 6) Generate installer exe by compiling winpcap-nmap.nsi using the running the command diff --git a/mswin32/winpcap/npf.sys b/mswin32/winpcap/npf.sys index bd23114d9..daebc52ac 100644 Binary files a/mswin32/winpcap/npf.sys and b/mswin32/winpcap/npf.sys differ diff --git a/mswin32/winpcap/rpcapd.exe b/mswin32/winpcap/rpcapd.exe index 8007fbb7a..a90ff6ed9 100755 Binary files a/mswin32/winpcap/rpcapd.exe and b/mswin32/winpcap/rpcapd.exe differ diff --git a/mswin32/winpcap/vista/Packet.dll b/mswin32/winpcap/vista/Packet.dll index 8ed77f38a..a0d04c5ae 100644 Binary files a/mswin32/winpcap/vista/Packet.dll and b/mswin32/winpcap/vista/Packet.dll differ diff --git a/mswin32/winpcap/winpcap-nmap.nsi b/mswin32/winpcap/winpcap-nmap.nsi index d4dc9880b..7bc1df744 100644 --- a/mswin32/winpcap/winpcap-nmap.nsi +++ b/mswin32/winpcap/winpcap-nmap.nsi @@ -6,6 +6,9 @@ ;; Updated to 4.01, July 2007 ;; Updated to 4.02, November 2007 +;; Rob Nicholls +;; Updated to 4.1.1, October 2009 + ;-------------------------------- ;Include Modern UI @@ -15,23 +18,21 @@ ;General ; The name of the installer -Name "WinPcap (Nmap) 4.0.2" +Name "WinPcap (Nmap) 4.1.1" ; The file to write -OutFile "winpcap-nmap-4.02.exe" +OutFile "winpcap-nmap-4.11.exe" RequestExecutionLevel admin ; The default installation directory InstallDir $PROGRAMFILES\WinPcap +;No longer check registry for the location, let installer handle everything. -;Get installation folder from registry if available -InstallDirRegKey HKLM "Software\WinPcap" "" - -VIProductVersion "4.0.0.1040" -VIAddVersionKey /LANG=1033 "FileVersion" "4.0.0.1040" +VIProductVersion "4.1.0.1753" +VIAddVersionKey /LANG=1033 "FileVersion" "4.1.0.1753" VIAddVersionKey /LANG=1033 "ProductName" "WinPcap" -VIAddVersionKey /LANG=1033 "FileDescription" "WinPcap 4.0.2 installer" +VIAddVersionKey /LANG=1033 "FileDescription" "WinPcap 4.1.1 installer" VIAddVersionKey /LANG=1033 "LegalCopyright" "" ;-------------------------------- @@ -75,7 +76,7 @@ VIAddVersionKey /LANG=1033 "LegalCopyright" "" ;Pages !insertmacro MUI_PAGE_LICENSE "LICENSE" -!insertmacro MUI_PAGE_DIRECTORY +; Don't let user choose where to install the files. WinPcap doesn't let people, and it's one less thing for us to worry about. !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES @@ -112,8 +113,8 @@ Function .onInit var /GLOBAL inst_ver var /GLOBAL my_ver - StrCpy $my_ver "4.0.0.1040" - + StrCpy $my_ver "4.1.0.1753" + IfSilent do_silent no_silent do_silent: @@ -138,6 +139,8 @@ Function .onInit Delete $0\rpcapd.exe Delete $0\LICENSE Delete $0\uninstall.exe + ; Official 4.1 installer creates an install.log + Delete $0\install.log RMDir "$0" DeleteRegKey HKLM "Software\WinPcap" @@ -189,8 +192,21 @@ Function .onInit finish: ReadRegStr $0 "HKLM" "Software\WinPcap" "" - - IfFileExists "$0\Uninstall.exe" run_uninstaller + ; Strip any surrounding double quotes from around the install string + ; this is required as all of our previous installers (since at least 2006) + ; have incorrectly stored this information (oops!). + ; Check the first and last character for safety! + StrCpy $1 $0 1 + StrCmp $1 "$\"" maybestripquotes nostrip + maybestripquotes: + StrLen $1 $0 + IntOp $1 $1 - 1 + StrCpy $1 $0 1 $1 + StrCmp $1 "$\"" stripquotes nostrip + stripquotes: + StrCpy $0 $0 -1 1 + nostrip: + IfFileExists "$0\uninstall.exe" run_uninstaller return run_uninstaller: @@ -272,17 +288,8 @@ FunctionEnd ; The stuff to install Section "WinPcap" SecWinPcap - ; Set output path to the installation directory. - SetOutPath $INSTDIR - - ; Put file there - File rpcapd.exe - File LICENSE - - WriteUninstaller "uninstall.exe" - + ; These x86 files are automatically redirected to the right place on x64 SetOutPath $SYSDIR - File pthreadVC.dll File wpcap.dll @@ -293,38 +300,48 @@ Section "WinPcap" SecWinPcap StrCmp $R0 '6.' vista_files File Packet.dll - File WanPacket.dll + ; WanPacket.dll no longer present as of 4.1.0 Goto install vista_files: File vista\Packet.dll install: - SetOutPath $SYSDIR\drivers - + ; check for x64, install the correct npf.sys file into system32\drivers System::Call "kernel32::GetCurrentProcess() i .s" System::Call "kernel32::IsWow64Process(i s, *i .r0)" StrCmp $0 "0" is32bit is64bit is32bit: - DetailPrint "Installing x86 driver" + SetOutPath "$PROGRAMFILES\WinPcap" + File rpcapd.exe + File LICENSE + WriteUninstaller "$PROGRAMFILES\WinPcap\uninstall.exe" + DetailPrint "Installing x86 driver" + SetOutPath $SYSDIR\drivers File npf.sys ; x86 NT5/NT6 version + WriteRegStr HKLM "Software\WinPcap" "" "$PROGRAMFILES\WinPcap" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\winpcap-nmap" "UninstallString" "$PROGRAMFILES\WinPcap\uninstall.exe" Goto npfdone is64bit: - DetailPrint "Installing x64 driver" + SetOutPath "$PROGRAMFILES64\WinPcap" + File rpcapd.exe + File LICENSE + WriteUninstaller "$PROGRAMFILES64\WinPcap\uninstall.exe" + DetailPrint "Installing x64 driver" + SetOutPath $SYSDIR\drivers ; disable Wow64FsRedirection System::Call kernel32::Wow64EnableWow64FsRedirection(i0) File x64\npf.sys ; x64 NT5/NT6 version + WriteRegStr HKLM "Software\WinPcap" "" "$PROGRAMFILES64\WinPcap" ; re-enable Wow64FsRedirection System::Call kernel32::Wow64EnableWow64FsRedirection(i1) + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\winpcap-nmap" "UninstallString" "$PROGRAMFILES64\WinPcap\uninstall.exe" npfdone: - ; Install some basic registry keys - WriteRegStr HKLM "Software\WinPcap" "" '"$INSTDIR"' - ; stop the service, in case it's still registered, so it can be deleted nsExec::Exec "net stop npf" @@ -338,9 +355,8 @@ Section "WinPcap" SecWinPcap Call autoStartWinPcap skip_auto_start: - ; Write the uninstall keys for Windows - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\winpcap-nmap" "DisplayName" "winpcap-nmap 4.02" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\winpcap-nmap" "UninstallString" '"$INSTDIR\uninstall.exe"' + ; Write the rest of the uninstall keys for Windows + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\winpcap-nmap" "DisplayName" "winpcap-nmap 4.11" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\winpcap-nmap" "NoModify" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\winpcap-nmap" "NoRepair" 1 @@ -366,7 +382,7 @@ Section "Uninstall" Delete $SYSDIR\Packet.dll Delete $SYSDIR\pthreadVC.dll - Delete $SYSDIR\WanPacket.dll + ; No longer need to delete WanPacket.dll as of WinPcap 4.1.0. Delete $SYSDIR\wpcap.dll ; check for x64, delete npf.sys file from system32\drivers diff --git a/mswin32/winpcap/wpcap.dll b/mswin32/winpcap/wpcap.dll index bafac9a40..2babd78da 100644 Binary files a/mswin32/winpcap/wpcap.dll and b/mswin32/winpcap/wpcap.dll differ diff --git a/mswin32/winpcap/x64/npf.sys b/mswin32/winpcap/x64/npf.sys index ec165d521..fbc71bcb7 100644 Binary files a/mswin32/winpcap/x64/npf.sys and b/mswin32/winpcap/x64/npf.sys differ