Skip to content

Commit

Permalink
user/nmap: new package (7.95)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gnarwhal authored and nekopsykose committed Jul 9, 2024
1 parent 51b2f6c commit 53027b9
Show file tree
Hide file tree
Showing 4 changed files with 244 additions and 0 deletions.
137 changes: 137 additions & 0 deletions user/nmap/patches/0001-Also-find-pcre2-pcre2.h.-Fixes-2851.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
From c6ffdbf7ae35e397b663f787fc4934f01458f945 Mon Sep 17 00:00:00 2001
From: dmiller <dmiller@e0a8ed71-7df4-0310-8962-fdc924857419>
Date: Tue, 4 Jun 2024 20:24:55 +0000
Subject: [PATCH] Also find pcre2/pcre2.h. Fixes #2851

---
configure | 62 ++++++++++++++++++++++++++++++++++++++----------
configure.ac | 10 ++++----
nmap_config.h.in | 2 ++
service_scan.h | 6 ++++-
4 files changed, 61 insertions(+), 19 deletions(-)

diff --git a/configure b/configure
index d6c007b49..375ea61ca 100755
--- a/configure
+++ b/configure
@@ -7300,12 +7300,52 @@ fi

# If they didn't specify it, we try to find it
if test $have_pcre != yes -a $requested_included_pcre != yes ; then
- ac_fn_c_check_header_compile "$LINENO" "pcre2.h" "ac_cv_header_pcre2_h" "
-#define PCRE2_CODE_UNIT_WIDTH 8
+ ac_fn_c_check_header_compile "$LINENO" "pcre2.h" "ac_cv_header_pcre2_h" "$ac_includes_default"
+if test "x$ac_cv_header_pcre2_h" = xyes
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pcre2_compile_8 in -lpcre2-8" >&5
+printf %s "checking for pcre2_compile_8 in -lpcre2-8... " >&6; }
+if test ${ac_cv_lib_pcre2_8_pcre2_compile_8+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpcre2-8 $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 pcre2_compile_8 ();
+int
+main (void)
+{
+return pcre2_compile_8 ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"
+then :
+ ac_cv_lib_pcre2_8_pcre2_compile_8=yes
+else $as_nop
+ ac_cv_lib_pcre2_8_pcre2_compile_8=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_pcre2_8_pcre2_compile_8" >&5
+printf "%s\n" "$ac_cv_lib_pcre2_8_pcre2_compile_8" >&6; }
+if test "x$ac_cv_lib_pcre2_8_pcre2_compile_8" = xyes
+then :
+ have_pcre=yes
+fi

-"
-if test "x$ac_cv_header_pcre2_h" = xyes
+else $as_nop
+ ac_fn_c_check_header_compile "$LINENO" "pcre2/pcre2.h" "ac_cv_header_pcre2_pcre2_h" "$ac_includes_default"
+if test "x$ac_cv_header_pcre2_pcre2_h" = xyes
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pcre2_compile_8 in -lpcre2-8" >&5
printf %s "checking for pcre2_compile_8 in -lpcre2-8... " >&6; }
@@ -7345,8 +7385,14 @@ printf "%s\n" "$ac_cv_lib_pcre2_8_pcre2_compile_8" >&6; }
if test "x$ac_cv_lib_pcre2_8_pcre2_compile_8" = xyes
then :
have_pcre=yes
+ printf "%s\n" "#define HAVE_PCRE2_PCRE2_H 1" >>confdefs.h
+
fi

+
+fi
+
+
fi

fi
@@ -7364,14 +7410,6 @@ if test $have_pcre != yes ; then
printf "%s\n" "#define PCRE_INCLUDED 1" >>confdefs.h

else
-# We only need to check for and use this if we are NOT using included pcre
- ac_fn_c_check_header_compile "$LINENO" "pcre2.h" "ac_cv_header_pcre2_h" "$ac_includes_default"
-if test "x$ac_cv_header_pcre2_h" = xyes
-then :
- printf "%s\n" "#define HAVE_PCRE2_H 1" >>confdefs.h
-
-fi
-
LIBPCRE_LIBS="-lpcre2-8"
PCRE_BUILD=""
PCRE_CLEAN=""

diff --git a/nmap_config.h.in b/nmap_config.h.in
index 2b2e0e108..995ddcc2f 100644
--- a/nmap_config.h.in
+++ b/nmap_config.h.in
@@ -104,6 +104,8 @@

#undef HAVE_TERMIOS_H

+#undef HAVE_PCRE2_PCRE2_H
+
#undef BSD_NETWORKING

#undef IN_ADDR_DEEPSTRUCT
diff --git a/service_scan.h b/service_scan.h
index 49b8eba04..7aca4ae1b 100644
--- a/service_scan.h
+++ b/service_scan.h
@@ -71,7 +71,11 @@
#include <vector>

