1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-15 10:59:01 +00:00

Compatibility fixes and Github autobuilds. Closes #3214

This commit is contained in:
dmiller
2026-01-12 16:59:25 +00:00
parent ce0c08997e
commit 1b3ca45054
20 changed files with 490 additions and 73 deletions

206
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,206 @@
name: nmap multiplatform autobuilds
on:
push:
paths:
- ".github/workflows/build.yml"
- "**/*.c"
- "**/*.cc"
- "**/*.cpp"
- "**/*.h"
- "**/*.H"
- "**/*.in"
- "**/*.am"
- "**/*.ac"
- "**/*.lua"
- "**/*.cmakein"
- "**/configure"
- "**/*.pl"
- "**/*.py"
- "**/*.awk"
- "**/*.sh"
- "**/*.toml"
branches:
- master
pull_request:
workflow_dispatch:
inputs:
deploymentName:
description: "Name for this deployment"
required: true
default: "Manual Deployment"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
MAKEFLAGS: -j3
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- name: ubuntu-latest-gcc
os: ubuntu-latest
cc: gcc
- name: ubuntu-latest-gcc-arm64
os: ubuntu-latest
cc: gcc
arch: arm64
- name: ubuntu-latest-clang
os: ubuntu-latest
cc: clang
- name: macos-15-clang
os: macos-15
cc: clang
- name: macos-26-clang
os: macos-26
cc: clang
- name: freebsd-15-gcc
os: ubuntu-latest
cc: gcc
- name: freebsd-15-clang
os: ubuntu-latest
cc: clang
- name: openbsd-7-gcc
os: ubuntu-latest
cc: egcc
- name: openbsd-7-clang
os: ubuntu-latest
cc: clang
- name: netbsd-10-gcc
os: ubuntu-latest
cc: gcc
- name: netbsd-10-clang
os: ubuntu-latest
cc: clang
- name: solaris-11-gcc
os: ubuntu-latest
cc: gcc
- name: solaris-11-clang
os: ubuntu-latest
cc: clang
- name: windows-latest-msvc
os: windows-latest
cc: msvc
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up QEMU for ARM64
if: matrix.arch == 'arm64'
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm64
- name: Build Linux
if: startsWith(matrix.name,'ubuntu') && matrix.arch != 'arm64'
run: |
sudo apt-get update
sudo apt-get install -y build-essential clang tree libpcap-dev libnet-dev libpcre2-dev
./configure
make
make install DESTDIR=/tmp
tree /tmp/usr
- name: Build Linux ARM64
if: startsWith(matrix.name,'ubuntu') && matrix.arch == 'arm64'
run: |
docker run --rm --platform linux/arm64 -v $PWD:/work -w /work ubuntu:latest bash -c "
apt-get update -q -y &&
apt-get install -q -y build-essential tree libpcap-dev libnet-dev libpcre2-dev autoconf automake &&
./configure
make &&
make install DESTDIR=/tmp &&
tree /tmp/usr
"
- name: Build MacOS
if: startsWith(matrix.name,'macos')
run: |
brew update
# PCRE2 is already installed
brew install tree libpcap libnet
./configure
make
make install DESTDIR=/tmp
tree /tmp/usr
- name: Build FreeBSD
if: startsWith(matrix.name,'freebsd')
uses: vmactions/freebsd-vm@v1
with:
release: "15.0"
usesh: true
prepare: |
# OS has libpcap already installed (and adding puts a second in /usr/local)
pkg install -y gcc llvm autotools tree pkgconf libnet pcre2 gmake dbus
run: |
./configure
gmake
gmake install DESTDIR=/tmp
tree /tmp/usr
- name: Build OpenBSD
if: startsWith(matrix.name,'openbsd')
uses: vmactions/openbsd-vm@v1
with:
usesh: true
prepare: |
export PKG_PATH=https://cdn.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/
pkg_add -I autoconf%2.72 automake%1.17 gcc%11 llvm%19 tree pkgconf libnet%1.1 pcre2 gmake dbus
run: |
export AUTOCONF_VERSION=2.72
export AUTOMAKE_VERSION=1.17
./configure
gmake
gmake install DESTDIR=/tmp
tree /tmp/usr
- name: Build NetBSD
if: startsWith(matrix.name,'netbsd')
uses: vmactions/netbsd-vm@v1
with:
usesh: true
prepare: |
export PATH=/usr/sbin:/usr/pkg/sbin:/usr/pkg/bin:$PATH
export PKG_PATH="http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r | cut -d_ -f1)/All"
pkg_add gcc13 clang autoconf automake pkgconf libpcap libnet gmake dbus
run: |
./configure
gmake
gmake install DESTDIR=/tmp
tree /tmp/usr
- name: Build Solaris
if: startsWith(matrix.name,'solaris')
uses: vmactions/solaris-vm@v1
with:
usesh: true
prepare: |
pkg install gcc-c clang autoconf automake pcre2 libpcap libnet developer/build/gnu-make
run: |
./configure
gmake
gmake install DESTDIR=/tmp
tree /tmp/usr
- name: Install Subversion
if: startsWith(matrix.name,'windows')
shell: powershell
run: |
choco install svn -y --no-progress
$env:PATH = "C:\Program Files (x86)\Subversion\bin;C:\Program Files\Subversion\bin;$env:PATH"
echo "C:\Program Files (x86)\Subversion\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\Program Files\Subversion\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Build Windows
if: startsWith(matrix.name,'windows')
shell: cmd
run: |
cd mswin32
Build.bat

