29. Linux网络抓包——nmap,tcpdump

1.        nmap工具检测开放端口

(1)nmap包含四项基本功能:主机发现(Host Discovery);端口扫描(Port Scanning);版本侦测(Version Detection);操作系统侦测(Operating System Detection);

[root@WWcentos ~]# nmap www.baidu.com

Starting Nmap 6.40 ( http://nmap.org ) at 2022-08-18 16:54 CST
Nmap scan report for www.baidu.com (36.152.44.96)
Host is up (0.0022s latency).
Other addresses for www.baidu.com (not scanned): 36.152.44.95
Not shown: 998 filtered ports
PORT    STATE SERVICE
80/tcp  open  http
443/tcp open  https

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

注意:这是一个不安全的命令,是用来扫描他人服务器的,用于公司内部或者是局域网内。通常服务器都会有防火墙。

例1:扫描指定IP开放端口

[root@WWcentos ~]# nmap -v 192.168.137.128

Starting Nmap 6.40 ( http://nmap.org ) at 2022-08-19 17:48 CST
Initiating Parallel DNS resolution of 1 host. at 17:48
Completed Parallel DNS resolution of 1 host. at 17:48, 0.01s elapsed
Initiating SYN Stealth Scan at 17:48
Scanning 192.168.137.128 (192.168.137.128) [1000 ports]
Discovered open port 22/tcp on 192.168.137.128
Discovered open port 111/tcp on 192.168.137.128
Completed SYN Stealth Scan at 17:48, 1.61s elapsed (1000 total ports)
Nmap scan report for 192.168.137.128 (192.168.137.128)
Host is up (0.000028s latency).
Not shown: 998 closed ports
PORT    STATE SERVICE
22/tcp  open  ssh
111/tcp open  rpcbind

Read data files from: /usr/bin/../share/nmap
Nmap done: 1 IP address (1 host up) scanned in 1.65 seconds
           Raw packets sent: 1061 (46.684KB) | Rcvd: 2124 (89.212KB)

例2:网段内存活的机器:

[root@WWcentos ~]# nmap -sP 192.168.137.0/24

Starting Nmap 6.40 ( http://nmap.org ) at 2022-08-19 18:31 CST
Nmap scan report for 192.168.137.1 (192.168.137.1)
Host is up (0.000061s latency).
MAC Address: 00:50:56:C0:00:08 (VMware)
Nmap scan report for 192.168.137.2 (192.168.137.2)
Host is up (0.00012s latency).
MAC Address: 00:50:56:E1:65:46 (VMware)
Nmap scan report for 192.168.137.254 (192.168.137.254)
Host is up (-0.11s latency).
MAC Address: 00:50:56:E9:EA:03 (VMware)
Nmap scan report for 192.168.137.128 (192.168.137.128)
Host is up.
Nmap done: 256 IP addresses (4 hosts up) scanned in 2.10 seconds

例3:扫描指定IP的指定端口:

[root@WWcentos ~]# nmap -p 80 192.168.137.128

Starting Nmap 6.40 ( http://nmap.org ) at 2022-08-19 18:32 CST
Nmap scan report for 192.168.137.128 (192.168.137.128)
Host is up (0.000043s latency).
PORT   STATE  SERVICE
80/tcp closed http

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

例4:探测主机操作系统:

[root@WWcentos ~]# nmap -O 192.168.137.128

Starting Nmap 6.40 ( http://nmap.org ) at 2022-08-19 18:37 CST
Nmap scan report for 192.168.137.128 (192.168.137.128)
Host is up (0.000028s latency).
Not shown: 998 closed ports
PORT    STATE SERVICE
22/tcp  open  ssh
111/tcp open  rpcbind
Device type: general purpose
Running: Linux 3.X
OS CPE: cpe:/o:linux:linux_kernel:3
OS details: Linux 3.7 - 3.9
Network Distance: 0 hops
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值