Nmap Development mailing list archives

Re: [nmap-svn] r33514 - in nmap: . nselib scripts


From: Daniel Miller <bonsaiviking () gmail com>
Date: Thu, 14 Aug 2014 07:46:07 -0500

Devin,

This breaks the build on systems without libssh2. The configure script
appears to be correct, but Makefile.in unconditionally adds -lssh2 to LIBS
and adds nse_libssh2.{cc,h,o} to the NSE_* variables.

I believe I fixed this in r33517, if you want to confirm that it still
works for systems which *do* have libssh2 available.

Dan


On Wed, Aug 13, 2014 at 9:09 PM, <commit-mailer () nmap org> wrote:

Author: devin
Date: Thu Aug 14 02:09:00 2014
New Revision: 33514

Log:
Merged libssh2-integration branch


Added:
   nmap/nse_libssh2.cc
      - copied unchanged from r33512,
/nmap-exp/devin/libssh2-integration/nse_libssh2.cc
   nmap/nse_libssh2.h
      - copied unchanged from r33512,
/nmap-exp/devin/libssh2-integration/nse_libssh2.h
   nmap/nselib/libssh2.luadoc
      - copied unchanged from r33512,
/nmap-exp/devin/libssh2-integration/nselib/libssh2.luadoc
   nmap/scripts/ssh-auth-methods.nse
      - copied unchanged from r33512,
/nmap-exp/devin/libssh2-integration/scripts/ssh-auth-methods.nse
   nmap/scripts/ssh-brute.nse
      - copied unchanged from r33512,
/nmap-exp/devin/libssh2-integration/scripts/ssh-brute.nse
   nmap/scripts/ssh-vuln-hostkey.nse
      - copied unchanged from r33512,
/nmap-exp/devin/libssh2-integration/scripts/ssh-vuln-hostkey.nse
Modified:
   nmap/Makefile.in
   nmap/aclocal.m4
   nmap/configure
   nmap/configure.ac
   nmap/nmap_config.h.in
   nmap/nse_main.cc
   nmap/nselib/ssh1.lua

Modified: nmap/Makefile.in

==============================================================================
--- nmap/Makefile.in    (original)
+++ nmap/Makefile.in    Thu Aug 14 02:09:00 2014
@@ -52,6 +52,7 @@
 LDFLAGS = @LDFLAGS@ $(DBGFLAGS) $(STATIC)
 LIBS =  @LIBNBASE_LIBS@ @LIBNSOCK_LIBS@ @LIBPCRE_LIBS@ @LIBPCAP_LIBS@
$(OPENSSL_LIBS) libnetutil/libnetutil.a @LIBDNET_LIBS@ @LIBLUA_LIBS@
@LIBLINEAR_LIBS@ @LIBS@
 OPENSSL_LIBS = @OPENSSL_LIBS@
+LIBS += -lssh2 #Just for now
 # LIBS =  -lefence @LIBS@
 # LIBS =  -lrmalloc @LIBS@
 INSTALL = @INSTALL@
@@ -86,9 +87,9 @@
 UNINSTALLNPING=@UNINSTALLNPING@

 ifneq (@LIBLUA_LIBS@,)
-NSE_SRC=nse_main.cc nse_utility.cc nse_nsock.cc nse_dnet.cc nse_fs.cc
nse_nmaplib.cc nse_debug.cc nse_pcrelib.cc nse_binlib.cc nse_bit.cc
nse_lpeg.cc
-NSE_HDRS=nse_main.h nse_utility.h nse_nsock.h nse_dnet.h nse_fs.h
nse_nmaplib.h nse_debug.h nse_pcrelib.h nse_binlib.h nse_bit.h nse_lpeg.h
-NSE_OBJS=nse_main.o nse_utility.o nse_nsock.o nse_dnet.o nse_fs.o
nse_nmaplib.o nse_debug.o nse_pcrelib.o nse_binlib.o nse_bit.o nse_lpeg.o
+NSE_SRC=nse_main.cc nse_utility.cc nse_nsock.cc nse_dnet.cc nse_fs.cc
nse_nmaplib.cc nse_debug.cc nse_pcrelib.cc nse_binlib.cc nse_bit.cc
nse_lpeg.cc nse_libssh2.cc
+NSE_HDRS=nse_main.h nse_utility.h nse_nsock.h nse_dnet.h nse_fs.h
nse_nmaplib.h nse_debug.h nse_pcrelib.h nse_binlib.h nse_bit.h nse_lpeg.h
nse_libssh2.h
+NSE_OBJS=nse_main.o nse_utility.o nse_nsock.o nse_dnet.o nse_fs.o
nse_nmaplib.o nse_debug.o nse_pcrelib.o nse_binlib.o nse_bit.o nse_lpeg.o
nse_libssh2.o
 ifneq (@OPENSSL_LIBS@,)
 NSE_SRC+=nse_openssl.cc nse_ssl_cert.cc
 NSE_HDRS+=nse_openssl.h nse_ssl_cert.h

