Linux -bash: nmap : command not found

时间:2022-08-05
本文章向大家介绍Linux -bash: nmap : command not found,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

Linux nmap 命令 command not found nmap 未找到命令 nmap 命令详解 nmap 命令未找到 nmap 命令安装 - CommandNotFound ⚡️ 坑否

-bash: nmap: command not found
 
#CentOS/RHEL 安装
yum install nmap
#Debian/Ubuntu 安装
apt-get install nmap
#Fedora
sudo dnf install nmap
#Arch Linux
sudo pacman -S nmap
#OpenSUSE
zypper install nmap
#Snap package
sudo snap install nmap
nmap [Scan Type...] [Options] {target specification}

-O:激活操作探测;
-P0:值进行扫描,不ping主机;
-PT:是同TCP的ping;
-sV:探测服务版本信息;
-sP:ping扫描,仅发现目标主机是否存活;
-ps:发送同步(SYN)报文;
-PU:发送udp ping-PE:强制执行直接的ICMPping;
-PB:默认模式,可以使用ICMPping和TCPping;
-6:使用IPv6地址;
-v:得到更多选项信息;
-d:增加调试信息地输出;
-oN:以人们可阅读的格式输出;
-oX:以xml格式向指定文件输出信息;
-oM:以机器可阅读的格式输出;
-A:使用所有高级扫描选项;
--resume:继续上次执行完的扫描;
-P:指定要扫描的端口,可以是一个单独的端口,用逗号隔开多个端口,使用“-”表示端口范围;
-e:在多网络接口Linux系统中,指定扫描使用的网络接口;
-g:将指定的端口作为源端口进行扫描;
--ttl:指定发送的扫描报文的生存期;
--packet-trace:显示扫描过程中收发报文统计;
--scanflags:设置在扫描报文中的TCP标志。
--send-eth/--send-ip 使用原始以太网发送/构造指定IP发送

e.g.

$ nmap -A -T4 www.hexun.com
 
Starting Nmap 6.40 ( http://nmap.org ) at 2020-05-06 12:04 CST
Nmap scan report for www.hexun.com (119.97.159.10)
Host is up (0.026s latency).
Not shown: 983 closed ports
PORT     STATE    SERVICE       VERSION
22/tcp   filtered ssh
23/tcp   filtered telnet
25/tcp   filtered smtp
80/tcp   open     http          nginx
|_http-methods: No Allow or Public header in OPTIONS response (status code 405)
| http-robots.txt: 1 disallowed entry 
|_/*\xA3\xBF*
|_http-title: \xBA\xCD\xD1\xB6\xCD\xF8
135/tcp  filtered msrpc
139/tcp  filtered netbios-ssn
443/tcp  open     http          nginx
|_http-methods: No Allow or Public header in OPTIONS response (status code 400)
|_http-title: 400 The plain HTTP request was sent to HTTPS port
| ssl-cert: Subject: commonName=*.hexun.com/organizationName=Beijing Hexun Online Consulting Co.,Ltd/stateOrProvinceName=Beijing/countryName=CN
| Not valid before: 2019-06-25T00:00:00+00:00
|_Not valid after:  2021-09-23T12:00:00+00:00
|_ssl-date: 2020-05-06T04:04:51+00:00; 0s from local time.
| tls-nextprotoneg: 
|_  http/1.1
445/tcp  filtered microsoft-ds
1433/tcp filtered ms-sql-s
1434/tcp filtered ms-sql-m
2000/tcp open     tcpwrapped
3306/tcp filtered mysql
3389/tcp filtered ms-wbt-server
4444/tcp filtered krb524
5060/tcp open     tcpwrapped
5800/tcp filtered vnc-http
5900/tcp filtered vnc
 
Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 13.29 seconds
$ nmap www.hexun.com
 
Starting Nmap 6.40 ( http://nmap.org ) at 2020-05-06 12:08 CST
Nmap scan report for www.hexun.com (119.97.159.10)
Host is up (0.025s latency).
Not shown: 983 closed ports
PORT     STATE    SERVICE
22/tcp   filtered ssh
23/tcp   filtered telnet
25/tcp   filtered smtp
80/tcp   open     http
135/tcp  filtered msrpc
139/tcp  filtered netbios-ssn
443/tcp  open     https
445/tcp  filtered microsoft-ds
1433/tcp filtered ms-sql-s
1434/tcp filtered ms-sql-m
2000/tcp open     cisco-sccp
3306/tcp filtered mysql
3389/tcp filtered ms-wbt-server
4444/tcp filtered krb524
5060/tcp open     sip
5800/tcp filtered vnc-http
5900/tcp filtered vnc
 
Nmap done: 1 IP address (1 host up) scanned in 1.65 seconds
$ nmap -v www.hexun.com
 
Starting Nmap 6.40 ( http://nmap.org ) at 2020-05-06 12:09 CST
Initiating Ping Scan at 12:09
Scanning www.hexun.com (119.97.159.10) [2 ports]
Completed Ping Scan at 12:09, 0.03s elapsed (1 total hosts)
Initiating Parallel DNS resolution of 1 host. at 12:09
Completed Parallel DNS resolution of 1 host. at 12:09, 0.00s elapsed
Initiating Connect Scan at 12:09
Scanning www.hexun.com (119.97.159.10) [1000 ports]
Discovered open port 80/tcp on 119.97.159.10
Discovered open port 443/tcp on 119.97.159.10
Discovered open port 2000/tcp on 119.97.159.10
Discovered open port 5060/tcp on 119.97.159.10
Completed Connect Scan at 12:09, 1.47s elapsed (1000 total ports)
Nmap scan report for www.hexun.com (119.97.159.10)
Host is up (0.026s latency).
Not shown: 983 closed ports
PORT     STATE    SERVICE
22/tcp   filtered ssh
23/tcp   filtered telnet
25/tcp   filtered smtp
80/tcp   open     http
135/tcp  filtered msrpc
139/tcp  filtered netbios-ssn
443/tcp  open     https
445/tcp  filtered microsoft-ds
1433/tcp filtered ms-sql-s
1434/tcp filtered ms-sql-m
2000/tcp open     cisco-sccp
3306/tcp filtered mysql
3389/tcp filtered ms-wbt-server
4444/tcp filtered krb524
5060/tcp open     sip
5800/tcp filtered vnc-http
5900/tcp filtered vnc
 
Read data files from: /usr/bin/../share/nmap
Nmap done: 1 IP address (1 host up) scanned in 1.53 seconds
nmap -sT ip_address #TCP contect()端口扫描
nmap -p 1-65535 -T4 -A -v ip #扫描1-65535(基本覆盖所有端口)
nmap -sU ip_address #UDP端口扫描
输出命令
-oN 文件名 #输出普通文件
-oX 文件名.xml #输出xml文件

原文地址:https://www.cnblogs.com/chang09/p/16555597.html