帮助在 12.04 上安装 nmap 6.40

帮助在 12.04 上安装 nmap 6.40

我正在尝试安装

我尝试按照 nmap 网站中的说明进行操作:

bzip2 -cd nmap-6.40.tar.bz2 | tar xvf -
cd nmap-6.40
./configure
make
su root
make install

一切运行正常,直到我输入 make 时似乎出现了错误

/nmap-6.40$ make
Compiling liblua
make[1]: Entering directory `/home/qayin/nmap-6.40/liblua'
make[1]: `liblua.a' is up to date.
make[1]: Leaving directory `/home/qayin/nmap-6.40/liblua'
Compiling liblinear
make[1]: Entering directory `/home/qayin/nmap-6.40/liblinear'
make[1]: `liblinear.a' is up to date.
make[1]: Leaving directory `/home/qayin/nmap-6.40/liblinear'
Compiling libpcap
make[1]: Entering directory `/home/qayin/nmap-6.40/libpcap'
VER=`cat ./VERSION`; \
    MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' ./VERSION`; \
    gcc -shared -Wl,-soname,libpcap.so.$MAJOR_VER  \
        -o libpcap.so.$VER pcap-linux.o pcap-usb-linux.o pcap-can-linux.o pcap-netfilter-linux.o fad-getad.o pcap.o inet.o gencode.o optimize.o nametoaddr.o etherent.o savefile.o sf-pcap.o sf-pcap-ng.o pcap-common.o bpf_image.o bpf_dump.o  scanner.o grammar.o bpf_filter.o version.o   
/usr/bin/ld: cannot open output file libpcap.so.1.2.1: Permission denied
collect2: ld returned 1 exit status
make[1]: *** [libpcap.so] Error 1
make[1]: Leaving directory `/home/qayin/nmap-6.40/libpcap'
make: *** [pcap_build] Error 2
qayin@kraken-PC:~/nmap-6.40$ sudo make
Compiling liblua
make[1]: Entering directory `/home/qayin/nmap-6.40/liblua'
make[1]: `liblua.a' is up to date.
make[1]: Leaving directory `/home/qayin/nmap-6.40/liblua'
Compiling liblinear
make[1]: Entering directory `/home/qayin/nmap-6.40/liblinear'
make[1]: `liblinear.a' is up to date.
make[1]: Leaving directory `/home/qayin/nmap-6.40/liblinear'
Compiling libpcap
make[1]: Entering directory `/home/qayin/nmap-6.40/libpcap'
VER=`cat ./VERSION`; \
    MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' ./VERSION`; \
    gcc -shared -Wl,-soname,libpcap.so.$MAJOR_VER  \
        -o libpcap.so.$VER pcap-linux.o pcap-usb-linux.o pcap-can-linux.o pcap-netfilter-linux.o fad-getad.o pcap.o inet.o gencode.o optimize.o nametoaddr.o etherent.o savefile.o sf-pcap.o sf-pcap-ng.o pcap-common.o bpf_image.o bpf_dump.o  scanner.o grammar.o bpf_filter.o version.o   