Modified: nmap/aclocal.m4

==============================================================================
--- nmap/aclocal.m4     (original)
+++ nmap/aclocal.m4     Thu Aug 14 02:09:00 2014
@@ -1,8 +1,7 @@
-# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
+# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.

-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
-# Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -12,8 +11,9 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.

+m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS],
[])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
 # nls.m4 serial 5 (gettext-0.18)
-dnl Copyright (C) 1995-2003, 2005-2006, 2008-2010 Free Software
Foundation,
+dnl Copyright (C) 1995-2003, 2005-2006, 2008-2013 Free Software
Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -45,14 +45,12 @@
   AC_SUBST([USE_NLS])
 ])

-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009,
-# 2011 Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.

-# serial 2

 # AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND],
[ACTION-IF-NOT-FOUND])
 #
---------------------------------------------------------------------------
@@ -81,7 +79,7 @@
   dnl Find a Python interpreter.  Python versions prior to 2.0 are not
   dnl supported. (2.0 was released on October 16, 2000).
   m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
-[python python2 python3 python3.2 python3.1 python3.0 python2.7 dnl
+[python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7
dnl
  python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0])

   AC_ARG_VAR([PYTHON], [the Python interpreter])
@@ -97,10 +95,11 @@
     dnl A version check is needed.
     if test -n "$PYTHON"; then
       # If the user set $PYTHON, use it and don't search something else.
-      AC_MSG_CHECKING([whether $PYTHON version >= $1])
+      AC_MSG_CHECKING([whether $PYTHON version is >= $1])
       AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
-                             [AC_MSG_RESULT(yes)],
-                             [AC_MSG_ERROR(too old)])
+                             [AC_MSG_RESULT([yes])],
+                             [AC_MSG_RESULT([no])
+                              AC_MSG_ERROR([Python interpreter is too
old])])
       am_display_PYTHON=$PYTHON
     else
       # Otherwise, try each interpreter until we find one that satisfies
@@ -149,6 +148,25 @@
     [am_cv_python_platform=`$PYTHON -c "import sys;
sys.stdout.write(sys.platform)"`])
   AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])

+  # Just factor out some code duplication.
+  am_python_setup_sysconfig="\
+import sys
+# Prefer sysconfig over distutils.sysconfig, for better compatibility
+# with python 3.x.  See automake bug#10227.
+try:
+    import sysconfig
+except ImportError:
+    can_use_sysconfig = 0
+else:
+    can_use_sysconfig = 1
+# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs:
+# <https://github.com/pypa/virtualenv/issues/118>
+try:
+    from platform import python_implementation
+    if python_implementation() == 'CPython' and sys.version[[:3]] ==
'2.7':
+        can_use_sysconfig = 0
+except ImportError:
+    pass"

   dnl Set up 4 directories:

@@ -165,7 +183,14 @@
      else
        am_py_prefix=$prefix
      fi
-     am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils
import sysconfig;
sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))"
2>/dev/null`
+     am_cv_python_pythondir=`$PYTHON -c "
+$am_python_setup_sysconfig
+if can_use_sysconfig:
+    sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
+else:
+    from distutils import sysconfig
+    sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
+sys.stdout.write(sitedir)"`
      case $am_cv_python_pythondir in
      $am_py_prefix*)
        am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
@@ -200,7 +225,14 @@
      else
        am_py_exec_prefix=$exec_prefix
      fi
-     am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils
import sysconfig;
sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))"
2>/dev/null`
+     am_cv_python_pyexecdir=`$PYTHON -c "
+$am_python_setup_sysconfig
+if can_use_sysconfig:
+    sitedir = sysconfig.get_path('platlib',
vars={'platbase':'$am_py_prefix'})
+else:
+    from distutils import sysconfig
+    sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix')
+sys.stdout.write(sitedir)"`
      case $am_cv_python_pyexecdir in
      $am_py_exec_prefix*)
        am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
@@ -248,14 +280,12 @@
 sys.exit(sys.hexversion < minverhex)"
   AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])

-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.

-# serial 1
-
 # AM_RUN_LOG(COMMAND)
 # -------------------
 # Run COMMAND, save the exit status in ac_status, and log it.

Modified: nmap/configure