View File

@@ -1,5 +1,8 @@
#Nmap Changelog ($Id$); -*-text-*-
o [GH#3214] Improve compatibility of build process on various platforms and add
multiplatform autobuilds in Github workflow. [Jordan Ritter]
o [GH#2183][GH#3239] Script hostmap-crtsh now reports only true subdomains
of a given target hostname by default. In the past, it was reporting any
DNS name that included the target hostname as a substring (but not

View File

@@ -312,7 +312,7 @@ distclean-%: clean-%
-cd $* && $(MAKE) distclean
install-nmap: $(TARGET)
$(INSTALL) -d $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(nmapdatadir)
mkdir -p $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(nmapdatadir)
$(INSTALL) -c -m 755 nmap $(DESTDIR)$(bindir)/nmap
# Use strip -x to avoid stripping dynamically loaded NSE functions. See
# http://seclists.org/nmap-dev/2007/q4/0272.html.
@@ -320,7 +320,7 @@ install-nmap: $(TARGET)
$(INSTALL) -c -m 644 docs/$(TARGET).1 $(DESTDIR)$(mandir)/man1/
if [ "$(USE_NLS)" = "yes" ]; then \
for ll in $(filter $(ALL_LINGUAS),$(LINGUAS)); do \
$(INSTALL) -d $(DESTDIR)$(mandir)/$$ll/man1; \
mkdir -p $(DESTDIR)$(mandir)/$$ll/man1; \
$(INSTALL) -c -m 644 docs/man-xlate/$(TARGET)-$$ll.1 $(DESTDIR)$(mandir)/$$ll/man1/$(TARGET).1; \
done; \
fi
@@ -354,7 +354,7 @@ build-zenmap: $(ZENMAPDIR)/pyproject.toml $(ZENMAPDIR)/zenmapCore/Version.py
$(PYTHON) -m build $(ZENMAPDIR)/
install-zenmap: $(ZENMAPDIR)/pyproject.toml
$(INSTALL) -d $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(deskdir)
mkdir -p $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(deskdir)
$(PYTHON) -m pip install $(ZENMAPDIR)/ $(if $(DESTDIR),--root "$(DESTDIR)")
$(INSTALL) -c -m 644 docs/zenmap.1 $(DESTDIR)$(mandir)/man1/
$(INSTALL) -c -m 644 $(ZENMAPDIR)/install_scripts/unix/*.desktop $(DESTDIR)$(deskdir)
@@ -373,7 +373,7 @@ build-nping: $(NPINGDIR)/Makefile build-nbase build-nsock build-netutil $(NPINGD
@cd $(NPINGDIR) && $(MAKE)
install-ndiff:
$(INSTALL) -d $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1
mkdir -p $(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/
@@ -381,8 +381,8 @@ NSE_FILES = scripts/script.db scripts/*.nse
NSE_LIB_LUA_FILES = nselib/*.lua nselib/*.luadoc
install-nse: $(TARGET)
$(INSTALL) -d $(DESTDIR)$(nmapdatadir)/scripts
$(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib
mkdir -p $(DESTDIR)$(nmapdatadir)/scripts
mkdir -p $(DESTDIR)$(nmapdatadir)/nselib
# Remove obsolete scripts from a previous installation.
(cd $(DESTDIR)$(nmapdatadir)/scripts && rm -f $(OLD_SCRIPT_NAMES))
@@ -390,9 +390,9 @@ install-nse: $(TARGET)
$(INSTALL) -c -m 644 nse_main.lua $(DESTDIR)$(nmapdatadir)/
$(INSTALL) -c -m 644 $(NSE_FILES) $(DESTDIR)$(nmapdatadir)/scripts
$(INSTALL) -c -m 644 $(NSE_LIB_LUA_FILES) $(DESTDIR)$(nmapdatadir)/nselib
$(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib/data
mkdir -p $(DESTDIR)$(nmapdatadir)/nselib/data
for f in `find nselib/data -name .svn -prune -o -type d -print`; do \
$(INSTALL) -d $(DESTDIR)$(nmapdatadir)/$$f; \
mkdir -p $(DESTDIR)$(nmapdatadir)/$$f; \
done
for f in `find nselib/data -name .svn -prune -o -type f -print`; do \
$(INSTALL) -c -m 644 $$f $(DESTDIR)$(nmapdatadir)/$$f; \

View File

@@ -64,6 +64,7 @@
#include <stddef.h>
#undef NDEBUG
#include <assert.h>
#include <climits>
#include "nbase.h"

61
configure vendored
View File

@@ -7258,6 +7258,7 @@ fi
fi
if test $have_libpcap != yes; then
ac_configure_args="$ac_configure_args '--disable-dbus'"
subdirs="$subdirs libpcap"
if test "${LIBPCAP_INC+set}" = "set"; then
@@ -7275,6 +7276,48 @@ printf "%s\n" "#define PCAP_INCLUDED 1" >>confdefs.h
printf "%s\n" "#define HAVE_PCAP_SET_IMMEDIATE_MODE 1" >>confdefs.h
# Check if D-Bus is available (in case --disable-dbus didn't work)
# and add it to LIBS if needed for static linking
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dbus_connection_read_write in -ldbus-1" >&5
printf %s "checking for dbus_connection_read_write in -ldbus-1... " >&6; }
if test ${ac_cv_lib_dbus_1_dbus_connection_read_write+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldbus-1 $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
char dbus_connection_read_write ();
int
main (void)
{
return dbus_connection_read_write ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_lib_dbus_1_dbus_connection_read_write=yes
else $as_nop
ac_cv_lib_dbus_1_dbus_connection_read_write=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dbus_1_dbus_connection_read_write" >&5
printf "%s\n" "$ac_cv_lib_dbus_1_dbus_connection_read_write" >&6; }
if test "x$ac_cv_lib_dbus_1_dbus_connection_read_write" = xyes
then :
LIBS="$LIBS -ldbus-1"
fi
else
# We assume our included libpcap doesn't need this check-and-define
# link with -lpcap for the purposes of this test
@@ -7997,8 +8040,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
# We need Lua 5.4 exactly
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for lua version == 504" >&5
printf %s "checking for lua version == 504... " >&6; }
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -8165,6 +8206,10 @@ else $as_nop
have_lua=no
fi
rm -f conftest.err conftest.i conftest.$ac_ext
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for lua version == 504" >&5
printf %s "checking for lua version == 504... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_lua" >&5
printf "%s\n" "$have_lua" >&6; }
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -8178,9 +8223,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
fi
# if we didn't find we use our own
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether lua was found" >&5
printf %s "checking whether lua was found... " >&6; }
if test $have_lua != yes; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, will use our own" >&5
printf "%s\n" "no, will use our own" >&6; }
CPPFLAGS="-I\$(top_srcdir)/$LIBLUADIR $CPPFLAGS"
LIBLUA_LIBS="\$(top_srcdir)/$LIBLUADIR/liblua.a"
LUA_BUILD="build-lua"
@@ -8298,9 +8345,11 @@ done
fi
# if we didn't find we use our own
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether liblinear was found" >&5
printf %s "checking whether liblinear was found... " >&6; }
if test $have_liblinear != yes; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, will use our own" >&5
printf "%s\n" "no, will use our own" >&6; }
CPPFLAGS="-I\$(top_srcdir)/$LIBLINEARDIR $CPPFLAGS"
LIBLINEAR_LIBS="\$(top_srcdir)/$LIBLINEARDIR/liblinear.a"
LIBLINEAR_BUILD="build-liblinear"

View File

@@ -495,6 +495,9 @@ if test $have_libpcap != yes; then
PCAP_DIST_CLEAN="distclean-pcap"
AC_DEFINE(PCAP_INCLUDED, 1, [Using included libpcap])
AC_DEFINE(HAVE_PCAP_SET_IMMEDIATE_MODE, 1, [Included libpcap has pcap_set_immediate_mode])
# Check if D-Bus is available (in case --disable-dbus didn't work)
# and add it to LIBS if needed for static linking
AC_CHECK_LIB([dbus-1], [dbus_connection_read_write], [LIBS="$LIBS -ldbus-1"])
else
# We assume our included libpcap doesn't need this check-and-define
# link with -lpcap for the purposes of this test

View File

@@ -35,6 +35,11 @@
#include "dnet.h"
/* NetBSD 10+ removed RTF_LLINFO */
#ifndef RTF_LLINFO
#define RTF_LLINFO 0
#endif
struct arp_handle {
int fd;
int seq;
@@ -138,13 +143,13 @@ arp_add(arp_t *arp, const struct arp_entry *entry)
errno = EADDRNOTAVAIL;
return (-1);
}
if (sin->sin_addr.s_addr == entry->arp_pa.addr_ip) {
if ((msg.rtm.rtm_flags & RTF_LLINFO) == 0 ||
(msg.rtm.rtm_flags & RTF_GATEWAY) != 0) {
errno = EADDRINUSE;
return (-1);
}
}
if (sin->sin_addr.s_addr == entry->arp_pa.addr_ip) {
if ((RTF_LLINFO && ((msg.rtm.rtm_flags & RTF_LLINFO) == 0)) ||
(msg.rtm.rtm_flags & RTF_GATEWAY) != 0) {
errno = EADDRINUSE;
return (-1);
}
}
if (sa->sa_family != AF_LINK) {
errno = EADDRNOTAVAIL;
return (-1);

View File

@@ -904,7 +904,7 @@ intf_get_src(intf_t *intf, struct intf_entry *entry, struct addr *src)
int
intf_get_dst(intf_t *intf, struct intf_entry *entry, struct addr *dst)
{
union sockunion sun;
union sockunion su;
socklen_t n;
int fd;
@@ -913,19 +913,19 @@ intf_get_dst(intf_t *intf, struct intf_entry *entry, struct addr *dst)
errno = EINVAL;
return (-1);
}
addr_ntos(dst, (struct sockaddr *)&sun);
sun.sin.sin_port = htons(666);
addr_ntos(dst, (struct sockaddr *)&su);
su.sin.sin_port = htons(666);
fd = dst->addr_type == ADDR_TYPE_IP6 ? intf->fd6 : intf->fd;
if (connect(fd, (struct sockaddr *)&sun, sizeof(sun)) < 0)
if (connect(fd, (struct sockaddr *)&su, sizeof(su)) < 0)
return (-1);
n = sizeof(sun);
if (getsockname(fd, (struct sockaddr *)&sun, &n) < 0)
n = sizeof(su);
if (getsockname(fd, (struct sockaddr *)&su, &n) < 0)
return (-1);
addr_ston((struct sockaddr *)&sun, &entry->intf_addr);
addr_ston((struct sockaddr *)&su, &entry->intf_addr);
if (intf_loop(intf, _match_intf_src, entry) != 1)
return (-1);

View File

@@ -35,9 +35,9 @@ linear.o: linear.cpp linear.h
$(CXX) $(CFLAGS) -c -o linear.o linear.cpp
blas/blas.a: blas/*.c blas/*.h
make -C blas OPTFLAGS='$(CFLAGS)' CC='$(CC)';
$(MAKE) -C blas OPTFLAGS='$(CFLAGS)' CC='$(CC)';
clean:
make -C blas clean
make -C matlab clean
$(MAKE) -C blas clean
$(MAKE) -C matlab clean
rm -f *~ newton.o linear.o train predict liblinear.so.$(SHVER)

View File

@@ -160,8 +160,8 @@ GENHDR = \
TAGFILES = \
$(SRC) $(HDR)
CLEANFILES = $(OBJ) libpcap.a libpcap.so.`cat $(srcdir)/VERSION` \
$(PROG)-`cat $(srcdir)/VERSION`.tar.gz \
CLEANFILES = $(OBJ) libpcap.a libpcap.so.`cat $(srcdir)/VERSION.txt` \
$(PROG)-`cat $(srcdir)/VERSION.txt`.tar.gz \
lex.yy.c pcap-config libpcap.pc libpcap.$(DYEXT)
MAN1 = pcap-config.1
@@ -443,8 +443,8 @@ shared: libpcap.$(DYEXT)
libpcap.so: $(OBJ)
@rm -f $@
VER=`cat $(srcdir)/VERSION`; \
MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
VER=`cat $(srcdir)/VERSION.txt`; \
MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION.txt`; \
@V_SHLIB_CMD@ $(LDFLAGS) @V_SHLIB_OPT@ @V_SONAME_OPT@$@.$$MAJOR_VER \
-o $@.$$VER $(OBJ) $(ADDLOBJS) $(LIBS)
@@ -466,10 +466,10 @@ libpcap.so: $(OBJ)
#
libpcap.dylib: $(OBJ)
rm -f libpcap*.dylib
VER=`cat $(srcdir)/VERSION`; \
VER=`cat $(srcdir)/VERSION.txt`; \
MAJOR_VER=A; \
COMPAT_VER=1; \
CURRENT_VER=`sed 's/[^0-9.].*$$//' $(srcdir)/VERSION`; \
CURRENT_VER=`sed 's/[^0-9.].*$$//' $(srcdir)/VERSION.txt`; \
$(CC) -dynamiclib -undefined error $(LDFLAGS) @V_LIB_LDFLAGS_FAT@ \
-o libpcap.$$VER.dylib $(OBJ) $(ADDLOBJS) $(LIBS) \
-install_name $(libdir)/libpcap.$$MAJOR_VER.dylib \
@@ -489,9 +489,9 @@ libpcap.dylib: $(OBJ)
# linker, even with GCC.
#
libpcap.sl: $(OBJ)
@MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
@MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION.txt`; \
rm -f libpcap.$$MAJOR_VER
MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION.txt`; \
ld -b $(LDFLAGS) -o libpcap.$$MAJOR_VER +h libpcap.$$MAJOR_VER \
$(OBJ) $(ADDLOBJS) $(LIBS)
@@ -682,15 +682,15 @@ install-shared: install-shared-$(DYEXT)
install-shared-so: libpcap.so
[ -d $(DESTDIR)$(libdir) ] || \
(mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
VER=`cat $(srcdir)/VERSION`; \
MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
VER=`cat $(srcdir)/VERSION.txt`; \
MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION.txt`; \
$(INSTALL_PROGRAM) libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$VER; \
ln -sf libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \
ln -sf libpcap.so.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.so
install-shared-dylib: libpcap.dylib
[ -d $(DESTDIR)$(libdir) ] || \
(mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
VER=`cat $(srcdir)/VERSION`; \
VER=`cat $(srcdir)/VERSION.txt`; \
MAJOR_VER=A; \
$(INSTALL_PROGRAM) libpcap.$$VER.dylib $(DESTDIR)$(libdir)/libpcap.$$VER.dylib; \
ln -sf libpcap.$$VER.dylib $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER.dylib; \
@@ -698,7 +698,7 @@ install-shared-dylib: libpcap.dylib
install-shared-sl: libpcap.sl
[ -d $(DESTDIR)$(libdir) ] || \
(mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION.txt`; \
$(INSTALL_PROGRAM) libpcap.$$MAJOR_VER $(DESTDIR)$(libdir)
ln -sf libpcap.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.sl
#
@@ -765,19 +765,19 @@ uninstall: uninstall-shared uninstall-rpcapd
uninstall-shared: uninstall-shared-$(DYEXT)
uninstall-shared-so:
VER=`cat $(srcdir)/VERSION`; \
MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
VER=`cat $(srcdir)/VERSION.txt`; \
MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION.txt`; \
rm -f $(DESTDIR)$(libdir)/libpcap.so.$$VER; \
rm -f $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \
rm -f $(DESTDIR)$(libdir)/libpcap.so
uninstall-shared-dylib:
VER=`cat $(srcdir)/VERSION`; \
VER=`cat $(srcdir)/VERSION.txt`; \
MAJOR_VER=A; \
rm -f $(DESTDIR)$(libdir)/libpcap.$$VER.dylib; \
rm -f $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER.dylib; \
rm -f $(DESTDIR)$(libdir)/libpcap.dylib
uninstall-shared-sl:
MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION.txt`; \
rm -f $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER; \
rm -f $(DESTDIR)$(libdir)/libpcap.sl
uninstall-shared-shareda:
@@ -824,7 +824,7 @@ tags: $(TAGFILES)
# git archive doesn't write one.)
#
releasetar:
@TAG=$(PROG)-`cat VERSION` && \
@TAG=$(PROG)-`cat VERSION.txt` && \
if [ ! -d .git ]; then echo 'Not in a git clone, stop.'; exit 1; fi && \
TMPTESTFILE=`mktemp -t tmptestfile_XXXXXXXX` && \
rm -f "$$TMPTESTFILE" && \
@@ -850,7 +850,7 @@ releasetar:
rm -rf "$$AUTORECONF_DIR"
releasecheck: releasetar
@TAG=$(PROG)-`cat VERSION` && \
@TAG=$(PROG)-`cat VERSION.txt` && \
INSTALL_DIR=/tmp/install_"$$TAG"_$$$$ && \
DIR=`pwd` && \
cd /tmp && \

View File

@@ -2927,6 +2927,7 @@ if test "x$enable_dbus" != "xno"; then
V_INCLS="$V_INCLS $DBUS_CFLAGS"
ADDITIONAL_LIBS="$ADDITIONAL_LIBS $DBUS_LIBS"
ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $DBUS_LIBS_STATIC"
LIBS_PRIVATE="$LIBS_PRIVATE $DBUS_LIBS"
REQUIRES_PRIVATE="$REQUIRES_PRIVATE dbus-1"
],
[

View File

@@ -2,18 +2,75 @@
set TARGET=%1
set VCCONFIG=%2
for /f "usebackq delims=#" %%a in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere" -version 16 -property installationPath`) do call "%%a\VC\Auxiliary\Build\vcvarsall.bat" x86 && goto :next
:: Set defaults if not provided
if "%TARGET%" == "" set TARGET=Build
if "%VCCONFIG%" == "" set VCCONFIG=Release
:: Find and initialize Visual Studio environment first
:: Try VS 2019 first, then fall back to latest
"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version "[16.0,17.0)" -property installationPath > "%TEMP%\vspath.txt" 2>nul
for /f "usebackq delims=" %%i in ("%TEMP%\vspath.txt") do (
call "%%i\VC\Auxiliary\Build\vcvarsall.bat" x86
set VS_GENERATOR=Visual Studio 16 2019
goto :generator_set
)
:: VS 2019 not found, use latest
"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version "[16.0,)" -latest -property installationPath > "%TEMP%\vspath.txt" 2>nul
"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version "[16.0,)" -latest -property installationVersion > "%TEMP%\vsver.txt" 2>nul
for /f "usebackq delims=" %%i in ("%TEMP%\vspath.txt") do call "%%i\VC\Auxiliary\Build\vcvarsall.bat" x86
:: Determine generator from version
set VS_GENERATOR=Visual Studio 17 2022
for /f "usebackq delims=" %%v in ("%TEMP%\vsver.txt") do (
set VSVER=%%v
if "%%v:~0,2%%" == "16" set VS_GENERATOR=Visual Studio 16 2019
if "%%v:~0,2%%" == "17" set VS_GENERATOR=Visual Studio 17 2022
if "%%v:~0,2%%" == "18" set VS_GENERATOR=Visual Studio 18 2025
)
:generator_set
del "%TEMP%\vspath.txt" 2>nul
del "%TEMP%\vsver.txt" 2>nul
:: Check and install dependencies
set NMAP_AUX_DIR=%~dp0..\..\nmap-mswin32-aux
if not exist "%NMAP_AUX_DIR%" (
echo.
echo ========================================
echo Installing required dependencies...
echo ========================================
call :install_dependencies
if errorlevel 1 goto :QUIT
)
:: Verify dependencies are present
if not exist "%NMAP_AUX_DIR%\Npcap\Include\pcap.h" (
echo ERROR: Npcap SDK not found after installation
exit /b 1
)
if not exist "%NMAP_AUX_DIR%\OpenSSL\include\openssl\ssl.h" (
echo ERROR: OpenSSL not found after installation
exit /b 1
)
echo Dependencies verified successfully.
echo.
:next
echo Detected Visual Studio Generator: %VS_GENERATOR%
@echo on
if "%TARGET%" == "Vars" ( goto :vars )
if "%TARGET%" == "Clean" (
rd /S /Q build-pcre2
) else (
echo Using CMake Generator: %VS_GENERATOR%
mkdir build-pcre2
cd build-pcre2
cmake.exe -A Win32 -G "Visual Studio 16 2019" ..\..\libpcre\ || goto :QUIT
cmake.exe -A Win32 -G "%VS_GENERATOR%" ..\..\libpcre\ || goto :QUIT
cd ..
)
msbuild -nologo nmap.sln -m -t:%TARGET% -p:Configuration="%VCCONFIG%" -p:Platform="Win32" -fl
@@ -22,5 +79,69 @@ goto :QUIT
:vars
cl.exe /nologo /EP make-vars.h > make-vars.make
:install_dependencies
echo.
echo Creating auxiliary directory: %NMAP_AUX_DIR%
mkdir "%NMAP_AUX_DIR%" 2>nul
:: Install Npcap SDK
echo Downloading Npcap SDK...
set NPCAP_URL=https://npcap.com/dist/npcap-sdk-1.13.zip
set NPCAP_ZIP=%TEMP%\npcap-sdk.zip
powershell -Command "Invoke-WebRequest -Uri '%NPCAP_URL%' -OutFile '%NPCAP_ZIP%'"
if errorlevel 1 (
echo ERROR: Failed to download Npcap SDK
exit /b 1
)
echo Extracting Npcap SDK...
powershell -Command "Expand-Archive -Path '%NPCAP_ZIP%' -DestinationPath '%NMAP_AUX_DIR%\Npcap' -Force"
if errorlevel 1 (
echo ERROR: Failed to extract Npcap SDK
exit /b 1
)
del "%NPCAP_ZIP%" 2>nul
:: Install OpenSSL - Use nmap's SVN repository
echo Downloading OpenSSL from nmap SVN repository...
set OPENSSL_SVN_URL=https://svn.nmap.org/nmap-mswin32-aux/OpenSSL
:: Check if svn is available
where svn >nul 2>&1
if %ERRORLEVEL% EQU 0 (
echo Using SVN to download OpenSSL...
svn export "%OPENSSL_SVN_URL%" "%NMAP_AUX_DIR%\OpenSSL" --force
if errorlevel 1 (
echo WARNING: SVN export failed, trying alternative method...
goto :openssl_fallback
)
goto :openssl_done
)
:openssl_fallback
echo SVN not available, downloading OpenSSL headers manually...
mkdir "%NMAP_AUX_DIR%\OpenSSL\include\openssl" 2>nul
mkdir "%NMAP_AUX_DIR%\OpenSSL\lib" 2>nul
:: Download from nmap SVN via HTTP
set SVN_BASE=https://svn.nmap.org/nmap-mswin32-aux/OpenSSL
echo Downloading OpenSSL files from nmap repository...
:: Use PowerShell to recursively download the directory structure
powershell -Command "$ErrorActionPreference='SilentlyContinue'; $wc=New-Object System.Net.WebClient; $wc.DownloadFile('%SVN_BASE%/include/openssl/ssl.h','%NMAP_AUX_DIR%\OpenSSL\include\openssl\ssl.h'); $wc.DownloadFile('%SVN_BASE%/include/openssl/crypto.h','%NMAP_AUX_DIR%\OpenSSL\include\openssl\crypto.h'); $wc.DownloadFile('%SVN_BASE%/include/openssl/opensslconf.h','%NMAP_AUX_DIR%\OpenSSL\include\openssl\opensslconf.h')"
if not exist "%NMAP_AUX_DIR%\OpenSSL\include\openssl\ssl.h" (
echo ERROR: Failed to download OpenSSL files
echo Please install SVN or manually download OpenSSL to %NMAP_AUX_DIR%\OpenSSL
exit /b 1
)
:openssl_done
echo.
echo Dependencies installed successfully!
echo.
exit /b 0
:QUIT
exit /b %errorlevel%

12
ncat/configure vendored
View File

@@ -5815,8 +5815,6 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for lua version >= 504" >&5
printf %s "checking for lua version >= 504... " >&6; }
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -5982,6 +5980,10 @@ else $as_nop
have_lua=no
fi
rm -f conftest.err conftest.i conftest.$ac_ext
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for lua version >= 504" >&5
printf %s "checking for lua version >= 504... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_lua" >&5
printf "%s\n" "$have_lua" >&6; }
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -5996,9 +5998,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
fi
# if we didn't find we use our own
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether lua was found" >&5
printf %s "checking whether lua was found... " >&6; }
if test $have_lua != yes; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, will use our own" >&5
printf "%s\n" "no, will use our own" >&6; }
CPPFLAGS="-I\$(top_srcdir)/$LIBLUADIR $CPPFLAGS"
LIBLUA_LIBS="\$(top_srcdir)/$LIBLUADIR/liblua.a"
LUA_DEPENDS="\$(top_srcdir)/$LIBLUADIR/liblua.a"

View File

@@ -69,7 +69,8 @@
#include <openssl/evp.h>
#include <openssl/err.h>
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined LIBRESSL_VERSION_NUMBER
#if ((OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined LIBRESSL_VERSION_NUMBER) || \
(defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x20000000L)
#define HAVE_OPAQUE_EVP_PKEY 1
#else
#define EVP_MD_CTX_new EVP_MD_CTX_create

View File

@@ -26,8 +26,8 @@ export NDIR=$(shell pwd)
CC = @CC@
CXX = @CXX@
CCOPT =
DBGFLAGS =
CCOPT =
DBGFLAGS =
STRIP = @STRIP@
LIBPCAPDIR = @libpcapdir@
export LIBDNETDIR = @LIBDNETDIR@
@@ -58,7 +58,7 @@ export RPMTDIR=$(HOME)/rpm
# DESTDIR is used by some package maintainers to install Nping under
# its usual directory structure into a different tree. See the
# its usual directory structure into a different tree. See the
# CHANGELOG for more info.
DESTDIR =
@@ -107,7 +107,7 @@ generate-tarball:
cd nping-priv && ./create_tarballs.sh
# Update the web site. WARNING: "make generate-tarball" must have been called first.
web:
web:
cd nping-priv && ./update_web.sh
clean:
@@ -124,7 +124,7 @@ distclean: clean
stamp-h.in config.cache config.log config.status
install-nping: $(TARGET)
$(INSTALL) -d $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1
mkdir -p $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1
$(INSTALL) -c -m 755 nping $(DESTDIR)$(bindir)/nping
# Use strip -x to avoid stripping dynamically loaded NSE functions. See
# http://seclists.org/nmap-dev/2007/q4/0272.html.
@@ -136,13 +136,13 @@ install-nping: $(TARGET)
install: install-nping
@echo "NPING SUCCESSFULLY INSTALLED"
uninstall: uninstall-nping
uninstall: uninstall-nping
uninstall-nping:
rm -f $(DESTDIR)$(bindir)/$(TARGET)
rm -f $(DESTDIR)$(mandir)/man1/$(TARGET).1
${srcdir}/configure: configure.ac
${srcdir}/configure: configure.ac
cd ${srcdir} && autoconf
## autoheader might not change config.h.in, so touch a stamp file.

View File

@@ -71,6 +71,7 @@
#include "ArgParser.h"
#include "output.h"
#include "common.h"
#include <climits>
/******************************************************************************

View File

@@ -13,7 +13,8 @@
#include <openssl/hmac.h>
#include <openssl/rand.h>
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined LIBRESSL_VERSION_NUMBER
#if ((OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined LIBRESSL_VERSION_NUMBER) || \
(defined LIBRESSL_VERSION_NUMBER && LIBRESSL_VERSION_NUMBER >= 0x3050000fL)
#define HAVE_OPAQUE_STRUCTS 1
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
# include <openssl/provider.h>

View File

@@ -79,7 +79,8 @@
#include <openssl/evp.h>
#include <openssl/err.h>
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined LIBRESSL_VERSION_NUMBER
#if ((OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined LIBRESSL_VERSION_NUMBER) || \
(defined LIBRESSL_VERSION_NUMBER && LIBRESSL_VERSION_NUMBER >= 0x3050000fL)
/* Technically some of these things were added in 0x10100006
* but that was pre-release. */
#define HAVE_OPAQUE_STRUCTS 1
@@ -491,6 +492,22 @@ int lua_push_ecdhparams(lua_State *L, EVP_PKEY *pubkey) {
/* According to RFC 5480 section 2.1.1, explicit curves must not be used with
X.509. This may change in the future, but for now it doesn't seem worth it
to add in code to extract the extra parameters. */
#if defined(LIBRESSL_VERSION_NUMBER)
/* LibreSSL doesn't have EC_GROUP_get_field_type, and explicit curves are rare.
* Just mark as UNKNOWN. */
lua_pushstring(L, "UNKNOWN");
#elif HAVE_OPAQUE_STRUCTS
nid = EC_GROUP_get_field_type(group);
if (nid == NID_X9_62_prime_field) {
lua_pushstring(L, "explicit_prime");
}
else if (nid == NID_X9_62_characteristic_two_field) {
lua_pushstring(L, "explicit_char2");
}
else {
lua_pushstring(L, "UNKNOWN");
}
#else
nid = EC_METHOD_get_field_type(EC_GROUP_method_of(group));
if (nid == NID_X9_62_prime_field) {
lua_pushstring(L, "explicit_prime");
@@ -499,9 +516,9 @@ int lua_push_ecdhparams(lua_State *L, EVP_PKEY *pubkey) {
lua_pushstring(L, "explicit_char2");
}
else {
/* Something weird happened. */
lua_pushstring(L, "UNKNOWN");
}
#endif
lua_setfield(L, -2, "ec_curve_type");
}
lua_setfield(L, -2, "curve_params");

View File

@@ -414,7 +414,13 @@ int do_actual_pcap_read(struct nevent *nse) {
switch (rc) {
case 1: /* read good packet */
#ifdef PCAP_RECV_TIMEVAL_VALID
#ifdef __OpenBSD__
/* OpenBSD has bpf_timeval which is incompatible with struct timeval */
npp.ts.tv_sec = pkt_header->ts.tv_sec;
npp.ts.tv_usec = pkt_header->ts.tv_usec;
#else
npp.ts = pkt_header->ts;
#endif
#else
/* On these platforms time received from pcap is invalid.
* It's better to set current time */
@@ -517,4 +523,3 @@ int nsock_iod_is_pcap(nsock_iod iod) {
}
#endif /* HAVE_PCAP */

5
shtool
View File

@@ -615,7 +615,7 @@ mkdir )
if [ ".$opt_t" = .yes ]; then
echo "mkdir $p" 1>&2
fi
mkdir $p || errstatus=$?
mkdir -p $p || errstatus=$?
if [ ".$opt_o" != . ]; then
if [ ".$opt_t" = .yes ]; then
echo "chown $opt_o $p" 1>&2
@@ -652,7 +652,7 @@ mkdir )
if [ ".$opt_t" = .yes ]; then
echo "mkdir $pathcomp" 1>&2
fi
mkdir $pathcomp || errstatus=$?
mkdir -p $pathcomp || errstatus=$?
if [ ".$opt_o" != . ]; then
if [ ".$opt_t" = .yes ]; then
echo "chown $opt_o $pathcomp" 1>&2
@@ -683,4 +683,3 @@ mkdir )
esac
shtool_exit 0