1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Merge Nmap 7.96 release branch

This commit is contained in:
dmiller
2025-05-07 13:22:40 +00:00
parent eddc779a09
commit c66baf785e
23 changed files with 2272 additions and 2036 deletions

View File

@@ -1,11 +1,58 @@
#Nmap Changelog ($Id$); -*-text-*- #Nmap Changelog ($Id$); -*-text-*-
Nmap 7.96 [2025-05-01]
o Upgraded included libraries: OpenSSL 3.0.16, Lua 5.4.7, libssh2 1.11.1,
libpcap 1.10.5, libpcre2 10.45
o [Windows] Upgraded the included version of Npcap from version 1.79 to the
latest version 1.82, bringing faster packet injection, VLAN header capture,
and support for SR-IOV adapters, along with many other bug fixes and feature
enhancements described at https://npcap.com/changelog
o [GH#1451] Nmap now performs forward DNS lookups in parallel, using the same
engine that has been reliably performing reverse-DNS lookups for nearly a
decade. Scanning large lists of hostnames is now enormously faster and avoids
the unresponsive wait for blocking system calls, so progress stats can be
shown. In testing, resolving 1 million website names to both IPv4 and IPv6
took just over an hour. The previous system took 49 hours for the same data
set! [Daniel Miller]
o [Nping][GH#2862] Promoted Nping version number from a 0.7.95 alpha release to o [Nping][GH#2862] Promoted Nping version number from a 0.7.95 alpha release to
the same release version as Nmap. the same release version as Nmap.
o [Zenmap][GH#2358] Added dark mode, accessed via Profile->Toggle Dark Mode or
window::dark_mode in zenmap.conf. [Daniel Miller]
o [NSE] Added 3 new scripts, for a total of 612 NSE scripts:
+ [GH#2973] mikrotik-routeros-version queries MikroTik's WinBox router admin
service to get the RouterOS version. New service probes were also added for
this service. [deauther890, Daniel Miller]
+ mikrotik-routeros-username-brute brute-forces WinBox usernames for the
router using CVE-2024-54772. [deauther890]
+ targets-ipv6-eui64 generates target IPv6 addresses from a user-provided
file of MAC addresses, using the EUI-64 method. [Daniel Miller]
o [GH#2982] Fixed an issue preventing the Nmap OEM 7.95 uninstaller from o [GH#2982] Fixed an issue preventing the Nmap OEM 7.95 uninstaller from
correctly uninstalling Nmap OEM. correctly uninstalling Nmap OEM.
o [GH#2139][Nsock][Windows] Fixed the IOCP Nsock engine, which had been demoted
since Nmap 7.91 due to unresolved issues around SSL sockets and IPv6. [Daniel Miller]
o [GH#2113] Fixed the issue where TCP Connect scans (-sT) on Windows would show
'filtered' instead of 'closed', due to differences in understanding timeouts.
o [GH#2900][GH#2896][GH#2897] Nmap is now able to scan IP protocol 255.
[nnposter]
o Nmap will now allow targets to be specified both on the command line and in
an input file with -iL. Previously, if targets were provided in both places,
only the targets in the input file would be scanned, and no notice was given
that the command-line targets were ignored. [Daniel Miller]
o [Zenmap][GH#2854] Fixed a Zenmap crash in DiffViewer when Ndiff exits with error. o [Zenmap][GH#2854] Fixed a Zenmap crash in DiffViewer when Ndiff exits with error.
o [Zenmap] Fixed several UnicodeDecodeError or UnicodeEncodeError crashes o [Zenmap] Fixed several UnicodeDecodeError or UnicodeEncodeError crashes
@@ -19,20 +66,6 @@ o [GH#2838][GH#2836] Fixed a couple of issues with parsing the argument to the
o [NSE][GH#2852] Added TLS support to redis.lua and improved -sV detection of redis. o [NSE][GH#2852] Added TLS support to redis.lua and improved -sV detection of redis.
o [Zenmap][GH#2358] Added dark mode, accessed via Profile->Toggle Dark Mode or
window::dark_mode in zenmap.conf. [Daniel Miller]
o Upgraded included libraries: Lua 5.4.7, libssh2 1.11.1, libpcap 1.10.5,
libpcre 10.45
o [NSE] New script targets-ipv6-eui64 generates target IPv6 addresses from a
user-provided file of MAC addresses, using the EUI-64 method. [Daniel Miller]
o [NSE][GH#2973] New service probes and scripts for MikroTik's WinBox router
admin service. mikrotik-routeros-version queries the 'info' and 'list' files
to get the RouterOS version. mikrotik-routeros-username-brute brute-forces
usernames for the router using CVE-2024-54772. [deauther890, Daniel Miller]
o [GH#2954] Fix 2 potential crashes in parsing IPv6 extension headers o [GH#2954] Fix 2 potential crashes in parsing IPv6 extension headers
discovered using AFL++ fuzzer. [Domen Puncer Kugler, Daniel Miller] discovered using AFL++ fuzzer. [Domen Puncer Kugler, Daniel Miller]
@@ -66,9 +99,6 @@ o [NSE] Several fixes and extensions to the libssh2 NSE bindings: fixed
libssh2.channel_read_stderr, which was reading stdout instead; add binding libssh2.channel_read_stderr, which was reading stdout instead; add binding
for libssh2_userauth_publickey_frommemory; allow open_channel to avoid allocating a pty; for libssh2_userauth_publickey_frommemory; allow open_channel to avoid allocating a pty;
o [GH#2139][Nsock][Windows] Fixed the IOCP Nsock engine, which had been demoted
since Nmap 7.91 due to unresolved issues around SSL sockets and IPv6. [Daniel Miller]
o [Nsock] Improvements for platforms without selectable pcap handles (e.g. o [Nsock] Improvements for platforms without selectable pcap handles (e.g.
Windows). Interleaved pcap and socket events were favoring pcap reads, Windows). Interleaved pcap and socket events were favoring pcap reads,
possibly resulting in timeouts of the socket events. [Daniel Miller] possibly resulting in timeouts of the socket events. [Daniel Miller]
@@ -78,22 +108,6 @@ o [Nsock] Improved memory performance of poll engine on Windows. [Daniel Miller]
o [Nsock][GH#187][GH#2912] Improvements to Nsock event list management, fixing o [Nsock][GH#187][GH#2912] Improvements to Nsock event list management, fixing
errors like "could not find 1 of the purportedly pending events on that IOD." [Daniel Miller] errors like "could not find 1 of the purportedly pending events on that IOD." [Daniel Miller]
o [GH#2113] Fixed the issue where TCP Connect scans (-sT) on Windows would show
'filtered' instead of 'closed', due to differences in understanding timeouts.
o Nmap will now allow targets to be specified both on the command line and in
an input file with -iL. Previously, if targets were provided in both places,
only the targets in the input file would be scanned, and no notice was given
that the command-line targets were ignored. [Daniel Miller]
o [GH#1451] Nmap now performs forward DNS lookups in parallel, using the same
engine that has been reliably performing reverse-DNS lookups for nearly a
decade. Scanning large lists of hostnames is now enormously faster and avoids
the unresponsive wait for blocking system calls, so progress stats can be
shown. In testing, resolving 1 million website names to both IPv4 and IPv6
took just over an hour. The previous system took 49 hours for the same data
set! [Daniel Miller]
o When Nmap is used with --disable-arp-ping, a local IP that cannot be o When Nmap is used with --disable-arp-ping, a local IP that cannot be
ARP-resolved will use the "no-route" reason instead of the "unknown-response" ARP-resolved will use the "no-route" reason instead of the "unknown-response"
reason, since no response was received. reason, since no response was received.
@@ -118,9 +132,6 @@ o [NSE][GH#2901][GH#2744][GH#2745] Arbitrary separator in stdnse.tohex() is now
o [NSE] ether_type inconsistency in packet.Frame has been resolved. Both o [NSE] ether_type inconsistency in packet.Frame has been resolved. Both
Frame:new() and Frame:build_ether_frame() now use an integer. [nnposter] Frame:new() and Frame:build_ether_frame() now use an integer. [nnposter]
o [GH#2900][GH#2896][GH#2897] Nmap is now able to scan IP protocol 255.
[nnposter]
Nmap 7.95 [2024-04-23] Nmap 7.95 [2024-04-23]
o Integrated over 4,000 of your IPv4 OS fingerprints. Added 336 signatures, o Integrated over 4,000 of your IPv4 OS fingerprints. Added 336 signatures,

View File

@@ -256,7 +256,6 @@ clean-zenmap:
rm -f $(ZENMAPDIR)/zenmapCore/Name.pyc rm -f $(ZENMAPDIR)/zenmapCore/Name.pyc
clean-ndiff: clean-ndiff:
-cd $(NDIFFDIR) && $(PYTHON) setup.py clean --all
clean-nping: clean-nping:
-cd $(NPINGDIR) && $(MAKE) clean -cd $(NPINGDIR) && $(MAKE) clean
@@ -376,13 +375,15 @@ install-zenmap: $(ZENMAPDIR)/pyproject.toml
ln -sf zenmap $(DESTDIR)$(bindir)/xnmap ln -sf zenmap $(DESTDIR)$(bindir)/xnmap
build-ndiff: build-ndiff:
cd $(NDIFFDIR) && $(PYTHON) setup.py build $(if $(DESTDIR),--executable "$(DEFAULT_PYTHON_PATH)") $(PYTHON) -m build $(NDIFFDIR)/
build-nping: $(NPINGDIR)/Makefile build-nbase build-nsock build-netutil $(NPINGDIR)/nping.h @DNET_BUILD@ @PCAP_BUILD@ build-nping: $(NPINGDIR)/Makefile build-nbase build-nsock build-netutil $(NPINGDIR)/nping.h @DNET_BUILD@ @PCAP_BUILD@
@cd $(NPINGDIR) && $(MAKE) @cd $(NPINGDIR) && $(MAKE)
install-ndiff: install-ndiff:
cd $(NDIFFDIR) && $(PYTHON) setup.py install --prefix "$(prefix)" $(if $(DESTDIR),--root "$(DESTDIR)") $(INSTALL) -d $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1
$(PYTHON) -m pip install $(NDIFFDIR)/ $(if $(DESTDIR),--root "$(DESTDIR)")
$(INSTALL) -c -m 644 $(NDIFFDIR)/docs/ndiff.1 $(DESTDIR)$(mandir)/man1/
NSE_FILES = scripts/script.db scripts/*.nse NSE_FILES = scripts/script.db scripts/*.nse
NSE_LIB_LUA_FILES = nselib/*.lua nselib/*.luadoc NSE_LIB_LUA_FILES = nselib/*.lua nselib/*.luadoc
@@ -431,7 +432,8 @@ uninstall-zenmap:
rm -f $(DESTDIR)$(bindir)/xnmap rm -f $(DESTDIR)$(bindir)/xnmap
uninstall-ndiff: uninstall-ndiff:
cd $(NDIFFDIR) && $(PYTHON) setup.py uninstall $(PYTHON) -m pip uninstall $(NDIFFDIR)
rm -f $(DESTDIR)$(mandir)/man1/ndiff.1
uninstall-ncat: uninstall-ncat:
@cd $(NCATDIR) && $(MAKE) uninstall @cd $(NCATDIR) && $(MAKE) uninstall

View File

@@ -1,4 +1,4 @@
Nmap 7.95SVN ( https://nmap.org ) Nmap 7.96 ( https://nmap.org )
Usage: nmap [Scan Type(s)] [Options] {target specification} Usage: nmap [Scan Type(s)] [Options] {target specification}
TARGET SPECIFICATION: TARGET SPECIFICATION:
Can pass hostnames, IP addresses, networks, etc. Can pass hostnames, IP addresses, networks, etc.

View File

@@ -1,6 +1,6 @@
export MSYS2_ARG_CONV_EXCL=* export MSYS2_ARG_CONV_EXCL=*
MAKENSIS=C:/Program Files (x86)/NSIS/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/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=..
NMAPDIR_WIN=$(shell echo '$(NMAPDIR)' | sed 's|/cygdrive/\(.\)|\1:|;s|/|\\|g') NMAPDIR_WIN=$(shell echo '$(NMAPDIR)' | sed 's|/cygdrive/\(.\)|\1:|;s|/|\\|g')
ZENMAP_WINDIR=$(NMAPDIR)/zenmap/install_scripts/windows 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 NSE_FILES = $(NMAPDIR)/scripts/script.db $(NMAPDIR)/scripts/*.nse
NMAP_MSWIN32_AUX = $(NMAPDIR)/../nmap-mswin32-aux 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_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_OEM_ARGS = "/DNMAP_NAME=$(NMAP_OEM_NAME)" "/DNMAP_OEM=1"
NSIS_STD_ARGS = "/DNMAP_NAME=$(NMAP_NAME)" NSIS_STD_ARGS = "/DNMAP_NAME=$(NMAP_NAME)"
@@ -83,7 +83,7 @@ stage-nmap:
stage-nmap-oem: stage-nmap-oem:
$(MAKE) OEM_SUFFIX=-oem stage-nmap-main $(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} mkdir -p nmap-$(NMAP_VERSION)${OEM_SUFFIX}
"$(MAKENSIS)" /DINNER $(NSIS_ARGS) nsis/Nmap.nsi "$(MAKENSIS)" /DINNER $(NSIS_ARGS) nsis/Nmap.nsi
nmap-$(NMAP_VERSION)${OEM_SUFFIX}/tempinstaller.exe || test $$? -eq 2 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 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 # 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 touch sign-files
bundle-nsis: sign-files bundle-nsis: sign-files

View File

@@ -193,19 +193,9 @@ FunctionEnd
;-------------------------------- ;--------------------------------
;Installer Sections ;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 "${STAGE_DIR_OEM}\Uninstall.exe"
ReserveFile "..\npcap-${NPCAP_VERSION}.exe" ReserveFile "..\npcap-${NPCAP_VERSION}.exe"
ReserveFile ..\${VCREDISTEXE} ReserveFile ..\${VCREDISTEXE}
!ifndef NMAP_OEM
!insertmacro SecZenmapFiles ""
!insertmacro SecNdiffFiles ""
!endif
!insertmacro SanityCheckInstdir "" !insertmacro SanityCheckInstdir ""
Section "Nmap Core Files" SecCore Section "Nmap Core Files" SecCore
@@ -223,7 +213,7 @@ Section "Nmap Core Files" SecCore
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
SetOverwrite on SetOverwrite on
Call SecCoreFiles !insertmacro SecCoreFiles
Call vcredistinstaller Call vcredistinstaller
Call create_uninstaller Call create_uninstaller
@@ -265,7 +255,7 @@ SectionEnd
Section "Ncat (Modern Netcat reincarnation)" SecNcat Section "Ncat (Modern Netcat reincarnation)" SecNcat
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
SetOverwrite on SetOverwrite on
Call SecNcatFiles !insertmacro SecNcatFiles
Call vcredistinstaller Call vcredistinstaller
Call create_uninstaller Call create_uninstaller
SectionEnd SectionEnd
@@ -273,7 +263,7 @@ SectionEnd
Section "Nping (Packet generator)" SecNping Section "Nping (Packet generator)" SecNping
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
SetOverwrite on SetOverwrite on
Call SecNpingFiles !insertmacro SecNpingFiles
Call vcredistinstaller Call vcredistinstaller
Call create_uninstaller Call create_uninstaller
SectionEnd SectionEnd
@@ -282,7 +272,7 @@ SectionEnd
Section "Zenmap (GUI Frontend)" SecZenmap Section "Zenmap (GUI Frontend)" SecZenmap
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
SetOverwrite on 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 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"
@@ -297,7 +287,7 @@ SectionEnd
Section "Ndiff (Scan comparison tool)" SecNdiff Section "Ndiff (Scan comparison tool)" SecNdiff
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
SetOverwrite on SetOverwrite on
Call SecNdiffFiles !insertmacro SecNdiffFiles
Call create_uninstaller Call create_uninstaller
SectionEnd SectionEnd
!endif !endif
@@ -360,11 +350,12 @@ Function _GetFileVersionProductName
${If} $2 == 0 ${If} $2 == 0
${AndIf} $0 <> 0 ${AndIf} $0 <> 0
; 0409 = English; 04b0 = Unicode ; 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 ${If} $0 <> 0
Pop $0 ; Take the "" off the stack Pop $0 ; Take the "" off the stack
; Push the Unicode string at r2 of length r3 ; 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}
${EndIf} ${EndIf}
System::Free $1 System::Free $1
@@ -416,9 +407,11 @@ Function RepairBug2982
ReadRegStr $0 HKLM "${REG_UNINSTALL_KEY}\Nmap" "UninstallString" ReadRegStr $0 HKLM "${REG_UNINSTALL_KEY}\Nmap" "UninstallString"
; Nothing? Done. ; Nothing? Done.
StrCmp $0 "" repair_2982_done StrCmp $0 "" repair_2982_done
Push $0 ; UninstallString
; Check product name on the uninstaller ; Check product name on the uninstaller
!insertmacro stripQuotes $0 !insertmacro stripQuotes $0
${GetFileVersionProductName} $0 $3 ${GetFileVersionProductName} $0 $3
Push $3 ; ProductName
; If it's not "Nmap OEM" it's not a buggy install ; If it's not "Nmap OEM" it's not a buggy install
StrCmp $3 "Nmap OEM" 0 repair_2982_done StrCmp $3 "Nmap OEM" 0 repair_2982_done
; Ok, it's a screwed-up install. We need to fix it up first. ; Ok, it's a screwed-up install. We need to fix it up first.
@@ -449,25 +442,27 @@ FunctionEnd
Function _TryUninstall Function _TryUninstall
System::Store S ; stash registers System::Store S ; stash registers
Pop $3 ; ProductName
Pop $2 ; Old version Pop $2 ; Old version
Pop $1 ; Uninstall dir Pop $1 ; Uninstall dir
Pop $0 ; Uninstaller path Pop $0 ; Uninstaller path
${GetFileVersionProductName} $0 $3
${If} ${Silent} ${If} ${Silent}
StrCpy $5 $3 4 StrCpy $5 $3 4
${If} $5 <> "Nmap" ${If} $5 != "Nmap"
; In silent mode, abort the install ; In silent mode, abort the install
; if INSTDIR contains an uninstaller that's not Nmap. ; if INSTDIR contains an uninstaller that's not Nmap.
Abort Abort
${EndIf} ${EndIf}
${Else} ${Else}
${If} $2 == "" ${If} $2 == "UNKNOWN"
${GetFileVersion} $0 $2 ${GetFileVersion} $0 $2
${EndIf} ${EndIf}
MessageBox MB_YESNOCANCEL|MB_ICONQUESTION \ MessageBox MB_YESNOCANCEL|MB_ICONQUESTION \
'$3 $2 is already installed in "$1". $\n$\nWould you like to uninstall it first?' \ '$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} ${EndIf}
tryuninstall_go:
Push $0 ; Uninstaller Push $0 ; Uninstaller
Push "/S" ; Params Push "/S" ; Params
Push $1 ; Old instdir Push $1 ; Old instdir
@@ -478,10 +473,11 @@ Function _TryUninstall
FunctionEnd FunctionEnd
; If _version is "", we use the uninstaller's file version, which is X.X.X.X ; 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. ; so for Nmap itself, use the DisplayVersion if known.
!macro TryUninstall _uninstaller _uninstdir _version !macro TryUninstall _uninstaller _uninstdir _version _productname
Push _uninstaller Push ${_uninstaller}
Push _uninstdir Push ${_uninstdir}
Push _version Push ${_version}
Push ${_productname}
Call _TryUninstall Call _TryUninstall
!macroend !macroend
@@ -532,15 +528,26 @@ Function .onInit
!insertmacro OptionDisableSection $R0 "/NPING=" ${SecNping} !insertmacro OptionDisableSection $R0 "/NPING=" ${SecNping}
Call RepairBug2982 Call RepairBug2982
ClearErrors
; Check for existing install Pop $3 ; ProductName?
; $3 = old product name Pop $0 ; UninstallString?
StrCpy $3 "${NMAP_NAME}" ${If} ${Errors}
${OrIf} $3 != "${NMAP_NAME}"
; RepairBug2982 did not get info, so we get it here instead
; $0 = old uninstall.exe path ; $0 = old uninstall.exe path
ReadRegStr $0 HKLM "${NMAP_UNINSTALL_KEY}" "UninstallString" ReadRegStr $1 HKLM "${NMAP_UNINSTALL_KEY}" "UninstallString"
; If no uninstall key was found, assume it's a new install ; If it's the same as what RepairBug2982 got, then $3 is valid, too.
StrCmp $0 "" 0 set_instdir ${If} $1 != $0
StrCpy $0 $1
; $3 is obviously not valid
StrCpy $3 ""
${EndIf}
${EndIf}
; If no uninstall key was found, assume it's a new install
StrCmp $0 "" set_instdir
!insertmacro stripQuotes $0
; $1 = old instdir ; $1 = old instdir
; We want to use this location going forward: ; We want to use this location going forward:
ReadRegStr $1 HKLM "${NMAP_UNINSTALL_KEY}" "InstallLocation" ReadRegStr $1 HKLM "${NMAP_UNINSTALL_KEY}" "InstallLocation"
@@ -549,20 +556,22 @@ Function .onInit
ReadRegStr $1 HKCU "Software\${NMAP_NAME}" "" ReadRegStr $1 HKCU "Software\${NMAP_NAME}" ""
StrCmp $1 "" 0 get_old_version StrCmp $1 "" 0 get_old_version
; Last chance, parent dir of uninstaller ; Last chance, parent dir of uninstaller
!insertmacro stripQuotes $0
${GetParent} $0 $1 ${GetParent} $0 $1
get_old_version: get_old_version:
; $2 = old version ; $2 = old version
ReadRegStr $2 HKLM "${NMAP_UNINSTALL_KEY}" "DisplayVersion" 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: set_instdir:
; If it's already set, user specified with /D= ; If it's already set, user specified with /D=
StrCmp $INSTDIR "" 0 done StrCmp $INSTDIR "" 0 done
; If we got the old instdir from the registry, use that. ; If we got the old instdir from the registry, use that.
${If} $1 <> "" ${If} $1 != ""
StrCpy $INSTDIR $1 StrCpy $INSTDIR $1
${Else} ${Else}
; Default InstallDir set here ; Default InstallDir set here
@@ -572,9 +581,12 @@ set_instdir:
done: done:
; If we didn't already try to uninstall, check to see if there's something in ; If we didn't already try to uninstall, check to see if there's something in
; $INSTDIR that needs to be uninstalled. ; $INSTDIR that needs to be uninstalled.
${If} $INSTDIR <> $1 ${If} $INSTDIR != $1
${AndIf} ${FileExists} "$INSTDIR\Uninstall.exe" ${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} ${EndIf}
FunctionEnd FunctionEnd
@@ -654,13 +666,6 @@ Function .onInit
FunctionEnd FunctionEnd
!insertmacro SanityCheckInstdir "un." !insertmacro SanityCheckInstdir "un."
!insertmacro SecCoreFiles "un."
!insertmacro SecNcatFiles "un."
!insertmacro SecNpingFiles "un."
!ifndef NMAP_OEM
!insertmacro SecZenmapFiles "un."
!insertmacro SecNdiffFiles "un."
!endif
Section "Uninstall" Section "Uninstall"
@@ -679,12 +684,12 @@ Section "Uninstall"
SetDetailsPrint listonly SetDetailsPrint listonly
nmap_installed: nmap_installed:
Call un.SecCoreFiles !insertmacro SecCoreFiles
Call un.SecNcatFiles !insertmacro SecNcatFiles
Call un.SecNpingFiles !insertmacro SecNpingFiles
!ifndef NMAP_OEM !ifndef NMAP_OEM
Call un.SecZenmapFiles !insertmacro SecZenmapFiles
Call un.SecNdiffFiles !insertmacro SecNdiffFiles
!endif !endif
Delete "$INSTDIR\nmap_performance.reg" Delete "$INSTDIR\nmap_performance.reg"

View File

@@ -48,8 +48,7 @@ FunctionEnd
!define _Dir "!insertmacro DoDir" !define _Dir "!insertmacro DoDir"
!endif ; INNER !endif ; INNER
!macro SecCoreFiles un !macro SecCoreFiles
Function ${un}SecCoreFiles
${_File} ${STAGE_DIR} CHANGELOG ${_File} ${STAGE_DIR} CHANGELOG
${_File} ${STAGE_DIR} LICENSE ${_File} ${STAGE_DIR} LICENSE
${_File} ${STAGE_DIR} nmap-mac-prefixes ${_File} ${STAGE_DIR} nmap-mac-prefixes
@@ -72,37 +71,28 @@ Function ${un}SecCoreFiles
${_Dir} ${STAGE_DIR} scripts ${_Dir} ${STAGE_DIR} scripts
${_Dir} ${STAGE_DIR} nselib ${_Dir} ${STAGE_DIR} nselib
${_File} ${STAGE_DIR} icon1.ico ${_File} ${STAGE_DIR} icon1.ico
FunctionEnd
!macroend !macroend
!macro SecZenmapFiles un !macro SecZenmapFiles
Function ${un}SecZenmapFiles
${_File} ${STAGE_DIR} ZENMAP_README ${_File} ${STAGE_DIR} ZENMAP_README
${_File} ${STAGE_DIR} COPYING_HIGWIDGETS ${_File} ${STAGE_DIR} COPYING_HIGWIDGETS
${_Dir} ${STAGE_DIR} zenmap ${_Dir} ${STAGE_DIR} zenmap
; always remove Zenmap.lnk ; always remove Zenmap.lnk
; It'll be created by the installer after this. ; It'll be created by the installer after this.
Delete "$INSTDIR\Zenmap.lnk" Delete "$INSTDIR\Zenmap.lnk"
FunctionEnd
!macroend !macroend
!macro SecNdiffFiles un !macro SecNdiffFiles
Function ${un}SecNdiffFiles
${_File} ${STAGE_DIR} ndiff.py ${_File} ${STAGE_DIR} ndiff.py
${_File} ${STAGE_DIR} ndiff.bat ${_File} ${STAGE_DIR} ndiff.bat
${_File} ${STAGE_DIR} NDIFF_README ${_File} ${STAGE_DIR} NDIFF_README
FunctionEnd
!macroend !macroend
!macro SecNcatFiles un !macro SecNcatFiles
Function ${un}SecNcatFiles
${_File} ${STAGE_DIR} ncat.exe ${_File} ${STAGE_DIR} ncat.exe
${_File} ${STAGE_DIR} ca-bundle.crt ${_File} ${STAGE_DIR} ca-bundle.crt
FunctionEnd
!macroend !macroend
!macro SecNpingFiles un !macro SecNpingFiles
Function ${un}SecNpingFiles
${_File} ${STAGE_DIR} nping.exe ${_File} ${STAGE_DIR} nping.exe
FunctionEnd
!macroend !macroend

3631
nbase/configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
Ncat 7.95SVN ( https://nmap.org/ncat ) Ncat 7.96 ( https://nmap.org/ncat )
Usage: ncat [options] [hostname] [port] Usage: ncat [options] [hostname] [port]
Options taking a time assume seconds. Append 'ms' for milliseconds, Options taking a time assume seconds. Append 'ms' for milliseconds,
@@ -34,6 +34,7 @@ Options taking a time assume seconds. Append 'ms' for milliseconds,
--send-only Only send data, ignoring received; quit on EOF --send-only Only send data, ignoring received; quit on EOF
--recv-only Only receive data, never send anything --recv-only Only receive data, never send anything
--no-shutdown Continue half-duplex when receiving EOF on stdin --no-shutdown Continue half-duplex when receiving EOF on stdin
-q <time> After EOF on stdin, wait <time> then quit.
--allow Allow only given hosts to connect to Ncat --allow Allow only given hosts to connect to Ncat
--allowfile A file of hosts allowed to connect to Ncat --allowfile A file of hosts allowed to connect to Ncat
--deny Deny given hosts from connecting to Ncat --deny Deny given hosts from connecting to Ncat

View File

@@ -79,7 +79,7 @@
/* Ncat information for output, etc. */ /* Ncat information for output, etc. */
#define NCAT_NAME "Ncat" #define NCAT_NAME "Ncat"
#define NCAT_URL "https://nmap.org/ncat" #define NCAT_URL "https://nmap.org/ncat"
#define NCAT_VERSION "7.95SVN" #define NCAT_VERSION "7.96"
#ifndef __GNUC__ #ifndef __GNUC__
#ifndef __attribute__ #ifndef __attribute__

View File

@@ -1527,6 +1527,9 @@ def excepthook(type, value, tb):
sys.__excepthook__(type, value, tb) sys.__excepthook__(type, value, tb)
sys.exit(EXIT_ERROR) sys.exit(EXIT_ERROR)
if __name__ == "__main__": def run_main():
sys.excepthook = excepthook sys.excepthook = excepthook
sys.exit(main()) sys.exit(main())
if __name__ == "__main__":
run_main()

27
ndiff/pyproject.toml Normal file
View File

@@ -0,0 +1,27 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
name = "ndiff"
license = {text = "Nmap License (https://nmap.org/book/man-legal.html)"}
version = "7.96"
authors = [{name = "The Nmap Project"}]
description = "Nmap scan diff tool"
readme = {file = "README", content-type = "text/plain"}
[project.urls]
Homepage = "https://nmap.org/ndiff/"
Documentation = "https://nmap.org/book/ndiff-man.html"
Repository = "https://github.com/nmap/nmap.git"
Issues = "https://github.com/nmap/nmap/issues"
Changelog = "https://nmap.org/changelog"
[project.scripts]
ndiff = "ndiff:run_main"
[tool.setuptools]
py-modules = ["ndiff"]
#[tool.setuptools.packages.find]
#include = ["ndiff"]

View File

@@ -1,303 +0,0 @@
#!/usr/bin/env python3
import errno
import sys
import os
import os.path
import re
from stat import ST_MODE
import setuptools.command.install
from setuptools import setup, Command
import logging
APP_NAME = "ndiff"
# The name of the file used to record the list of installed files, so that the
# uninstall command can remove them.
INSTALLED_FILES_NAME = "INSTALLED_FILES"
# path_startswith and path_strip_prefix are used to deal with the installation
# root (--root option, also known as DESTDIR).
def path_startswith(path, prefix):
"""Returns True if path starts with prefix. It's a little more intelligent
than str.startswith because it normalizes the paths to remove multiple
directory separators and down-up traversals."""
path = os.path.normpath(path)
prefix = os.path.normpath(prefix)
return path.startswith(prefix)
def path_strip_prefix(path, prefix):
"""Return path stripped of its directory prefix if it starts with prefix,
otherwise return path unmodified. This only works correctly with Unix
paths; for example it will not replace the drive letter on a Windows path.
Examples:
>>> path_strip_prefix('/tmp/destdir/usr/bin', '/tmp/destdir')
'/usr/bin'
>>> path_strip_prefix('/tmp/../tmp/destdir/usr/bin', '/tmp///destdir')
'/usr/bin'
>>> path_strip_prefix('/etc', '/tmp/destdir')
'/etc'
>>> path_strip_prefix('/etc', '/')
'/etc'
>>> path_strip_prefix('/etc', '')
'/etc'
"""
absolute = os.path.isabs(path)
path = os.path.normpath(path)
prefix = os.path.normpath(prefix)
if path.startswith(prefix) and prefix != os.sep:
path = path[len(prefix):]
# Absolute paths must remain absolute and relative paths must remain
# relative.
assert os.path.isabs(path) == absolute
return path
###############################################################################
# setuptools subclasses
class null_command(Command):
"""This is a dummy setuptools command that does nothing. We use it to
replace the install_egg_info and avoid installing a .egg-info file, because
there's no option to disable that."""
def initialize_options(self):
pass
def finalize_options(self):
pass
def get_outputs(self):
return ()
def run(self):
pass
class checked_install(setuptools.command.install.install):
def finalize_options(self):
# Ubuntu's python2.6-2.6.4-0ubuntu3 package changes sys.prefix in
# install.finalize_options when sys.prefix is "/usr/local" (our
# default). Because we need the unchanged value later, remember it
# here.
self.saved_prefix = sys.prefix
super().finalize_options()
def set_modules_path(self):
app_file_name = os.path.join(self.install_scripts, APP_NAME)
# Find where the modules are installed. setuptools will put them in
# self.install_lib, but that path can contain the root (DESTDIR), so we
# must strip it off if necessary.
modules_dir = self.install_lib
if self.root is not None:
modules_dir = path_strip_prefix(modules_dir, self.root)
app_file = open(app_file_name, "r")
lines = app_file.readlines()
app_file.close()
for i in range(len(lines)):
if re.match(r'^INSTALL_LIB =', lines[i]):
lines[i] = "INSTALL_LIB = %s\n" % repr(modules_dir)
break
else:
raise ValueError(
"INSTALL_LIB replacement not found in %s" % app_file_name)
app_file = open(app_file_name, "w")
app_file.writelines(lines)
app_file.close()
def run(self):
super().run()
# These below are from Zenmap. We're only using set_modules_path right now, but
# we might consider whether the others would be useful (or, if not, whether we
# should remove them from Zenmap).
# self.set_perms()
self.set_modules_path()
# self.fix_paths()
self.create_uninstaller()
self.write_installed_files()
def get_installed_files(self):
"""Return a list of installed files and directories, each prefixed with
the installation root if given. The list of installed directories
doesn't come from setuptools so it may be incomplete."""
installed_files = self.get_outputs()
for package in self.distribution.py_modules:
dir = package.replace(".", "/")
installed_files.append(os.path.join(self.install_lib, dir))
installed_files.append(
os.path.join(self.install_scripts, "uninstall_" + APP_NAME))
return installed_files
def create_uninstaller(self):
uninstaller_filename = os.path.join(
self.install_scripts, "uninstall_" + APP_NAME)
uninstaller = """\
#!/usr/bin/env python
import errno, os, os.path, sys
print('Uninstall %(name)s')
answer = raw_input('Are you sure that you want to uninstall '
'%(name)s (yes/no) ')
if answer != 'yes' and answer != 'y':
print('Not uninstalling.')
sys.exit(0)
""" % {'name': APP_NAME}
installed_files = []
for output in self.get_installed_files():
if self.root is not None:
# If we have a root (DESTDIR), we need to strip it off the
# front of paths so the uninstaller runs on the target host.
# The path manipulations are tricky, but made easier because
# the uninstaller only has to run on Unix.
if not path_startswith(output, self.root):
# This should never happen (everything gets installed
# inside the root), but if it does, be safe and don't
# delete anything.
uninstaller += ("print('%s was not installed inside "
"the root %s; skipping.')\n" % (output, self.root))
continue
output = path_strip_prefix(output, self.root)
assert os.path.isabs(output)
installed_files.append(output)
uninstaller += """\
INSTALLED_FILES = (
"""
for file in installed_files:
uninstaller += " %s,\n" % repr(file)
uninstaller += """\
)
# Split the list into lists of files and directories.
files = []
dirs = []
for path in INSTALLED_FILES:
if os.path.isfile(path) or os.path.islink(path):
files.append(path)
elif os.path.isdir(path):
dirs.append(path)
# Delete the files.
for file in files:
print("Removing '%s'." % file)
try:
os.remove(file)
except OSError, e:
print(' Error: %s.' % str(e), file=sys.stderr)
# Delete the directories. First reverse-sort the normalized paths by
# length so that child directories are deleted before their parents.
dirs = [os.path.normpath(dir) for dir in dirs]
dirs.sort(key = len, reverse = True)
for dir in dirs:
try:
print("Removing the directory '%s'." % dir)
os.rmdir(dir)
except OSError, e:
if e.errno == errno.ENOTEMPTY:
print("Directory '%s' not empty; not removing." % dir)
else:
print(str(e), file=sys.stderr)
"""
uninstaller_file = open(uninstaller_filename, 'w')
uninstaller_file.write(uninstaller)
uninstaller_file.close()
# Set exec bit for uninstaller
mode = ((os.stat(uninstaller_filename)[ST_MODE]) | 0o555) & 0o7777
os.chmod(uninstaller_filename, mode)
def write_installed_files(self):
"""Write a list of installed files for use by the uninstall command.
This is similar to what happens with the --record option except that it
doesn't strip off the installation root, if any. File names containing
newline characters are not handled."""
if INSTALLED_FILES_NAME == self.record:
logging.warning("warning: installation record is overwriting "
"--record file '%s'." % self.record)
with open(INSTALLED_FILES_NAME, "w") as f:
for output in self.get_installed_files():
assert "\n" not in output
print(output, file=f)
class my_uninstall(Command):
"""A setuptools command that performs uninstallation. It reads the list of
installed files written by the install command."""
command_name = "uninstall"
description = "uninstall installed files recorded in '%s'" % (
INSTALLED_FILES_NAME)
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
# Read the list of installed files.
try:
f = open(INSTALLED_FILES_NAME, "r")
except IOError as e:
if e.errno == errno.ENOENT:
logging.error("Couldn't open the installation record '%s'. "
"Have you installed yet?", INSTALLED_FILES_NAME)
return
installed_files = [file.rstrip("\n") for file in f.readlines()]
f.close()
# Delete the installation record too.
installed_files.append(INSTALLED_FILES_NAME)
# Split the list into lists of files and directories.
files = []
dirs = []
for path in installed_files:
if os.path.isfile(path) or os.path.islink(path):
files.append(path)
elif os.path.isdir(path):
dirs.append(path)
# Delete the files.
for file in files:
logging.info("Removing '%s'.", file)
try:
if not self.dry_run:
os.remove(file)
except OSError as e:
logging.error(str(e))
# Delete the directories. First reverse-sort the normalized paths by
# length so that child directories are deleted before their parents.
dirs = [os.path.normpath(dir) for dir in dirs]
dirs.sort(key=len, reverse=True)
for dir in dirs:
try:
logging.info("Removing the directory '%s'.", dir)
if not self.dry_run:
os.rmdir(dir)
except OSError as e:
if e.errno == errno.ENOTEMPTY:
logging.info("Directory '%s' not empty; not removing.",
dir)
else:
logging.error(str(e))
setup(name="ndiff", scripts=["scripts/ndiff"],
py_modules=["ndiff"],
data_files=[("share/man/man1", ["docs/ndiff.1"])],
cmdclass={
"install_egg_info": null_command,
"install": checked_install,
"uninstall": my_uninstall
})

View File

@@ -3,7 +3,7 @@
# Well known service port numbers -*- mode: fundamental; -*- # Well known service port numbers -*- mode: fundamental; -*-
# From the Nmap Security Scanner ( https://nmap.org/ ) # From the Nmap Security Scanner ( https://nmap.org/ )
# #
# $Id: nmap-services 9746 2008-08-26 18:45:24Z fyodor $ # $Id$
# #
# Derived from IANA data and our own research # Derived from IANA data and our own research
# #

6
nmap.h
View File

@@ -123,10 +123,10 @@
/* Edit this definition only within the quotes, because it is read from this /* Edit this definition only within the quotes, because it is read from this
file by the makefiles. */ file by the makefiles. */
#define NMAP_MAJOR 7 #define NMAP_MAJOR 7
#define NMAP_MINOR 95 #define NMAP_MINOR 96
#define NMAP_BUILD 1 #define NMAP_BUILD 0
/* SVN, BETA, etc. */ /* SVN, BETA, etc. */
#define NMAP_SPECIAL "SVN" #define NMAP_SPECIAL ""
#define NMAP_VERSION STR(NMAP_MAJOR) "." STR(NMAP_MINOR) NMAP_SPECIAL #define NMAP_VERSION STR(NMAP_MAJOR) "." STR(NMAP_MINOR) NMAP_SPECIAL
#define NMAP_NUM_VERSION STR(NMAP_MAJOR) "." STR(NMAP_MINOR) "." STR(NMAP_BUILD) ".0" #define NMAP_NUM_VERSION STR(NMAP_MAJOR) "." STR(NMAP_MINOR) "." STR(NMAP_BUILD) ".0"

View File

@@ -10,7 +10,7 @@
%define name nmap %define name nmap
%define version @VERSION@ %define version @VERSION@
%define release 2 %define release 1
%define _prefix /usr %define _prefix /usr
%define makeargs OPENSSL_LIBS="%{openssl}/lib64/libssl.a %{openssl}/lib64/libcrypto.a" LIBSSL="%{openssl}/lib64/libssl.a %{openssl}/lib64/libcrypto.a" ZLIB_LIBS="$(pwd)/libz/libz.a" LIBZ="$(pwd)/lib64/libz.a" %define makeargs OPENSSL_LIBS="%{openssl}/lib64/libssl.a %{openssl}/lib64/libcrypto.a" LIBSSL="%{openssl}/lib64/libssl.a %{openssl}/lib64/libcrypto.a" ZLIB_LIBS="$(pwd)/libz/libz.a" LIBZ="$(pwd)/lib64/libz.a"
@@ -18,7 +18,7 @@ Summary: Network exploration tool and security scanner
Name: %{name} Name: %{name}
Version: %{version} Version: %{version}
Release: %{release} Release: %{release}
Epoch: 2 Epoch: 1
License: https://nmap.org/man/man-legal.html License: https://nmap.org/man/man-legal.html
Group: Applications/System Group: Applications/System
Source0: https://nmap.org/dist/%{name}-%{version}.tgz Source0: https://nmap.org/dist/%{name}-%{version}.tgz
@@ -28,12 +28,7 @@ URL: https://nmap.org
# packages for more than one version of Python. Without this, RPM will # packages for more than one version of Python. Without this, RPM will
# grep through the installed files and automatically add things like # grep through the installed files and automatically add things like
# Requires: python(abi) = 2.4 # Requires: python(abi) = 2.4
# setup.py takes care of adjusting sys.path to point to wherever the
# modules were installed so it's not dependent on any particular ABI.
AutoReqProv: no AutoReqProv: no
# For Ndiff.
BuildRequires: python3-devel
Requires: python3 >= 3.0
%global debug_package %{nil} %global debug_package %{nil}
# RPM can't be relocatable until I stop storing path info in the binary. # RPM can't be relocatable until I stop storing path info in the binary.
@@ -60,7 +55,7 @@ both console and graphical versions are available.
%build %build
%configure --with-openssl=%{openssl} --without-zenmap --with-ndiff --with-libdnet=included --with-libpcap=included --with-libpcre=included --with-liblua=included --with-libz=included %configure --with-openssl=%{openssl} --without-zenmap --without-ndiff --with-libdnet=included --with-libpcap=included --with-libpcre=included --with-liblua=included --with-libz=included
%if "%{buildncat}" == "0" %if "%{buildncat}" == "0"
%configure --without-ncat %configure --without-ncat
%endif %endif
@@ -76,8 +71,6 @@ make %{makeargs}
%install %install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT %{makeargs} make install DESTDIR=$RPM_BUILD_ROOT %{makeargs}
# Don't package the Ndiff uninstaller with the RPM.
rm -f $RPM_BUILD_ROOT%{_bindir}/uninstall_ndiff
strip $RPM_BUILD_ROOT%{_bindir}/* || : strip $RPM_BUILD_ROOT%{_bindir}/* || :
gzip $RPM_BUILD_ROOT%{_mandir}/man1/* || : gzip $RPM_BUILD_ROOT%{_mandir}/man1/* || :
@@ -94,11 +87,6 @@ gzip $RPM_BUILD_ROOT%{_mandir}/man1/* || :
%{_bindir}/nmap %{_bindir}/nmap
%{_datadir}/nmap %{_datadir}/nmap
%{_bindir}/ndiff
# Ndiff is now a module and has e.g. /usr/lib/python3.10/site-packages/ndiff.py, /usr/lib/python3.10/site-packages/ndiff.pyc
%pycached %{python3_sitelib}/ndiff.py
%doc %{_prefix}/share/man/man1/ndiff.1.gz
# Ncat subpackage # Ncat subpackage
%if "%{buildncat}" != "0" %if "%{buildncat}" != "0"
%package -n ncat %package -n ncat

View File

@@ -265,7 +265,7 @@
/* General tunable defines **************************************************/ /* General tunable defines **************************************************/
#define NPING_NAME "Nping" #define NPING_NAME "Nping"
#define NPING_URL "https://nmap.org/nping" #define NPING_URL "https://nmap.org/nping"
#define NPING_VERSION "7.95SVN" #define NPING_VERSION "0.7.96"
#define DEFAULT_VERBOSITY VB_0 #define DEFAULT_VERBOSITY VB_0

View File

@@ -11,7 +11,7 @@ Summary: Multi-platform graphical Nmap frontend and results viewer
Name: %{name} Name: %{name}
Version: %{version} Version: %{version}
Release: %{release} Release: %{release}
Epoch: 2 Epoch: 1
License: https://nmap.org/man/man-legal.html License: https://nmap.org/man/man-legal.html
Group: Applications/System Group: Applications/System
Source0: https://nmap.org/dist/nmap-%{version}.tgz Source0: https://nmap.org/dist/nmap-%{version}.tgz
@@ -56,14 +56,19 @@ from Umit, an Nmap GUI created as part of the Google Summer of Code.
--infodir=%{_prefix}/share/info \ --infodir=%{_prefix}/share/info \
--sysconfdir=%{_sysconfdir} \ --sysconfdir=%{_sysconfdir} \
--without-openssl \ --without-openssl \
--without-ncat \
--without-nping \
--with-ndiff \
--with-zenmap # PYTHON="%{__python}" --with-zenmap # PYTHON="%{__python}"
make build-zenmap DESTDIR=$RPM_BUILD_ROOT make build-zenmap DESTDIR=$RPM_BUILD_ROOT
%install %install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
make install-zenmap DESTDIR=$RPM_BUILD_ROOT make install-zenmap DESTDIR=$RPM_BUILD_ROOT
make install-ndiff DESTDIR=$RPM_BUILD_ROOT
# Don't package the uninstaller with the RPM. # Don't package the uninstaller with the RPM.
rm -f $RPM_BUILD_ROOT%{_bindir}/uninstall_zenmap rm -f $RPM_BUILD_ROOT%{_bindir}/uninstall_zenmap
rm -f $RPM_BUILD_ROOT%{_bindir}/uninstall_ndiff
gzip $RPM_BUILD_ROOT%{_mandir}/man1/* || : gzip $RPM_BUILD_ROOT%{_mandir}/man1/* || :
%clean %clean
@@ -72,14 +77,18 @@ gzip $RPM_BUILD_ROOT%{_mandir}/man1/* || :
%files %files
%defattr(-,root,root) %defattr(-,root,root)
%doc %{_mandir}/man1/zenmap.1.gz %doc %{_mandir}/man1/zenmap.1.gz
%doc %{_mandir}/man1/ndiff.1.gz
%{_bindir}/zenmap %{_bindir}/zenmap
%{_bindir}/nmapfe %{_bindir}/nmapfe
%{_bindir}/xnmap %{_bindir}/xnmap
%{_bindir}/ndiff
# This gets the modules and the .egg-info file if it was installed. # This gets the modules and the .egg-info file if it was installed.
%{python3_sitelib}/zenmapGUI/ %{python3_sitelib}/zenmapGUI/
%{python3_sitelib}/zenmapCore/ %{python3_sitelib}/zenmapCore/
%{python3_sitelib}/radialnet/ %{python3_sitelib}/radialnet/
%{python3_sitelib}/zenmap-*.dist-info/ %{python3_sitelib}/zenmap-*.dist-info/
%pycached %{python3_sitelib}/ndiff.py
%{python3_sitelib}/ndiff-*.dist-info/
%{_datadir}/applications/*.desktop %{_datadir}/applications/*.desktop
%changelog %changelog

View File

@@ -5,19 +5,19 @@ test "x$UNDER_JHBUILD" = "x" && exit 1
# make-bundle.sh # make-bundle.sh
APP_NAME=Zenmap APP_NAME=Zenmap
ZENMAP_DIST_DIR=$PWD/dist ZENMAP_DIST_DIR=${1:-zenmap-root}
ZENMAP_BUILD_DIR=$PWD/build
export ZENMAP_DIST_DIR export ZENMAP_DIST_DIR
export ZENMAP_BUILD_DIR
BASE=$ZENMAP_DIST_DIR/$APP_NAME.app/Contents BASE=$ZENMAP_DIST_DIR/$APP_NAME.app/Contents
SCRIPT_DIR=`dirname "$0"` SCRIPT_DIR=`dirname "$0"`
ZENMAP_DIR="$SCRIPT_DIR/../.."
NDIFF_DIR="$ZENMAP_DIR/../ndiff"
echo "Running $0." echo "Running $0."
echo "Removing old build." echo "Removing old build."
rm -rf "$ZENMAP_DIST_DIR" "$ZENMAP_BUILD_DIR" rm -rf "$ZENMAP_DIST_DIR"
echo "Building python-launcher" echo "Building python-launcher"
$CC $CPPFLAGS $CFLAGS $LDFLAGS -L$PREFIX/lib `python3-config --cflags --ldflags --embed` \ $CC $CPPFLAGS $CFLAGS $LDFLAGS -L$PREFIX/lib `python3-config --cflags --ldflags --embed` \
@@ -25,7 +25,8 @@ $CC $CPPFLAGS $CFLAGS $LDFLAGS -L$PREFIX/lib `python3-config --cflags --ldflags
~/gtk-mac-bundler/examples/python-launcher.c ~/gtk-mac-bundler/examples/python-launcher.c
echo "Installing Zenmap to local system" echo "Installing Zenmap to local system"
python3 -m pip install --no-deps --force-reinstall . python3 -m pip install --no-deps --force-reinstall "$ZENMAP_DIR"
python3 -m pip install --no-deps --force-reinstall "$NDIFF_DIR"
echo "Generating dependencies" echo "Generating dependencies"
# Have to run this with ~/gtk/inst/python3 or deps have wrong paths # Have to run this with ~/gtk/inst/python3 or deps have wrong paths
@@ -62,13 +63,15 @@ popd
# echo "Compiling Python to bytecode" # echo "Compiling Python to bytecode"
PYTHONLIB=$(ls -d $BASE/Resources/lib/python3.*) PYTHONLIB=$(ls -d $BASE/Resources/lib/python3.*)
cp "$PREFIX"/${PYTHONLIB#$BASE/Resources/}/site-packages/ndiff.py "$PYTHONLIB/site-packages/"
# Remove compiled bytecode, recompile in legacy locations, allowing for removal of source. # Remove compiled bytecode, recompile in legacy locations, allowing for removal of source.
# See PEP-3147 # See PEP-3147
find "$PYTHONLIB" -depth \( -name 'zenmap*' -o -name 'radialnet' \) -prune -o -name __pycache__ -exec rm -rf '{}' \; find "$PYTHONLIB" -depth \( -name 'zenmap*' -o -name 'radialnet' \) -prune -o -name __pycache__ -exec rm -rf '{}' \;
python -m compileall -b -x 'zenmapGUI|zenmapCore|radialnet' "$PYTHONLIB" python -m compileall -b -x 'ndiff|zenmapGUI|zenmapCore|radialnet' "$PYTHONLIB"
# Remove source if compiled is available, except for Zenmap itself: # Remove source if compiled is available, except for Zenmap itself:
find "$PYTHONLIB" \( -name 'zenmap*' -o -name 'radialnet' \) -prune -o \( -name '*.pyc' -print \) | while read pyc; do find "$PYTHONLIB" \( -name 'ndiff.py' -o -name 'zenmap*' -o -name 'radialnet' \) -prune -o \( -name '*.pyc' -print \) | while read pyc; do
rm -f "${pyc%.pyc}.py" rm -f "${pyc%.pyc}.py"
done done
@@ -100,3 +103,14 @@ with open(sys.argv[1],"r",encoding="utf-8") as f:
APP_COPYRIGHT=APP_COPYRIGHT APP_COPYRIGHT=APP_COPYRIGHT
)) ))
EOF EOF
mkdir -p "$BASE/Resources/bin"
zenmap_cmd="$BASE/Resources/bin/zenmap"
cat >"$zenmap_cmd" <<'EOF'
#!/bin/sh
open -a Zenmap "$@"
EOF
chmod 755 "$zenmap_cmd"
cp "$PREFIX/bin/ndiff" "$BASE/Resources/bin/ndiff"

View File

@@ -396,14 +396,20 @@ class CommandProfile (Profile, object):
class NmapOutputHighlight(object): class NmapOutputHighlight(object):
setts = ["bold", "italic", "underline", "text", "highlight", "regex"] setts = ["bold", "italic", "underline", "text", "highlight", "regex"]
def __init__(self):
self.dark_mode = False
def save_changes(self): def save_changes(self):
config_parser.save_changes() config_parser.save_changes()
def set_dark_mode(self, mode=True):
self.dark_mode = mode
def __get_it(self, p_name): def __get_it(self, p_name):
property_name = "%s_highlight" % p_name property_name = "%s_highlight" % p_name
try: try:
return self.sanity_settings([ settings = self.sanity_settings([
config_parser.get( config_parser.get(
property_name, prop, raw=True) for prop in self.setts]) property_name, prop, raw=True) for prop in self.setts])
except Exception: except Exception:
@@ -418,6 +424,11 @@ class NmapOutputHighlight(object):
self.__set_it(p_name, settings) self.__set_it(p_name, settings)
if self.dark_mode:
for i in (0, 1, 2):
settings[3][i] = (65535 - settings[3][i]) % 65536
settings[4][i] = (65535 - settings[4][i]) % 65536
return settings return settings
def __set_it(self, property_name, settings): def __set_it(self, property_name, settings):

View File

@@ -1 +1 @@
VERSION = "7.95+SVN" VERSION = "7.96"

View File

@@ -111,7 +111,7 @@ class CrashReport(HIGDialog):
) % {"app_name": escape(APP_DISPLAY_NAME)}) ) % {"app_name": escape(APP_DISPLAY_NAME)})
self.email_frame = Gtk.Frame() self.email_frame = Gtk.Frame()
self.email_label = Gtk.Label() self.email_label = Gtk.Label()
self.email_label.set_markup(_('<b>Copy and <b>' self.email_label.set_markup(_('<b>Copy and '
'<a href="https://issues.nmap.org/new/choose">' '<a href="https://issues.nmap.org/new/choose">'
'open a bug report</a></b>:')) 'open a bug report</a></b>:'))
self.btn_copy = Gtk.Button.new_from_stock(Gtk.STOCK_COPY) self.btn_copy = Gtk.Button.new_from_stock(Gtk.STOCK_COPY)

View File

@@ -148,6 +148,10 @@ class ScanWindow(UmitScanWindow):
self.set_default_size(window.width, window.height) self.set_default_size(window.width, window.height)
self.scan_interface = ScanInterface() self.scan_interface = ScanInterface()
# Update highlighting
output_viewer = self.scan_interface.scan_result.scan_result_notebook.nmap_output.nmap_output
output_viewer.nmap_highlight.set_dark_mode(
ScanWindow.dark_mode)
self.main_accel_group = Gtk.AccelGroup() self.main_accel_group = Gtk.AccelGroup()
@@ -790,6 +794,11 @@ This scan has not been run yet. Start the scan with the "Scan" button first.'))
settings = Gtk.Settings.get_default() settings = Gtk.Settings.get_default()
settings.set_property("gtk-application-prefer-dark-theme", settings.set_property("gtk-application-prefer-dark-theme",
ScanWindow.dark_mode) ScanWindow.dark_mode)
# Update highlighting
output_viewer = self.scan_interface.scan_result.scan_result_notebook.nmap_output.nmap_output
output_viewer.nmap_highlight.set_dark_mode(
ScanWindow.dark_mode)
output_viewer.apply_highlighting()
def _exit_cb(self, *args): def _exit_cb(self, *args):

View File

@@ -70,6 +70,11 @@ from zenmapCore.UmitConf import NmapOutputHighlight
from zenmapGUI.NmapOutputProperties import NmapOutputProperties from zenmapGUI.NmapOutputProperties import NmapOutputProperties
def _tag_set_colors(tag, text_color, highlight_color):
fg = "rgb({},{},{})".format(*(x >> 8 for x in text_color))
bg = "rgb({},{},{})".format(*(x >> 8 for x in highlight_color))
tag.set_property("foreground", fg)
tag.set_property("background", bg)
class NmapOutputViewer(Gtk.Box): class NmapOutputViewer(Gtk.Box):
HIGHLIGHT_PROPERTIES = ["details", "date", "hostname", "ip", "port_list", HIGHLIGHT_PROPERTIES = ["details", "date", "hostname", "ip", "port_list",
@@ -139,13 +144,7 @@ class NmapOutputViewer(Gtk.Box):
else: else:
tag.set_property("underline", Pango.Underline.NONE) tag.set_property("underline", Pango.Underline.NONE)
text_color = settings[3] _tag_set_colors(tag, settings[3], settings[4])
highlight_color = settings[4]
tag.set_property(
"foreground", Gdk.Color(*text_color).to_string())
tag.set_property(
"background", Gdk.Color(*highlight_color).to_string())
def go_to_host(self, host): def go_to_host(self, host):
"""Go to host line on nmap output result""" """Go to host line on nmap output result"""
@@ -218,15 +217,18 @@ class NmapOutputViewer(Gtk.Box):
return return
text = buf.get_text(start_iter, end_iter, include_hidden_chars=True) text = buf.get_text(start_iter, end_iter, include_hidden_chars=True)
tag_table = buf.get_tag_table()
for property in self.HIGHLIGHT_PROPERTIES: for property in self.HIGHLIGHT_PROPERTIES:
settings = self.nmap_highlight.__getattribute__(property) settings = self.nmap_highlight.__getattribute__(property)
tag = tag_table.lookup(property)
_tag_set_colors(tag, settings[3], settings[4])
for m in re.finditer(settings[5], text, re.M): for m in re.finditer(settings[5], text, re.M):
m_start_iter = start_iter.copy() m_start_iter = start_iter.copy()
m_start_iter.forward_chars(m.start()) m_start_iter.forward_chars(m.start())
m_end_iter = start_iter.copy() m_end_iter = start_iter.copy()
m_end_iter.forward_chars(m.end()) m_end_iter.forward_chars(m.end())
buf.apply_tag_by_name(property, m_start_iter, m_end_iter) buf.apply_tag(tag, m_start_iter, m_end_iter)
def show_nmap_output(self, output): def show_nmap_output(self, output):
"""Show the string (or unicode) output in the output display.""" """Show the string (or unicode) output in the output display."""