==============================================================================
--- nmap/configure      (original)
+++ nmap/configure      Thu Aug 14 02:09:00 2014
@@ -661,6 +661,7 @@
 DNET_DEPENDS
 LIBDNETDIR
 LIBDNET_LIBS
+LIBSSH2_LIBS
 PCRE_DIST_CLEAN
 PCRE_CLEAN
 PCRE_BUILD
@@ -781,6 +782,7 @@
 with_openssl
 with_libpcap
 with_libpcre
+with_libssh2
 with_libdnet
 with_liblua
 with_liblinear
@@ -1439,6 +1441,7 @@
   --with-libpcre=DIR      Use an existing (compiled) pcre lib from
DIR/include
                           and DIR/lib.
   --with-libpcre=included Always use the version included with Nmap
+  --with-libssh2=DIR      Use speficic copy of libssh2
   --with-libdnet=DIR      Use an existing (compiled) dnet lib from
DIR/include
                           and DIR/lib. This is NOT RECOMMENDED because we
have
                           made many important fixes to our included
libdnet,
@@ -5463,8 +5466,8 @@

         if test -n "$PYTHON"; then
       # If the user set $PYTHON, use it and don't search something else.
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON
version >= 2.4" >&5
-$as_echo_n "checking whether $PYTHON version >= 2.4... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON
version is >= 2.4" >&5
+$as_echo_n "checking whether $PYTHON version is >= 2.4... " >&6; }
       prog="import sys
 # split strings by '.' and convert to numeric.  Append some zeros
 # because we need at least 4 digits for the hex conversion.
@@ -5482,7 +5485,9 @@
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
-  as_fn_error $? "too old" "$LINENO" 5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+                              as_fn_error $? "Python interpreter is too
old" "$LINENO" 5
 fi
       am_display_PYTHON=$PYTHON
     else
@@ -5494,7 +5499,7 @@
   $as_echo_n "(cached) " >&6
 else

-       for am_cv_pathless_PYTHON in python python2 python3 python3.2
python3.1 python3.0 python2.7  python2.6 python2.5 python2.4 python2.3
python2.2 python2.1 python2.0 none; do
+       for am_cv_pathless_PYTHON in python python2 python3 python3.3
python3.2 python3.1 python3.0 python2.7  python2.6 python2.5 python2.4
python2.3 python2.2 python2.1 python2.0 none; do
          test "$am_cv_pathless_PYTHON" = none && break
          prog="import sys
 # split strings by '.' and convert to numeric.  Append some zeros
@@ -5610,6 +5615,25 @@
   PYTHON_PLATFORM=$am_cv_python_platform


+  # Just factor out some code duplication.
+  am_python_setup_sysconfig="\
+import sys
+# Prefer sysconfig over distutils.sysconfig, for better compatibility
+# with python 3.x.  See automake bug#10227.
+try:
+    import sysconfig
+except ImportError:
+    can_use_sysconfig = 0
+else:
+    can_use_sysconfig = 1
+# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs:
+# <https://github.com/pypa/virtualenv/issues/118>
+try:
+    from platform import python_implementation
+    if python_implementation() == 'CPython' and sys.version[:3] == '2.7':
+        can_use_sysconfig = 0
+except ImportError:
+    pass"


             { $as_echo "$as_me:${as_lineno-$LINENO}: checking for
$am_display_PYTHON script directory" >&5
@@ -5623,7 +5647,14 @@
      else
        am_py_prefix=$prefix
      fi
-     am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils
import sysconfig;
sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))"
2>/dev/null`
+     am_cv_python_pythondir=`$PYTHON -c "
+$am_python_setup_sysconfig
+if can_use_sysconfig:
+    sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
+else:
+    from distutils import sysconfig
+    sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
+sys.stdout.write(sitedir)"`
      case $am_cv_python_pythondir in
      $am_py_prefix*)
        am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
@@ -5660,7 +5691,14 @@
      else
        am_py_exec_prefix=$exec_prefix
      fi
-     am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils
import sysconfig;
sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))"
2>/dev/null`
+     am_cv_python_pyexecdir=`$PYTHON -c "
+$am_python_setup_sysconfig
+if can_use_sysconfig:
+    sitedir = sysconfig.get_path('platlib',
vars={'platbase':'$am_py_prefix'})
+else:
+    from distutils import sysconfig
+    sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix')
+sys.stdout.write(sitedir)"`
      case $am_cv_python_pyexecdir in
      $am_py_exec_prefix*)
        am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