./config.status --file=pcap-config.tmp:./pcap-config.in
config.status: creating pcap-config.tmp
mv pcap-config.tmp pcap-config
chmod a+x pcap-config
make[1]: Leaving directory `/home/qayin/nmap-6.40/libpcap'
Compiling libpcre
make[1]: Entering directory `/home/qayin/nmap-6.40/libpcre'
make  all-am
make[2]: Entering directory `/home/qayin/nmap-6.40/libpcre'
make[2]: Leaving directory `/home/qayin/nmap-6.40/libpcre'
make[1]: Leaving directory `/home/qayin/nmap-6.40/libpcre'
Compiling libdnet
make[1]: Entering directory `/home/qayin/nmap-6.40/libdnet-stripped'
Making all in include
make[2]: Entering directory `/home/qayin/nmap-6.40/libdnet-stripped/include'
make  all-recursive
make[3]: Entering directory `/home/qayin/nmap-6.40/libdnet-stripped/include'
Making all in dnet
make[4]: Entering directory `/home/qayin/nmap-6.40/libdnet-stripped/include/dnet'
make[4]: Nothing to be done for `all'.
make[4]: Leaving directory `/home/qayin/nmap-6.40/libdnet-stripped/include/dnet'
make[4]: Entering directory `/home/qayin/nmap-6.40/libdnet-stripped/include'
make[4]: Leaving directory `/home/qayin/nmap-6.40/libdnet-stripped/include'
make[3]: Leaving directory `/home/qayin/nmap-6.40/libdnet-stripped/include'
make[2]: Leaving directory `/home/qayin/nmap-6.40/libdnet-stripped/include'
Making all in src
make[2]: Entering directory `/home/qayin/nmap-6.40/libdnet-stripped/src'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/qayin/nmap-6.40/libdnet-stripped/src'
make[2]: Entering directory `/home/qayin/nmap-6.40/libdnet-stripped'
make[2]: Nothing to be done for `all-am'.
make[2]: Leaving directory `/home/qayin/nmap-6.40/libdnet-stripped'
make[1]: Leaving directory `/home/qayin/nmap-6.40/libdnet-stripped'
Compiling libnbase
cd nbase && make
make[1]: Entering directory `/home/qayin/nmap-6.40/nbase'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/qayin/nmap-6.40/nbase'
Compiling libnsock
cd nsock/src && make
make[1]: Entering directory `/home/qayin/nmap-6.40/nsock/src'
cd ../../nbase && make
make[2]: Entering directory `/home/qayin/nmap-6.40/nbase'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/qayin/nmap-6.40/nbase'
make[1]: Leaving directory `/home/qayin/nmap-6.40/nsock/src'
cd ncat && make
make[1]: Entering directory `/home/qayin/nmap-6.40/ncat'
Compiling liblua
make[2]: Entering directory `/home/qayin/nmap-6.40/liblua'
make[2]: `liblua.a' is up to date.
make[2]: Leaving directory `/home/qayin/nmap-6.40/liblua'
Compiling libnsock
cd ../nsock/src && make
make[2]: Entering directory `/home/qayin/nmap-6.40/nsock/src'
cd ../../nbase && make
make[3]: Entering directory `/home/qayin/nmap-6.40/nbase'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/qayin/nmap-6.40/nbase'
make[2]: Leaving directory `/home/qayin/nmap-6.40/nsock/src'
gcc -o test/addrset -g -O2 -Wall -L../libpcap  test/addrset.o ncat_core.o sys_wrap.o util.o ncat_lua.o -ldl -ldl  ../nsock/src/libnsock.a ../nbase/libnbase.a  -lpcap ./../liblua/liblua.a -lm
./../liblua/liblua.a(loadlib.o): In function `ll_sym':
/home/qayin/nmap-6.40/liblua/loadlib.c:142: undefined reference to `dlsym'
./../liblua/liblua.a(loadlib.o): In function `ll_load':
/home/qayin/nmap-6.40/liblua/loadlib.c:135: undefined reference to `dlopen'
./../liblua/liblua.a(loadlib.o): In function `ll_sym':
/home/qayin/nmap-6.40/liblua/loadlib.c:143: undefined reference to `dlerror'
./../liblua/liblua.a(loadlib.o): In function `ll_load':
/home/qayin/nmap-6.40/liblua/loadlib.c:136: undefined reference to `dlerror'
./../liblua/liblua.a(loadlib.o): In function `ll_unloadlib':
/home/qayin/nmap-6.40/liblua/loadlib.c:130: undefined reference to `dlclose'
collect2: ld returned 1 exit status
make[1]: *** [test/addrset] Error 1
make[1]: Leaving directory `/home/qayin/nmap-6.40/ncat'
make: *** [ncat_build] Error 2

无论如何,我尝试继续,su root但由于某种原因,我得到了身份验证失败,所以我sudo su改为这样做,然后它说我是 root,但是make install不起作用,给我重播: make: *** No rule to make targetlibnetutil/libnetutil.a',需要nmap Stop.

答案1

我还没有尝试构建这个版本的 nmap,但根据我以前的经验,ncat 子组件的 Makefile 存在问题,它不遵守与 libdl 相关的 gcc 库链接顺序要求

如果你只需要 nmap 本身,那么最简单的解决方法就是配置不带 ncat 组件的构建,即运行

./configure --without-ncat

然后再次执行makemake install步骤。由于您sudo上次使用了 make 步骤,因此您可能需要再次执行此操作,因为任何目标文件都将以 root 所有权创建 - 但最好修复原始所有权/权限问题。

如果你确实需要构建 ncat 组件,那么你可能必须编辑相应的 Makefile,如下所述在 ubuntuforums.org 上

您可以在以下位置阅读有关库链接顺序的更多信息gcc 文档或者参见链接器顺序 - GCC在 stackoverflow 上

答案2

只需下载 rpm 并运行以下脚本:

alien nmap-6.47-1.x86_64.rpm

然后你将得到要安装的 deb 文件

dpkg -i nmap_6.47-2_amd64.deb

答案3

$ sudo apt-get update
it updates
$ sudo apt-get install nmap
install nmap
$ nmap --version 
tells you the version of nmap

相关内容