LINUX 抓包工具Tcpdump下载安装

  1. 下载安装包

官网地址:https://www.tcpdump.org/

百度网盘地址:

链接:https://pan.baidu.com/s/12EPV0alwzz3_wGuT1Swv2g

提取码:pyck

由于tcpdump依赖libpcap因此两个安装包都需要下载

2.安装

2.1首先安装libpcap

tar -zxvf libpcap-1.10.3.tar.gz 
cd libpcap-1.10.3
./configure
make 
make install

2.2 然后安装tcpdump

cd tcpdump-4.99.3
 ./configure
make
make install

2.3可能出现的错误

2.2.1 缺少gcc 环境

错误一:configure: error: no acceptable C compiler found in $PATH

解决:安装gcc

unzip gcc.zip
cd gcc
rpm -Uvh *.rpm --nodeps --force

2.2.2 缺少flex bison

错误:configure: error: Neither flex nor lex was found.

解决:安装

m4下载地址: http://ftp.gnu.org/gnu/m4/ 1.4.19

cd m4-1.4.19
bash ./configure
make
make install

bison下载地址:http://ftp.gnu.org/gnu/bison/ bison-3.7.6.tar.gz

cd bison-3.7.6
bash ./configure
make                           
make install

flex下载地址: https://github.com/westes/flex/releases flex-2.6.4.tar.gz

cd flex-2.6.4
bash ./configure
make
make insatll

3.使用

 
# 1. 假如想要截获主机“192.168.171.110”任何收到和发出的数据包,能够使用如下命令: 

tcpdump host 192.168.171.110 



# 2. 假如想要截获在主机“192.168.200.155”和主机“192.168.191.123”或“192.168.191.124”之间传递的数据包,能够使用如下命令: 
tcpdump host 192.168.200.155 and \(192.168.191.123 or 192.168.191.124\) 

# 3. 假如想要截获主机“192.168.200.155”和除主机“9.186.10.58”外任何其他主机之间通信的IP数据包,能够使用如下命令: 
tcpdump ip host 192.168.200.155 and ! 192.168.191.123


# 4. 假如想要截获主机“9.185.10.57”接收或发出的FTP(端口号为21)数据包,能够使用如下命令: 
tcpdump tcp port 21 and host 9.185.10.57  

# 5. 假如怀疑系统正受到拒绝服务(DoS)攻击,网络管理员能够通过截获发往本机的任何ICMP包,来确定现在是否有大量的ping指令流向服务器,此时就能够使用下面的命令: 
tcpdump icmp -n -i eth0

猜你喜欢

转载自blog.csdn.net/weixin_40455437/article/details/129177691