nmap: port ndiff to python 3 (via 2to3 plus a few extra
patches) and reenable it
This commit is contained in:
parent
1caf67cac9
commit
edb4c48d8a
|
@ -1,8 +1,9 @@
|
|||
COMMENT-main= scan ports and fingerprint stack of network hosts
|
||||
|
||||
DISTNAME= nmap-7.91
|
||||
MODPY_EGG_VERSION= 7.91
|
||||
DISTNAME= nmap-${MODPY_EGG_VERSION}
|
||||
PKGNAME-main= ${DISTNAME}
|
||||
REVISION= 3
|
||||
REVISION= 4
|
||||
|
||||
CATEGORIES= net security
|
||||
MASTER_SITES= ${HOMEPAGE}/dist/
|
||||
|
@ -24,7 +25,8 @@ COMPILER= base-clang ports-gcc base-gcc
|
|||
USE_GMAKE= Yes
|
||||
MODLUA_SA= Yes
|
||||
MODLUA_VERSION= 5.3
|
||||
MODULES= lang/lua
|
||||
MODULES= lang/python \
|
||||
lang/lua
|
||||
|
||||
DEBUG_PACKAGES= ${BUILD_PACKAGES}
|
||||
CONFIGURE_STYLE=autoconf
|
||||
|
@ -43,7 +45,6 @@ CONFIGURE_ARGS= --with-libpcap=included \
|
|||
--with-libpcre=${LOCALBASE} \
|
||||
--with-mandir=${LOCALBASE}/man \
|
||||
--without-nmap-update \
|
||||
--without-ndiff \
|
||||
--without-zenmap \
|
||||
--disable-nls
|
||||
|
||||
|
@ -53,10 +54,12 @@ LIB_DEPENDS-main= ${MODLUA_LIB_DEPENDS} \
|
|||
devel/pcre \
|
||||
security/libssh2
|
||||
|
||||
BUILD_DEPENDS= devel/bison
|
||||
BUILD_DEPENDS= devel/bison
|
||||
|
||||
post-extract:
|
||||
@cd ${WRKSRC} && rm -rf liblua/ libpcre/
|
||||
2to3 --fix=all --no-diffs --nobackups --verbose --write \
|
||||
${WRKSRC}/ndiff/*py ${WRKSRC}/ndiff/scripts/ndiff
|
||||
|
||||
pre-configure:
|
||||
@cd ${WRKSRC}/nping ; env PATH=${PORTPATH} \
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
Neuter Python 2 detection, nothing uses it
|
||||
|
||||
Index: configure.ac
|
||||
--- configure.ac.orig
|
||||
+++ configure.ac
|
||||
@@ -230,8 +230,6 @@ AC_SEARCH_LIBS(gethostbyname, nsl)
|
||||
dnl Check IPv6 raw sending flavor.
|
||||
CHECK_IPV6_IPPROTO_RAW
|
||||
@@ -241,7 +241,7 @@ NDIFFDIR=ndiff
|
||||
|
||||
-m4_define_default([_AM_PYTHON_INTERPRETER_LIST],[python2 python2.7 python2.6 python2.5 python2.4 python])
|
||||
-AM_PATH_PYTHON([2.4], [HAVE_PYTHON=true], [HAVE_PYTHON=false])
|
||||
HAVE_PYTHON2=false
|
||||
if test $HAVE_PYTHON && test "x${PYTHON_VERSION%%.*}" = "x2"; then
|
||||
HAVE_PYTHON2=true
|
||||
# Do they want Ndiff?
|
||||
AC_ARG_WITH(ndiff, AC_HELP_STRING([--without-ndiff], [Skip installation of the Ndiff utility]), [], [with_ndiff=check])
|
||||
-if $HAVE_PYTHON2 ; then : ;
|
||||
+if $HAVE_PYTHON ; then : ;
|
||||
else
|
||||
if test "$with_ndiff" = "check" ; then
|
||||
AC_MSG_WARN([Not building Ndiff because Python 2.x with x>=4 was not found])
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
Index: ndiff/ndiff.py
|
||||
--- ndiff/ndiff.py.orig
|
||||
+++ ndiff/ndiff.py
|
||||
@@ -32,6 +32,8 @@ verbose = False
|
||||
|
||||
NDIFF_XML_VERSION = "1"
|
||||
|
||||
+def cmp(x, y):
|
||||
+ return (x > y) - (x < y)
|
||||
|
||||
class OverrideEntityResolver(xml.sax.handler.EntityResolver):
|
||||
"""This class overrides the default behavior of xml.sax to download
|
||||
@@ -160,11 +162,11 @@ class Host(object):
|
||||
return state is None or state in self.extraports
|
||||
|
||||
def extraports_string(self):
|
||||
- list = [(count, state) for (state, count) in list(self.extraports.items())]
|
||||
+ mylist = [(count, state) for (state, count) in list(self.extraports.items())]
|
||||
# Reverse-sort by count.
|
||||
- list.sort(reverse=True)
|
||||
+ mylist.sort(reverse=True)
|
||||
return ", ".join(
|
||||
- ["%d %s ports" % (count, state) for (count, state) in list])
|
||||
+ ["%d %s ports" % (count, state) for (count, state) in mylist])
|
||||
|
||||
def state_to_dom_fragment(self, document):
|
||||
frag = document.createDocumentFragment()
|
||||
@@ -183,7 +185,7 @@ class Host(object):
|
||||
|
||||
def extraports_to_dom_fragment(self, document):
|
||||
frag = document.createDocumentFragment()
|
||||
- for state, count in list(self.extraports.items()):
|
||||
+ for state, count in mylist(self.extraports.items()):
|
||||
elem = document.createElement("extraports")
|
||||
elem.setAttribute("state", state)
|
||||
elem.setAttribute("count", str(count))
|
|
@ -0,0 +1,12 @@
|
|||
Index: ndiff/setup.py
|
||||
--- ndiff/setup.py.orig
|
||||
+++ ndiff/setup.py
|
||||
@@ -306,7 +306,7 @@ class my_uninstall(distutils.cmd.Command):
|
||||
|
||||
distutils.core.setup(name="ndiff", scripts=["scripts/ndiff"],
|
||||
py_modules=["ndiff"],
|
||||
- data_files=[("share/man/man1", ["docs/ndiff.1"])],
|
||||
+ data_files=[("man/man1", ["docs/ndiff.1"])],
|
||||
cmdclass={
|
||||
"install_egg_info": null_command,
|
||||
"install": checked_install,
|
|
@ -3,9 +3,17 @@
|
|||
@pkgpath net/nmap
|
||||
@pkgpath net/nmap,no_x11
|
||||
@bin bin/ncat
|
||||
bin/ndiff
|
||||
@bin bin/nmap
|
||||
@bin bin/nping
|
||||
@comment bin/uninstall_ndiff
|
||||
lib/python${MODPY_VERSION}/
|
||||
lib/python${MODPY_VERSION}/site-packages/
|
||||
${MODPY_COMMENT}lib/python${MODPY_VERSION}/site-packages/${MODPY_PYCACHE}/
|
||||
lib/python${MODPY_VERSION}/site-packages/${MODPY_PYCACHE}ndiff.${MODPY_PYC_MAGIC_TAG}pyc
|
||||
lib/python${MODPY_VERSION}/site-packages/ndiff.py
|
||||
@man man/man1/ncat.1
|
||||
@man man/man1/ndiff.1
|
||||
@man man/man1/nmap.1
|
||||
@man man/man1/nping.1
|
||||
@comment share/applications/
|
||||
|
|
Loading…
Reference in New Issue