@@ -5732,8 +5770,8 @@

         if test -n "$PYTHON"; then
       # If the user set $PYTHON, use it and don't search something else.
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON
version >= 2.4" >&5
-$as_echo_n "checking whether $PYTHON version >= 2.4... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON
version is >= 2.4" >&5
+$as_echo_n "checking whether $PYTHON version is >= 2.4... " >&6; }
       prog="import sys
 # split strings by '.' and convert to numeric.  Append some zeros
 # because we need at least 4 digits for the hex conversion.
@@ -5751,7 +5789,9 @@
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
-  as_fn_error $? "too old" "$LINENO" 5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+                              as_fn_error $? "Python interpreter is too
old" "$LINENO" 5
 fi
       am_display_PYTHON=$PYTHON
     else
@@ -5763,7 +5803,7 @@
   $as_echo_n "(cached) " >&6
 else

-       for am_cv_pathless_PYTHON in python python2 python3 python3.2
python3.1 python3.0 python2.7  python2.6 python2.5 python2.4 python2.3
python2.2 python2.1 python2.0 none; do
+       for am_cv_pathless_PYTHON in python python2 python3 python3.3
python3.2 python3.1 python3.0 python2.7  python2.6 python2.5 python2.4
python2.3 python2.2 python2.1 python2.0 none; do
          test "$am_cv_pathless_PYTHON" = none && break
          prog="import sys
 # split strings by '.' and convert to numeric.  Append some zeros
@@ -5879,6 +5919,25 @@
   PYTHON_PLATFORM=$am_cv_python_platform


+  # Just factor out some code duplication.
+  am_python_setup_sysconfig="\
+import sys
+# Prefer sysconfig over distutils.sysconfig, for better compatibility
+# with python 3.x.  See automake bug#10227.
+try:
+    import sysconfig
+except ImportError:
+    can_use_sysconfig = 0
+else:
+    can_use_sysconfig = 1
+# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs:
+# <https://github.com/pypa/virtualenv/issues/118>
+try:
+    from platform import python_implementation
+    if python_implementation() == 'CPython' and sys.version[:3] == '2.7':
+        can_use_sysconfig = 0
+except ImportError:
+    pass"


             { $as_echo "$as_me:${as_lineno-$LINENO}: checking for
$am_display_PYTHON script directory" >&5
@@ -5892,7 +5951,14 @@
      else
        am_py_prefix=$prefix
      fi
-     am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils
import sysconfig;
sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))"
2>/dev/null`
+     am_cv_python_pythondir=`$PYTHON -c "
+$am_python_setup_sysconfig
+if can_use_sysconfig:
+    sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
+else:
+    from distutils import sysconfig
+    sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
+sys.stdout.write(sitedir)"`
      case $am_cv_python_pythondir in
      $am_py_prefix*)
        am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
@@ -5929,7 +5995,14 @@
      else
        am_py_exec_prefix=$exec_prefix
      fi
-     am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils
import sysconfig;
sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))"
2>/dev/null`
+     am_cv_python_pyexecdir=`$PYTHON -c "
+$am_python_setup_sysconfig
+if can_use_sysconfig:
+    sitedir = sysconfig.get_path('platlib',
vars={'platbase':'$am_py_prefix'})
+else:
+    from distutils import sysconfig
+    sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix')
+sys.stdout.write(sitedir)"`
      case $am_cv_python_pyexecdir in
      $am_py_exec_prefix*)
        am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
@@ -6667,6 +6740,92 @@



