转://tcpdump抓包实例
基本语法
========
过滤主机
--------
- 抓取所有经过 eth1,目的或源地址是 192.168.1.1 的网络数据
# tcpdump -i eth1 host 192.168.1.1
- 源地址
# tcpdump -i eth1 src host 192.168.1.1
- 目的地址
# tcpdump -i eth1 dst host 192.168.1.1
过滤端口
--------
- 抓取所有经过 eth1,目的或源端口是 25 的网络数据
# tcpdump -i eth1 port 25
- 源端口
# tcpdump -i eth1 src port 25
- 目的端口
# tcpdump -i eth1 dst port 25网络过滤
--------
# tcpdump -i eth1 net 192.168
# tcpdump -i eth1 src net 192.168
# tcpdump -i eth1 dst net 192.168
协议过滤
--------
# tcpdump -i eth1 arp
# tcpdump -i eth1 ip
# tcpdump -i eth1 tcp
# tcpdump -i eth1 udp
# tcpdump -i eth1 icmp
常用表达式
----------
非 : ! or "not" (去掉双引号)
且 : && or "and"
或 : || or "or"
- 抓取所有经过 eth1,目的地址是 192.168.1.254 或 192.168.1.200 端口是 80 的 TCP 数据
# tcpdump -i eth1 '((tcp) and (port 80) and ((dst host 192.168.1.254) or (dst host
192.168.1.200)))'
- 抓取所有经过 eth1,目标 MAC 地址是 00:01:02:03:04:05 的 ICMP 数据
# tcpdump -i eth1 '((icmp) and ((ether dst host 00:01:02:03:04:05)))'
- 抓取所有经过 eth1,目的网络是 192.168,但目的主机不是 192.168.1.200 的 TCP 数据
# tcpdump -i eth1 '((tcp) and ((dst net 192.168) and (not dst host 192.168.1.200)))'
- 只抓 SYN 包
# tcpdump -i eth1 'tcp[tcpflags] = tcp-syn'
- 抓 SYN, ACK
# tcpdump -i eth1 'tcp[tcpflags] & tcp-syn != 0 and tcp[tcpflags] & tcp-ack != 0'
抓 SMTP 数据
----------
# tcpdump -i eth1 '((port 25) and (tcp[(tcp[12]>>2):4] = 0x4d41494c))'
抓取数据区开始为"MAIL"的包,"MAIL"的十六进制为 0x4d41494c。
抓 HTTP GET 数据
--------------
# tcpdump -i eth1 'tcp[(tcp[12]>>2):4] = 0x47455420'
"GET "的十六进制是 47455420
抓 SSH 返回
---------
# tcpdump -i eth1 'tcp[(tcp[12]>>2):4] = 0x5353482D'
"SSH-"的十六进制是 0x5353482D
# tcpdump -i eth1 '(tcp[(tcp[12]>>2):4] = 0x5353482D) and (tcp[((tcp[12]>>2)+4):2]
= 0x312E)'抓老版本的 SSH 返回信息,如"SSH-1.99.."
- 抓 DNS 请求数据
# tcpdump -i eth1 udp dst port 53
其他
----
-c 参数对于运维人员来说也比较常用,因为流量比较大的服务器,靠人工 CTRL+C 还是
抓的太多,于是可以用-c 参数指定抓多少个包。
# time tcpdump -nn -i eth0 'tcp[tcpflags] = tcp-syn' -c 10000 > /dev/null
上面的命令计算抓 10000 个 SYN 包花费多少时间,可以判断访问量大概是多少。
实时抓取端口号8000的GET包,然后写入GET.log
tcpdump -i eth0 '((port 8000) and (tcp[(tcp[12]>>2):4]=0x47455420))' -nnAl -w /tmp/GET.log
转://tcpdump抓包实例的更多相关文章
- [na]tcpdump非常实用的抓包实例
基本语法篇 常用应用: 过滤物理口 过滤某个port/ip/mac 过滤协议 显示ip/mac/port不解析等 过滤mac tcpdump -i eth0 ether host 24:DF:6A:F ...
- linux下利用tcpdump抓包工具排查nginx获取客户端真实IP实例
一.nginx后端负载服务器的API在获取客户端IP时始终只能获取nginx的代理服务器IP,排查nginx配置如下 upstream sms-resp { server ; server ; } s ...
- tcpdump抓包命令
本文转自 : http://www.cnblogs.com/ggjucheng/archive/2012/01/14/2322659.html http://www.itshouce.com.cn/l ...
- tcpdump 抓包
简介 用简单的话来定义tcpdump,就是:dump the traffic on a network,根据使用者的定义对网络上的数据包进行截获的包分析工具. tcpdump可以将网络中传送的数据包的 ...
- [转] Android利用tcpdump抓包
原文链接:http://mysuperbaby.iteye.com/blog/902201 Android利用tcpdump抓包 博客分类: Android AndroidAccessGoHTML ...
- TCPdump抓包命令详解--摘
http://blog.csdn.net/s_k_yliu/article/details/6665673/ http://starsliao.blog.163.com/blog/static/890 ...
- Android手机tcpdump抓包
在开发过程中遇到问题时,无法非常方便的获取到数据包,导致分析解决问题比较麻烦.这里介绍如何在Android手机上实现tcpdump抓包. 1.root机器 在用tcpdump抓包过程中,需要使用 ...
- Wireshark和TcpDump抓包分析心得
Wireshark和 TcpDump抓包分析心得 1. Wireshark与tcpdump介绍 Wireshark是一个网络协议检测工具,支持Windows平台和Unix平台,我一般只在Window ...
- tcpdump 抓包让wireshark来分析
在linux下面用tcpdump 抓包非常方便, 但是抓的包要提取出来进行分析, 还是得用wireshark来过滤分析比较方便. 下面先介绍一下 TCPDUMP 的使用 例:tcpdump host ...
随机推荐
- FCKEditor的使用步骤
在线发布信息难免要用到在线编辑器,下面就说下在线编辑器的使用步骤: 1.下载FCK,这个不说了 2.把ZZGSEditor文件夹放到网站根目录 3.把FredCK.FCKeditorV2.dll文件放 ...
- Cordova - 彻底搞定IOS编译!
操作系统:OSX10.14 XCode:10.1 Cordova:8.1.2 假设已经配置好了Cordova开发环境,Apple ID你也有,XCode也可以正常工作了,那么就可以继续看这篇文章了! ...
- Dependency Walker使用说明 转载
转载地址:http://blog.csdn.net/swort_177/article/details/5426848?reload 在Windows世界中,有无数块活动的大陆,它们都有一个共同的名字 ...
- Vue动态新增对象属性
Vue.set( target, key, value ) 参数: {Object | Array} target {string | number} key {any} value 返回值:设置的值 ...
- 有道云笔记链接——JAVA面向对象的学习
http://note.youdao.com/noteshare?id=cf39a0e493a6b3c7ad5d22204a7e7843
- Why is 'x' in ('x',) faster than 'x' == 'x'?
Question: >>> timeit.timeit("'x' in ('x',)") 0.04869917374131205 >>> tim ...
- Docker 镜像运行时区不准确处理
启动 tomcat 容器时发现容器时间与本地时间不一致,相差 8 个小时 docker run -d --rm -p 8888:8080 tomcat:latest # 查看容器 ID docker ...
- 【代码笔记】Web-ionic单选框
一,效果图. 二,代码. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> ...
- 在vue中赋值的路径没有被编译
当我们跑起来的时候,f12会看到相对路径,但是此时会报错,说找不到图片,这时候有其中一个办法,直接 require进去. 这时候就可以成功显示图片,但是路径会不一样,因为编译出来. 至于如何props ...
- NFS共享权限挂载
mount -t nfs 192.168.2.203:/data/lys /lys -o proto=tcp -o nolock mount 172.16.2.18:/home/arcgisserve ...