#define PCRE2_CODE_UNIT_WIDTH 8
-#include <pcre2.h>
+#ifdef HAVE_PCRE2_PCRE2_H
+# include <pcre2/pcre2.h>
+#else
+# include <pcre2.h>
+#endif

#undef NDEBUG
#include <assert.h>
--
2.45.2

30 changes: 30 additions & 0 deletions user/nmap/patches/disable_ncat_dns_resolution_check.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --color -ruN nmap-7.95/ncat/test/test-addrset.sh nmap-7.95-patched/ncat/test/test-addrset.sh
--- nmap-7.95/ncat/test/test-addrset.sh 2021-03-01 18:42:00.000000000 +0000
+++ nmap-7.95-patched/ncat/test/test-addrset.sh 2024-07-09 18:57:27.412463072 +0000
@@ -246,26 +246,6 @@
ff::00
EOF

-# Name lookup.
-test_addrset "scanme.nmap.org" "scanme.nmap.org" <<EOF
-1:2::3:4
-1.2.3.4
-scanme.nmap.org
-EOF
-
-# Name lookup combined with CIDR netmask.
-test_addrset "scanme.nmap.org/30" "scanme.nmap.org" <<EOF
-1:2::3:4
-1.2.3.4
-scanme.nmap.org
-EOF
-
-# Name lookup combined with /0 CIDR netmask.
-test_addrset "scanme.nmap.org/0" "1.2.3.4 scanme.nmap.org" <<EOF
-1.2.3.4
-scanme.nmap.org
-EOF
-
expect_fail "."
expect_fail "-"
expect_fail ","
35 changes: 35 additions & 0 deletions user/nmap/patches/remove_unneccessary_ac_config_subdirs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
diff --color -ruN nmap-7.95/configure.ac nmap-7.95-patched/configure.ac
--- nmap-7.95/configure.ac 2024-04-12 17:20:04.000000000 +0000
+++ nmap-7.95-patched/configure.ac 2024-07-09 06:08:34.372883728 +0000
@@ -471,7 +471,6 @@
fi

if test $have_libpcap != yes; then
- AC_CONFIG_SUBDIRS(libpcap)
if test "${LIBPCAP_INC+set}" = "set"; then
CPPFLAGS="$CPPFLAGS -I$LIBPCAP_INC"
else
@@ -539,7 +538,6 @@

# If we still don't have it, we use our own
if test $have_pcre != yes ; then
- AC_CONFIG_SUBDIRS( libpcre )
CPPFLAGS="-I\$(top_srcdir)/$LIBPCREDIR/src $CPPFLAGS"
LIBPCRE_LIBS="$LIBPCREDIR/.libs/libpcre2-8.a"
PCRE_BUILD="build-pcre"
@@ -616,7 +614,6 @@
fi

if test $have_libz != yes; then
- AC_CONFIG_SUBDIRS(libz)
# TODO: This doesn't work because libssh2's configure script is looking for
# already-built libs. Giving up for now: build libz first or install
# headers/libs on your own if you want compression support for SSH.
@@ -702,7 +699,6 @@
# If we still don't have it, we use our own
if test $have_libssh2 != yes; then
have_libssh2=yes
- AC_CONFIG_SUBDIRS(libssh2)
CPPFLAGS="-I\$(top_srcdir)/$LIBSSH2DIR/include $CPPFLAGS"
LIBSSH2_LIBS="$LIBSSH2DIR/lib/libssh2.a"
LIBSSH2_BUILD="build-libssh2"
42 changes: 42 additions & 0 deletions user/nmap/template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
pkgname = "nmap"
pkgver = "7.95"
pkgrel = 0
build_style = "gnu_configure"
configure_args = [
"--with-openssl=yes",
"--with-libpcap=yes",
"--with-libpcre=yes",
"--with-liblua=yes",
"--with-libssh2=yes",
"--with-libz-prefix=/usr/lib",
"--without-zenmap",
"CPP=",
]
make_cmd = "gmake"
make_dir = "."
hostmakedepends = [
"automake",
"gmake",
"gettext-devel",
"libtool",
]
makedepends = [
"libpcap-devel",
"libssh2-devel",
"linux-headers",
"lua5.4-devel",
"openssl-devel",
"pcre2-devel",
"zlib-ng-compat-devel",
]
pkgdesc = "Utility for network discovery and security auditing"
maintainer = "Gnarwhal <git.aspect893@passmail.net>"
license = "custom:Nmap"
url = "https://nmap.org"
source = f"https://nmap.org/dist/nmap-{pkgver}.tar.bz2"
sha256 = "e14ab530e47b5afd88f1c8a2bac7f89cd8fe6b478e22d255c5b9bddb7a1c5778"
exec_wrappers = [("/usr/bin/gmake", "make")]


def post_install(self):
self.install_license("LICENSE")

0 comments on commit 53027b9

Please sign in to comment.