+
+have_libssh2=no
+
+# Check whether --with-libssh2 was given.
+if test "${with_libssh2+set}" = set; then :
+  withval=$with_libssh2;  case "$with_libssh2" in
+  yes)
+    have_libssh2=yes
+    ;;
+  included)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"Libssh2 is not
included with Nmap. Will try to find system version\"" >&5
+$as_echo "$as_me: WARNING: \"Libssh2 is not included with Nmap. Will try
to find system version\"" >&2;}
+    ;;
+  *)
+    have_libssh2=yes
+    CPPFLAGS="-I$with_libssh2/include $CPPFLAGS"
+    LDFLAGS="-L$with_libssh2/lib $LDFLAGS"
+  ;;
+  esac
+
+fi
+
+
+if test $have_libssh2 != yes; then
+  for ac_header in libssh2.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "libssh2.h"
"ac_cv_header_libssh2_h" "$ac_includes_default"
+if test "x$ac_cv_header_libssh2_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBSSH2_H 1
+_ACEOF
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libssh2_version in
-lssh2" >&5
+$as_echo_n "checking for libssh2_version in -lssh2... " >&6; }
+if ${ac_cv_lib_ssh2_libssh2_version+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lssh2 -lm $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.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char libssh2_version ();
+int
+main ()
+{
+return libssh2_version ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_ssh2_libssh2_version=yes
+else
+  ac_cv_lib_ssh2_libssh2_version=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result:
$ac_cv_lib_ssh2_libssh2_version" >&5
+$as_echo "$ac_cv_lib_ssh2_libssh2_version" >&6; }
+if test "x$ac_cv_lib_ssh2_libssh2_version" = xyes; then :
+  have_libssh2=yes; break
+fi
+
+
+fi
+
+done
+
+fi
+
+LIBSSH2_LIBS=
+if test $have_libssh2 = yes; then
+  LIBSSH2_LIBS="-lssh2"
+  $as_echo "#define HAVE_LIBSSH2 1" >>confdefs.h
+
+fi
+
+
 have_dnet=no
 requested_included_dnet=no
 LIBDNETDIR=libdnet-stripped

Modified: nmap/configure.ac

==============================================================================
--- nmap/configure.ac   (original)
+++ nmap/configure.ac   Thu Aug 14 02:09:00 2014
@@ -509,6 +509,38 @@
 AC_SUBST(PCRE_CLEAN)
 AC_SUBST(PCRE_DIST_CLEAN)

+
+have_libssh2=no
+AC_ARG_WITH(libssh2,
+AC_HELP_STRING([--with-libssh2=DIR], [Use speficic copy of libssh2]),
+[ case "$with_libssh2" in
+  yes)
+    have_libssh2=yes
+    ;;
+  included)
+    AC_MSG_WARN("Libssh2 is not included with Nmap. Will try to find
system version")
+    ;;
+  *)
+    have_libssh2=yes
+    CPPFLAGS="-I$with_libssh2/include $CPPFLAGS"
+    LDFLAGS="-L$with_libssh2/lib $LDFLAGS"
+  ;;
+  esac]
+)
+
+if test $have_libssh2 != yes; then
+  AC_CHECK_HEADERS([libssh2.h],
+    AC_CHECK_LIB(ssh2, libssh2_version, [have_libssh2=yes; break],, [-lm])
+  )
+fi
+
+LIBSSH2_LIBS=
+if test $have_libssh2 = yes; then
+  LIBSSH2_LIBS="-lssh2"
+  AC_DEFINE(HAVE_LIBSSH2)
+fi
+AC_SUBST(LIBSSH2_LIBS)
+
 have_dnet=no
 requested_included_dnet=no
 LIBDNETDIR=libdnet-stripped

Modified: nmap/nmap_config.h.in

==============================================================================
--- nmap/nmap_config.h.in       (original)
+++ nmap/nmap_config.h.in       Thu Aug 14 02:09:00 2014
@@ -175,6 +175,8 @@

 #undef HAVE_PCRE_H

+#undef HAVE_LIBSSH2
+
 #undef HAVE_PCRE_PCRE_H

 #undef BSD_NETWORKING

Modified: nmap/nse_main.cc

==============================================================================
--- nmap/nse_main.cc    (original)
+++ nmap/nse_main.cc    Thu Aug 14 02:09:00 2014
@@ -20,6 +20,7 @@
 #include "nse_openssl.h"
 #include "nse_debug.h"
 #include "nse_lpeg.h"
+#include "nse_libssh2.h"

 #define NSE_MAIN "NSE_MAIN" /* the main function */

@@ -545,6 +546,9 @@
     {BITLIBNAME, luaopen_bit},
     {LFSLIBNAME, luaopen_lfs},
     {LPEGLIBNAME, luaopen_lpeg},
+#ifdef HAVE_LIBSSH2
+    {LIBSSH2LIBNAME, luaopen_libssh2},
+#endif
 #ifdef HAVE_OPENSSL
     {OPENSSLLIBNAME, luaopen_openssl},
 #endif

Modified: nmap/nselib/ssh1.lua

==============================================================================
--- nmap/nselib/ssh1.lua        (original)
+++ nmap/nselib/ssh1.lua        Thu Aug 14 02:09:00 2014
@@ -112,6 +112,12 @@
   end
 end

+--- Returns key fingerprint in hexadecimal
+fingerprint = function( hostkey )
+  local fingerprint = openssl.md5(hostkey)
+  return stdnse.tohex(fingerprint,{separator=":",group=2})
+end
+
 --- Format a key fingerprint in hexadecimal.
 -- @param fingerprint Key fingerprint.
 -- @param algorithm Key algorithm.

_______________________________________________
Sent through the svn mailing list
http://nmap.org/mailman/listinfo/svn

_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: