CentOS 7安装最新版本NMAP

nmap是一款非常实用的扫描工具,适用于linux、windows、mac三大主流平台。
直接yum安装nmap

# yum install nmap
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
base                                                                                                                                                                                                                  | 3.6 kB  00:00:00     
docker-ce-stable                                                                                                                                                                                                      | 3.5 kB  00:00:00     
extras                                                                                                                                                                                                                | 3.4 kB  00:00:00     
updates                                                                                                                                                                                                               | 3.4 kB  00:00:00     
(1/2): extras/7/x86_64/primary_db                                                                                                                                                                                     | 156 kB  00:00:00     
(2/2): updates/7/x86_64/primary_db                                                                                                                                                                                    | 1.4 MB  00:00:01     
Resolving Dependencies
--> Running transaction check
---> Package nmap.x86_64 2:6.40-16.el7 will be installed
--> Processing Dependency: nmap-ncat = 2:6.40-16.el7 for package: 2:nmap-6.40-16.el7.x86_64
--> Processing Dependency: libpcap.so.1()(64bit) for package: 2:nmap-6.40-16.el7.x86_64
--> Running transaction check
---> Package libpcap.x86_64 14:1.5.3-11.el7 will be installed
---> Package nmap-ncat.x86_64 2:6.40-16.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
 Package                                                   Arch                                                   Version                                                         Repository                                            Size
=============================================================================================================================================================================================================================================
Installing:
 nmap                                                      x86_64                                                 2:6.40-16.el7                                                   base                                                 3.9 M
Installing for dependencies:
 libpcap                                                   x86_64                                                 14:1.5.3-11.el7                                                 base                                                 138 k
 nmap-ncat                                                 x86_64                                                 2:6.40-16.el7                                                   base                                                 206 k

Transaction Summary
=============================================================================================================================================================================================================================================
Install  1 Package (+2 Dependent packages)

Total download size: 4.3 M
Installed size: 17 M
Is this ok [y/d/N]: y
Downloading packages:
(1/3): libpcap-1.5.3-11.el7.x86_64.rpm                                                                                                                                                                                | 138 kB  00:00:00     
(2/3): nmap-ncat-6.40-16.el7.x86_64.rpm                                                                                                                                                                               | 206 kB  00:00:00     
(3/3): nmap-6.40-16.el7.x86_64.rpm                                                                                                                                                                                    | 3.9 MB  00:00:02     
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                        2.1 MB/s | 4.3 MB  00:00:02     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 14:libpcap-1.5.3-11.el7.x86_64                                                                                                                                                                                            1/3 
  Installing : 2:nmap-ncat-6.40-16.el7.x86_64                                                                                                                                                                                            2/3 
  Installing : 2:nmap-6.40-16.el7.x86_64                                                                                                                                                                                                 3/3 
  Verifying  : 14:libpcap-1.5.3-11.el7.x86_64                                                                                                                                                                                            1/3 
  Verifying  : 2:nmap-ncat-6.40-16.el7.x86_64                                                                                                                                                                                            2/3 
  Verifying  : 2:nmap-6.40-16.el7.x86_64                                                                                                                                                                                                 3/3 

Installed:
  nmap.x86_64 2:6.40-16.el7                                                                                                                                                                                                                  

Dependency Installed:
  libpcap.x86_64 14:1.5.3-11.el7                                                                                        nmap-ncat.x86_64 2:6.40-16.el7                                                                                       

Complete!

发现并不是最新版本

# yum info nmap
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
Installed Packages
Name        : nmap
Arch        : x86_64
Epoch       : 2
Version     : 6.40
Release     : 16.el7
Size        : 16 M
Repo        : installed
From repo   : base
Summary     : Network exploration tool and security scanner
URL         : http://nmap.org/
License     : GPLv2 and LGPLv2+ and GPLv2+ and BSD
Description : Nmap is a utility for network exploration or security auditing.  It supports
            : ping scanning (determine which hosts are up), many port scanning techniques
            : (determine what services the hosts are offering), and TCP/IP fingerprinting
            : (remote host operating system identification). Nmap also offers flexible target
            : and port specification, decoy scanning, determination of TCP sequence
            : predictability characteristics, reverse-identd scanning, and more. In addition
            : to the classic command-line nmap executable, the Nmap suite includes a flexible
            : data transfer, redirection, and debugging tool (netcat utility ncat), a utility
            : for comparing scan results (ndiff), and a packet generation and response analysis
            : tool (nping).

升级一下看看,发现也不能直接升级

# yum update nmap
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
No packages marked for update

直接yum卸载掉

# yum remove nmap
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package nmap.x86_64 2:6.40-16.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
 Package                                               Arch                                                    Version                                                          Repository                                              Size
=============================================================================================================================================================================================================================================
Removing:
 nmap                                                  x86_64                                                  2:6.40-16.el7                                                    @base                                                   16 M

Transaction Summary
=============================================================================================================================================================================================================================================
Remove  1 Package

Installed size: 16 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : 2:nmap-6.40-16.el7.x86_64                                                                                                                                                                                                 1/1 
  Verifying  : 2:nmap-6.40-16.el7.x86_64                                                                                                                                                                                                 1/1 

Removed:
  nmap.x86_64 2:6.40-16.el7                                                                                                                                                                                                                  

Complete!

按官方文档只鹅接rpm安装最新版本的nmap

# rpm -vhU https://nmap.org/dist/nmap-7.70-1.x86_64.rpm
Retrieving https://nmap.org/dist/nmap-7.70-1.x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:nmap-2:7.70-1                    ################################# [100%]

安装成功

#nmap --version
Nmap version 7.70 ( https://nmap.org )
Platform: x86_64-redhat-linux-gnu
Compiled with: liblua-5.3.3 openssl-1.0.2n nmap-libssh2-1.8.0 nmap-libz-1.2.8 nmap-libpcre-7.6 nmap-libpcap-1.7.3 nmap-libdnet-1.12 ipv6
Compiled without:
Available nsock engines: epoll poll select

查看一下本机开放的端口情况

# nmap localhost 
Starting Nmap 7.70 ( https://nmap.org ) at 2019-01-30 04:21 EST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000026s latency).
Other addresses for localhost (not scanned): ::1
Not shown: 998 closed ports
PORT   STATE SERVICE
22/tcp open  ssh
25/tcp open  smtp

Nmap done: 1 IP address (1 host up) scanned in 0.15 seconds

NMAP功能强大,各位好好用吧!

猜你喜欢

转载自blog.csdn.net/timonium/article/details/86706246