1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-15 20:29:03 +00:00

Remove the nselib-bin directory. Almost all references to it have been removed

too. The section in scripting.xml about creating C modules is gone. (But maybe
it should be replaced with a tutorial on making static modules?) The only
places where nselib-bin is still referenced are in mswin32/nsis/Nmap.nsi, where
it is still removed on uninstallation; and in mswin32/nmap.vcproj, from where I
don't have the resources now to remove it.
This commit is contained in:
david
2008-09-05 05:32:06 +00:00
parent 12f272d4d6
commit b3eddfe90a
11 changed files with 8 additions and 26229 deletions

View File

@@ -2,6 +2,10 @@
4.69BETA1
o Removed the nselib-bin directory. The last remaining shared NSE
module, bit, has been made static. Shared modules were broken for
static builds of Nmap, such as those in the RPMS. [David]
o Expanded nmap-services to include information on how frequently each
port number is found open. The results were generated by scanning
tens of millions of IPs on the Internet. [Fyodor]

View File

@@ -62,7 +62,6 @@ ifneq (@LIBLUA_LIBS@,)
NSE_SRC=nse_main.cc nse_nsock.cc nse_init.cc nse_fs.cc nse_nmaplib.cc nse_debug.cc nse_pcrelib.cc nse_binlib.cc nse_hash.cc nse_bit.cc
NSE_HDRS=nse_main.h nse_nsock.h nse_init.h nse_fs.h nse_nmaplib.h nse_debug.h nse_macros.h nse_pcrelib.h nse_binlib.h nse_hash.h nse_bit.h
NSE_OBJS=nse_main.o nse_nsock.o nse_init.o nse_fs.o nse_nmaplib.o nse_debug.o nse_pcrelib.o nse_binlib.o nse_hash.o nse_bit.o
NSESTDLIB=nsestdlib
endif
export SRCS = main.cc nmap.cc targets.cc tcpip.cc nmap_error.cc utils.cc idle_scan.cc osscan.cc osscan2.cc output.cc scan_engine.cc timing.cc charpool.cc services.cc protocols.cc nmap_rpc.cc portlist.cc NmapOps.cc TargetGroup.cc Target.cc FingerPrintResults.cc service_scan.cc NmapOutputTable.cc MACLookup.cc nmap_tty.cc nmap_dns.cc traceroute.cc portreasons.cc $(NSE_SRC) @COMPAT_SRCS@
@@ -76,17 +75,13 @@ OBJS = main.o nmap.o targets.o tcpip.o nmap_error.o utils.o idle_scan.o osscan.o
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
all: @LUA_BUILD@ @PCAP_BUILD@ @PCRE_BUILD@ @DNET_BUILD@ @NBASE_BUILD@ @NSOCK_BUILD@
$(MAKE) $(TARGET) $(NSESTDLIB) $(BUILDZENMAP)
$(MAKE) $(TARGET) $(BUILDZENMAP)
$(TARGET): @LUA_DEPENDS@ @PCAP_DEPENDS@ @PCRE_DEPENDS@ @DNET_DEPENDS@ $(NBASEDIR)/libnbase.a $(NSOCKDIR)/src/libnsock.a $(OBJS)
echo Compiling nmap
rm -f $@
$(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
nsestdlib: nselib-bin/Makefile
@echo Compiling nse-standard-library; cd nselib-bin && $(MAKE)
pcre_build: $(LIBPCREDIR)/Makefile
@echo Compiling libpcre; cd $(LIBPCREDIR) && $(MAKE)
@@ -126,7 +121,7 @@ distro:
web:
cd $(NMAPDEVDIR) && $(MAKE) web
clean: @LUA_CLEAN@ @PCAP_CLEAN@ @PCRE_CLEAN@ @DNET_CLEAN@ nsock_clean nbase_clean my_clean @NSELIB_CLEAN@ @ZENMAP_CLEAN@
clean: @LUA_CLEAN@ @PCAP_CLEAN@ @PCRE_CLEAN@ @DNET_CLEAN@ nsock_clean nbase_clean my_clean @ZENMAP_CLEAN@
my_clean:
rm -f dependencies.mk makefile.dep
@@ -143,8 +138,6 @@ nsock_clean:
-cd $(NSOCKDIR)/src && $(MAKE) clean
lua_clean:
-cd $(LIBLUADIR) && $(MAKE) clean
nselib_clean:
-cd nselib-bin && $(MAKE) clean
zenmap_clean:
-cd $(ZENMAPDIR) && $(PYTHON) setup.py clean --all
pcap_dist_clean:
@@ -155,8 +148,6 @@ dnet_dist_clean:
-cd $(LIBDNETDIR) && $(MAKE) distclean
lua_dist_clean:
-cd $(LIBLUADIR) && $(MAKE) clean
nselib_dist_clean:
-cd nselib-bin && $(MAKE) distclean
nbase_dist_clean:
-cd $(NBASEDIR) && $(MAKE) distclean
nsock_dist_clean:
@@ -166,7 +157,7 @@ zenmap_dist_clean: zenmap_clean
debugclean:
rm -f *.gcov *.gcda *.gcno gmon.out
distclean: my_clean my_distclean @LUA_DIST_CLEAN@ @PCAP_DIST_CLEAN@ @PCRE_DIST_CLEAN@ @DNET_DIST_CLEAN@ nbase_dist_clean nsock_dist_clean @NSELIB_DIST_CLEAN@ @ZENMAP_DIST_CLEAN@
distclean: my_clean my_distclean @LUA_DIST_CLEAN@ @PCAP_DIST_CLEAN@ @PCRE_DIST_CLEAN@ @DNET_DIST_CLEAN@ nbase_dist_clean nsock_dist_clean @ZENMAP_DIST_CLEAN@
my_distclean:
rm -f Makefile Makefile.bak makefile.dep nmap_config.h stamp-h stamp-h.in \
@@ -220,15 +211,12 @@ install-zenmap: $(ZENMAPDIR)/setup.py
NSE_FILES = scripts/script.db scripts/*.nse
NSE_LIB_LUA_FILES = nselib/*.lua
#NSE_LIB_SO_FILES = nselib-bin/*.so
install-nse: $(TARGET)
$(INSTALL) -d $(DESTDIR)$(nmapdatadir)/scripts
cp -f $(NSE_FILES) $(DESTDIR)$(nmapdatadir)/scripts
$(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib
cp -f $(NSE_LIB_LUA_FILES) $(DESTDIR)$(nmapdatadir)/nselib
#$(INSTALL) -d $(DESTDIR)$(nmaplibexecdir)/nselib-bin
#cp -f $(NSE_LIB_SO_FILES) $(DESTDIR)$(nmaplibexecdir)/nselib-bin
install: install-nmap $(INSTALLNSE) $(INSTALLZENMAP)
@echo "NMAP SUCCESSFULLY INSTALLED"

16
configure vendored
View File

@@ -720,8 +720,6 @@ LUA_BUILD
LUA_CLEAN
LUA_DIST_CLEAN
INSTALLNSE
NSELIB_CLEAN
NSELIB_DIST_CLEAN
NBASEDIR
NBASE_BUILD
LIBNBASE_LIBS
@@ -746,7 +744,6 @@ CPP'
ac_subdirs_all='libpcap
libpcre
libdnet-stripped
nselib-bin
nbase
nsock/src'
@@ -7829,15 +7826,6 @@ echo "${ECHO_T}yes" >&6; }
INSTALLNSE="install-nse"
fi
if test $no_lua != yes; then
subdirs="$subdirs nselib-bin"
NSELIB_CLEAN=nselib_clean
NSELIB_DIST_CLEAN=nselib_dist_clean
fi
@@ -9438,8 +9426,6 @@ LUA_BUILD!$LUA_BUILD$ac_delim
LUA_CLEAN!$LUA_CLEAN$ac_delim
LUA_DIST_CLEAN!$LUA_DIST_CLEAN$ac_delim
INSTALLNSE!$INSTALLNSE$ac_delim
NSELIB_CLEAN!$NSELIB_CLEAN$ac_delim
NSELIB_DIST_CLEAN!$NSELIB_DIST_CLEAN$ac_delim
NBASEDIR!$NBASEDIR$ac_delim
NBASE_BUILD!$NBASE_BUILD$ac_delim
LIBNBASE_LIBS!$LIBNBASE_LIBS$ac_delim
@@ -9450,7 +9436,7 @@ LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 20; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 18; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

View File

@@ -574,12 +574,6 @@ else
INSTALLNSE="install-nse"
fi
if test $no_lua != yes; then
AC_CONFIG_SUBDIRS( nselib-bin )
NSELIB_CLEAN=nselib_clean
NSELIB_DIST_CLEAN=nselib_dist_clean
fi
AC_SUBST(LIBLUA_LIBS)
AC_SUBST(LIBLUADIR)
AC_SUBST(LUA_DEPENDS)
@@ -587,8 +581,6 @@ AC_SUBST(LUA_BUILD)
AC_SUBST(LUA_CLEAN)
AC_SUBST(LUA_DIST_CLEAN)
AC_SUBST(INSTALLNSE)
AC_SUBST(NSELIB_CLEAN)
AC_SUBST(NSELIB_DIST_CLEAN)
AC_SUBST(CXXFLAGS)
dnl This test is from the configure.in of Unix Network Programming second

View File

@@ -4019,69 +4019,5 @@ The mainloop function will work on each runlevel grouping of threads in order.
repeated until no threads exist in either waiting or running.
</para>
</sect2>
<sect2 id="nse-implementation-c-modules">
<title>Adding C Modules to Nselib</title>
<indexterm><primary>Nmap Scripting Engine (NSE)</primary><secondary>C modules</secondary></indexterm>
<para>
This section gives a short walk-through for adding
nselib modules written in C (or C++) to Nmap's build system, since
this has shown to be sometimes tedious. Writing C modules is
described at length in
<web><ulink url="http://www.amazon.com/exec/obidos/ASIN/8590379825/secbks-20"><citetitle>Programming in Lua, Second Edition</citetitle></ulink>.</web>
<print><citetitle>Programming in Lua, Second Edition</citetitle>.</print>
Basically C modules consist of the
functions they provide to Lua, which have to be of type <ulink url="http://www.lua.org/manual/5.1/manual.html#lua_CFunction">lua_CFunction</ulink>. Additionally they have to contain a function
which is used to actually open the module. By convention these function names are <literal>luaopen_<replaceable>modulename</replaceable></literal>.
A good starting point for writing such modules is provided by
<filename>bit.c</filename><indexterm><primary><varname>bit</varname> NSE module</primary></indexterm>
inside
the <filename>nselib-bin/</filename> subdirectory of Nmap's source tree.
<varname>bit</varname> is a C module already provided by the nselib. C modules
basically are shared libraries which get loaded at runtime by Lua.
</para>
<para>
The Unix build system uses <literal>libtool</literal> for
compilation in a platform independent way. As long as the new module
does not depend on foreign libraries, you should only need to add
<literal><replaceable>modulename</replaceable>.so</literal> to the
<literal>all</literal> and <literal>clean</literal> targets in
<filename>Makefile.in</filename>
and copy and adapt the lines from <filename>bit.so</filename>.
If your module does have dependencies you will most probably have to
add checks for those libraries to <filename>configure.ac</filename>
and put the dependencies inside the <literal>libtool</literal>
commands in <filename>Makefile.in</filename>.
</para>
<para>
Of course, theory and practice are rarely the same. Most of
the trouble building nselib actually comes from the
complications of building shared libraries and not nselib
itself. Linking with static libraries
(e.g. <literal>libnbase</literal>) sometimes leads to
problems with exporting symbols on some platforms (in our
case the x86_64-linux platform).<indexterm><primary>x86_64 architecture</primary></indexterm>
To our knowledge no such
problems occur when linking against already existing shared
libraries.</para>
<para>
The Windows build system requires C module developers to create a
MS Visual Studio Project file for their module
(<filename><replaceable>modulename</replaceable>.vcproj</filename>) inside the
<filename>nselib</filename> subdirectory. On Windows you have to
include the <filename>liblua/</filename> subdirectory as
an additional include path as well as a library search path. In addition
you have to tell the project to link against the
<filename>liblua.lib</filename> static library provided with Nmap.
Other properties of the project should be the same as for other
nselib C modules (e.g. see <filename>nse_bitlib.vcproj</filename>).
Afterwards you have to include the newly created project file in
Nmap's Visual Studio solution file
(<filename>mswin32\nmap.sln</filename>) and make sure that
<filename>nse_bitlib.vcproj</filename> depends on your project,
because it is there that nselib modules get copied to their final destinations and are included in Nmap.
</para>
</sect2>
</sect1>
<indexterm class="endofrange" startref="nse-indexterm"/>

View File

@@ -27,7 +27,6 @@ winbuild:
cd Release && cp -f $(NSE_FILES) ../nmap-$(NMAP_VERSION)/scripts/
mkdir nmap-$(NMAP_VERSION)/nselib
cp -a Release/nselib nmap-$(NMAP_VERSION)
cp -a Release/nselib-bin nmap-$(NMAP_VERSION)
cp winpcap/winpcap-nmap-*.exe nmap-$(NMAP_VERSION)
cp vcredist_x86.exe nmap-$(NMAP_VERSION)
zip -r nmap-$(NMAP_VERSION)-win32.zip nmap-$(NMAP_VERSION)

View File

@@ -167,7 +167,6 @@ Section "Nmap Core Files" SecCore
File ssleay32.dll
File /r /x mswin32 /x .svn ..\..\scripts
File /r /x mswin32 /x .svn ..\Release\nselib
File /r /x mswin32 /x .svn ..\Release\nselib-bin
File ..\icon1.ico
;Store installation folder

View File

@@ -1,30 +0,0 @@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
mandir = @mandir@
libexecdir = @libexecdir@
nselib_bindir = $(libexecdir)/nmap/nselib-bin
CC = @CC@
CPPFLAGS = @CPPFLAGS@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
LIBTOOL= ./libtool
LTFLAGS = --tag=CC --silent
all:
%.so: %.c @LIBTOOL_DEPS@
$(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) -c $*.c
$(LIBTOOL) $(LTFLAGS) --mode=link $(CC) -avoid-version -module -rpath $(nselib_bindir) $(LDFLAGS) -o $*.la $*.lo $(LIBS)
mv .libs/$*.so $*.so
clean:
rm -f *.so *.la *.lo
rm -rf .libs
distclean: clean
rm -f Makefile config.log config.status libtool

6389
nselib-bin/aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

19656
nselib-bin/configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,50 +0,0 @@
AC_PREREQ([2.13])
AC_INIT([nselib], [0.0])
AC_PROG_CC
# we want to compile lua modules written in C - which are shared libraries
# therefore disable building static libs - we shouldn't need them
AC_DISABLE_STATIC
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
AC_SUBST([LIBTOOL])
AC_SUBST([LIBTOOL_DEPS])
AC_CANONICAL_HOST
# Don't bother with --without-liblua because this directory isn't even
# configured if that's the case.
AC_ARG_WITH([liblua],
AC_HELP_STRING([--with-liblua=DIR], [Use an existing (compiled) lua lib from DIR/include and DIR/lib.])
AC_HELP_STRING([--with-liblua=included], [Use the liblua version included with Nmap]),
[ case "$with_liblua" in
yes)
with_liblua=
;;
included)
with_liblua=../liblua
;;
*)
;;
esac ]
)
# If no liblua location was given search for one.
if test "x$with_liblua" = "x"; then
AC_CHECK_HEADER([lua.h],
AC_CHECK_LIB([lua], [lua_call], [system_liblua=yes]))
# If none was found use the included liblua.
if test "$system_liblua" != "yes"; then
with_liblua=../liblua
fi
fi
if test "x$with_liblua" != "x"; then
CPPFLAGS="-I$with_liblua $CPPFLAGS"
LDFLAGS="-L$with_liblua $LDFLAGS"
fi
AC_CONFIG_FILES([Makefile])
AC_OUTPUT