Browse Source

nmap: Update to 7.80, add full variant, switch to Python 3

* Update to 7.80

* Add "full" variants for nmap and ncat that support Lua scripts (and
  OpenSSL)

* Replace libcxx fix with upstream patch[1] (CHANGELOG change was
  removed)

* Switch ndiff to use Python 3 (using a patch from Debian[2], which
  comes from an upstream PR[3] plus a port of ndiff/setup.py)

[1]: ea4e2d6657
[2]: 0510c602dd/debian/patches/0004-Python3-port-of-ndiff.patch
[3]: https://github.com/nmap/nmap/pull/1807

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
lilik-openwrt-22.03
Jeffery To 5 years ago
committed by Nuno Goncalves
parent
commit
067c93b028
4 changed files with 1932 additions and 111 deletions
  1. +82
    -31
      net/nmap/Makefile
  2. +135
    -0
      net/nmap/patches/010-Avoid-using-namespace-std-causing-name-conflicts.patch
  3. +0
    -80
      net/nmap/patches/010-cxx.patch
  4. +1715
    -0
      net/nmap/patches/020-Python3-port-of-ndiff.patch

+ 82
- 31
net/nmap/Makefile View File

@ -13,31 +13,32 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=nmap
PKG_VERSION:=7.70
PKG_RELEASE:=2
PKG_VERSION:=7.80
PKG_RELEASE:=1
PKG_MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://nmap.org/dist/
PKG_HASH:=847b068955f792f4cc247593aca6dc3dc4aae12976169873247488de147a6e18
PKG_LICENSE:=GPL-2.0
PKG_HASH:=fcfa5a0e42099e12e4bf7a68ebe6fde05553383a682e816a7ec9256ab4773faa
PKG_LICENSE:=GPL-2.0-only
PKG_LICENSE_FILES:=COPYING
PKG_CPE_ID:=cpe:/a:nmap:nmap
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
include ../../lang/python/python3-package.mk
NMAP_DEPENDS:=+libpcap +libstdcpp +zlib +libpcre
NCAT_DEPENDS:=+libpcap
NPING_DEPENDS:=+libpcap +libpthread +libstdcpp
NDIFF_DEPENDS:=+python
define Package/nmap/default
SUBMENU:=NMAP Suite
SECTION:=net
CATEGORY:=Network
URL:=http://nmap.org/
URL:=https://nmap.org/
endef
define Package/nmap
@ -54,6 +55,13 @@ $(call Package/nmap/default)
TITLE:=Nmap (with OpenSSL support)
endef
define Package/nmap-full
$(call Package/nmap/default)
DEPENDS:=$(NMAP_DEPENDS) +libopenssl +liblua5.3 +libssh2
VARIANT:=full
TITLE:=Nmap (with OpenSSL and scripting support)
endef
define Package/ncat
$(call Package/nmap/default)
DEPENDS:=$(NCAT_DEPENDS)
@ -68,6 +76,13 @@ $(call Package/nmap/default)
TITLE:=Ncat (with OpenSSL support)
endef
define Package/ncat-full
$(call Package/nmap/default)
DEPENDS:=$(NCAT_DEPENDS) +libopenssl +liblua5.3
VARIANT:=full
TITLE:=Ncat (with OpenSSL and scripting support)
endef
define Package/nping
$(call Package/nmap/default)
DEPENDS:=$(NPING_DEPENDS)
@ -84,40 +99,73 @@ endef
define Package/ndiff
$(call Package/nmap/default)
DEPENDS:=$(NDIFF_DEPENDS)
VARIANT:=nossl
DEPENDS:=+python3-light +python3-xml
VARIANT:=python3
TITLE:=Utility to compare the results of Nmap scans
endef
CONFIGURE_ARGS += \
--with-libdnet=included \
--with-libpcre="$(STAGING_DIR)/usr" \
--with-liblinear=included \
--with-libpcap="$(STAGING_DIR)/usr" \
--without-liblua \
--with-libpcre="$(STAGING_DIR)/usr" \
--with-libz="$(STAGING_DIR)/usr" \
--with-ncat \
--without-localdirs \
--without-ndiff \
--without-nmap-update \
--without-subversion \
--without-zenmap
# --with-libnbase=included
# --with-libnsock=included
# --without-apr
ifeq ($(BUILD_VARIANT),full)
CONFIGURE_ARGS += \
--with-liblua="$(STAGING_DIR)/usr" \
--with-libssh2="$(STAGING_DIR)/usr" \
--with-openssl="$(STAGING_DIR)/usr" \
--without-nping
else ifeq ($(BUILD_VARIANT),ssl)
CONFIGURE_ARGS += \
--with-nping \
--with-openssl="$(STAGING_DIR)/usr" \
--without-liblua \
--without-libssh2
else # nossl
CONFIGURE_ARGS += \
--with-nping \
--without-liblua \
--without-libssh2 \
--without-openssl
endif
CONFIGURE_VARS += \
ac_cv_dnet_bsd_bpf=no \
CXXFLAGS="$$$$CXXFLAGS -fno-builtin"
ac_cv_dnet_bsd_bpf=no
ifeq ($(BUILD_VARIANT),ssl)
CONFIGURE_ARGS += --with-openssl="$(STAGING_DIR)/usr" --without-libssh2
else
CONFIGURE_ARGS += --without-openssl
PYTHON3_PKG_SETUP_DIR:=ndiff
PYTHON3_PKG_SETUP_ARGS:=
ifeq ($(BUILD_VARIANT),python3)
Build/Configure:=:
Build/Install:=:
endif
define Package/nmap/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nmap $(1)/usr/bin/
$(INSTALL_DIR) $(1)/usr/share/nmap
$(CP) $(PKG_INSTALL_DIR)/usr/share/nmap/* $(1)/usr/share/nmap/
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/nmap/nmap* $(1)/usr/share/nmap/
endef
define Package/nmap-ssl/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nmap $(1)/usr/bin/
$(INSTALL_DIR) $(1)/usr/share/nmap
$(CP) $(PKG_INSTALL_DIR)/usr/share/nmap/* $(1)/usr/share/nmap/
Package/nmap-ssl/install=$(Package/nmap/install)
define Package/nmap-full/install
$(call Package/nmap/install,$(1))
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/nmap/nse_main.lua $(1)/usr/share/nmap/
$(CP) $(PKG_INSTALL_DIR)/usr/share/nmap/{nselib,scripts} $(1)/usr/share/nmap/
endef
define Package/ncat/install
@ -126,31 +174,34 @@ define Package/ncat/install
endef
define Package/ncat-ssl/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ncat $(1)/usr/bin/
$(call Package/ncat/install,$(1))
$(INSTALL_DIR) $(1)/usr/share/ncat
$(CP) $(PKG_INSTALL_DIR)/usr/share/ncat/ca-bundle.crt $(1)/usr/share/ncat/
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/ncat/ca-bundle.crt $(1)/usr/share/ncat/
endef
define Package/ndiff/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ndiff $(1)/usr/bin/
endef
Package/ncat-full/install=$(Package/ncat-ssl/install)
define Package/nping/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nping $(1)/usr/bin/
endef
define Package/nping-ssl/install
Package/nping-ssl/install=$(Package/nping/install)
define Py3Package/ndiff/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nping $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ndiff $(1)/usr/bin/
endef
$(eval $(call BuildPackage,nmap))
$(eval $(call BuildPackage,nmap-ssl))
$(eval $(call BuildPackage,nmap-full))
$(eval $(call BuildPackage,ncat))
$(eval $(call BuildPackage,ncat-ssl))
$(eval $(call BuildPackage,ncat-full))
$(eval $(call BuildPackage,nping))
$(eval $(call BuildPackage,nping-ssl))
$(eval $(call Py3Package,ndiff))
$(eval $(call BuildPackage,ndiff))
$(eval $(call BuildPackage,ndiff-src))

+ 135
- 0
net/nmap/patches/010-Avoid-using-namespace-std-causing-name-conflicts.patch View File

@ -0,0 +1,135 @@
From ea4e2d6657103a2c3d6f543a1a8619eb4d4472c8 Mon Sep 17 00:00:00 2001
From: dmiller <dmiller@e0a8ed71-7df4-0310-8962-fdc924857419>
Date: Mon, 30 Dec 2019 04:03:03 +0000
Subject: [PATCH] Avoid 'using namespace std' causing name conflicts. Fixes
#1363, fixes #1867
---
CHANGELOG | 4 ++++
nping/EchoServer.cc | 2 +-
nping/EchoServer.h | 4 +---
nping/NEPContext.h | 3 +--
nping/NpingTargets.h | 4 +---
nping/ProbeMode.h | 2 --
nping/nping.cc | 1 -
nping/utils.h | 2 --
8 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/nping/EchoServer.cc b/nping/EchoServer.cc
index ccdcf9c2d0..a824340cd2 100644
--- a/nping/EchoServer.cc
+++ b/nping/EchoServer.cc
@@ -199,7 +199,7 @@ NEPContext *EchoServer::getClientContext(nsock_iod iod){
* the context could not be found. */
int EchoServer::destroyClientContext(clientid_t clnt){
bool deleted=false;
- vector<NEPContext>::iterator it;
+ std::vector<NEPContext>::iterator it;
/* Iterate through the context array and delete the one that belongs to clnt */
for ( it=this->client_ctx.begin(); it<this->client_ctx.end(); it++){
if(it->getIdentifier()==clnt){
diff --git a/nping/EchoServer.h b/nping/EchoServer.h
index c3dece6341..c9fee6de9e 100644
--- a/nping/EchoServer.h
+++ b/nping/EchoServer.h
@@ -136,15 +136,13 @@
#include <vector>
#include "NEPContext.h"
-using namespace std;
-
#define LISTEN_QUEUE_SIZE 10
class EchoServer {
private:
/* Attributes */
- vector<NEPContext> client_ctx;
+ std::vector<NEPContext> client_ctx;
clientid_t client_id_count;
/* Methods */
diff --git a/nping/NEPContext.h b/nping/NEPContext.h
index 5e470d7551..32b8be48d6 100644
--- a/nping/NEPContext.h
+++ b/nping/NEPContext.h
@@ -135,7 +135,6 @@
#include "nsock.h"
#include "EchoHeader.h"
#include <vector>
-using namespace std;
/* SERVER STATE MACHINE */
/* _ */
@@ -204,7 +203,7 @@ class NEPContext {
u8 client_nonce[NONCE_LEN];
bool server_nonce_set;
bool client_nonce_set;
- vector<fspec_t> fspecs;
+ std::vector<fspec_t> fspecs;
struct sockaddr_storage clnt_addr;
u8 *generateKey(int key_type, size_t *final_len);
diff --git a/nping/NpingTargets.h b/nping/NpingTargets.h
index 61bb356f39..3a9a2145af 100644
--- a/nping/NpingTargets.h
+++ b/nping/NpingTargets.h
@@ -137,8 +137,6 @@
#include "NpingTarget.h"
#include <vector>
-using namespace std;
-
#define MAX_NPING_HOSTNAME_LEN 512 /**< Max length for named hosts */
class NpingTargets {
@@ -176,7 +174,7 @@ class NpingTargets {
/* TODO: Make private */
NpingTarget *currenths;
- vector<NpingTarget *> Targets;
+ std::vector<NpingTarget *> Targets;
}; /* End of class NpingTargets */
diff --git a/nping/ProbeMode.h b/nping/ProbeMode.h
index aa86939e02..313776d862 100644
--- a/nping/ProbeMode.h
+++ b/nping/ProbeMode.h
@@ -135,11 +135,9 @@
#include "nping.h"
#include "nsock.h"
-#include <vector>
#include "NpingTarget.h"
#include "utils_net.h"
#include "utils.h"
-using namespace std;
#define PKT_TYPE_TCP_CONNECT 1
#define PKT_TYPE_UDP_NORMAL 2
diff --git a/nping/nping.cc b/nping/nping.cc
index 9de151a7be..40df912a88 100644
--- a/nping/nping.cc
+++ b/nping/nping.cc
@@ -150,7 +150,6 @@
#include <signal.h>
#include <time.h>
-using namespace std;
NpingOps o;
EchoClient ec;
EchoServer es;
diff --git a/nping/utils.h b/nping/utils.h
index c3516cf29f..5de6b64b89 100644
--- a/nping/utils.h
+++ b/nping/utils.h
@@ -143,8 +143,6 @@
#endif
#include "global_structures.h"
-#include <vector>
-using namespace std;
/* Function prototypes */
bool contains(const char *source, const char *substring);

+ 0
- 80
net/nmap/patches/010-cxx.patch View File

@ -1,80 +0,0 @@
--- a/nmap_error.cc
+++ b/nmap_error.cc
@@ -135,6 +135,7 @@
#include "xml.h"
#include <errno.h>
+#include <time.h>
extern NmapOps o;
--- a/nping/EchoServer.cc
+++ b/nping/EchoServer.cc
@@ -131,6 +131,7 @@
#include "EchoServer.h"
#include "EchoHeader.h"
#include "NEPContext.h"
+#include <ctime>
#include <vector>
#include "nsock.h"
#include "output.h"
@@ -281,12 +282,12 @@ int EchoServer::nep_listen_socket(){
server_addr6.sin6_len = sizeof(struct sockaddr_in6);
#endif
/* Bind to local address and the specified port */
- if( bind(master_sd, (struct sockaddr *)&server_addr6, sizeof(server_addr6)) != 0 ){
+ if( ::bind(master_sd, (struct sockaddr *)&server_addr6, sizeof(server_addr6)) != 0 ){
nping_warning(QT_3, "Failed to bind to source address %s. Trying to bind to port %d...", IPtoa(server_addr6.sin6_addr), port);
/* If the bind failed for the supplied address, just try again with in6addr_any */
if( o.spoofSource() ){
server_addr6.sin6_addr = in6addr_any;
- if( bind(master_sd, (struct sockaddr *)&server_addr6, sizeof(server_addr6)) != 0 ){
+ if( ::bind(master_sd, (struct sockaddr *)&server_addr6, sizeof(server_addr6)) != 0 ){
nping_fatal(QT_3, "Could not bind to port %d (%s).", port, strerror(errno));
}else{
nping_print(VB_1, "Server bound to port %d", port);
@@ -319,12 +320,12 @@ int EchoServer::nep_listen_socket(){
#endif
/* Bind to local address and the specified port */
- if( bind(master_sd, (struct sockaddr *)&server_addr4, sizeof(server_addr4)) != 0 ){
+ if( ::bind(master_sd, (struct sockaddr *)&server_addr4, sizeof(server_addr4)) != 0 ){
nping_warning(QT_3, "Failed to bind to source address %s. Trying to bind to port %d...", IPtoa(server_addr4.sin_addr), port);
/* If the bind failed for the supplied address, just try again with in6addr_any */
if( o.spoofSource() ){
server_addr4.sin_addr.s_addr=INADDR_ANY;
- if( bind(master_sd, (struct sockaddr *)&server_addr4, sizeof(server_addr4)) != 0 ){
+ if( ::bind(master_sd, (struct sockaddr *)&server_addr4, sizeof(server_addr4)) != 0 ){
nping_fatal(QT_3, "Could not bind to port %d (%s).", port, strerror(errno));
}else{
nping_print(VB_1, "Server bound to port %d", port);
--- a/osscan.cc
+++ b/osscan.cc
@@ -151,6 +151,7 @@
#endif
#include <algorithm>
+#include <ctime>
#include <list>
#include <set>
--- a/osscan2.cc
+++ b/osscan2.cc
@@ -145,6 +145,7 @@
#include "struct_ip.h"
+#include <ctime>
#include <list>
#include <math.h>
--- a/service_scan.cc
+++ b/service_scan.cc
@@ -173,6 +173,7 @@
#endif
#include <algorithm>
+#include <ctime>
#include <list>
extern NmapOps o;

+ 1715
- 0
net/nmap/patches/020-Python3-port-of-ndiff.patch
File diff suppressed because it is too large
View File


Loading…
Cancel
Save