Tcpdump抓取 Android 网络包
2016-05-17 20:22
435 查看
Android平台要抓TCP数据包,可以使用TCPdump工具。
1 下载Android 平台的 Tcpdump
http://www.tcpdump.org
2 push 到手机中
你需要root权限,
adb root
adb remount
adb push 目录\tcpdump /data/local/tcpdump
adb shell chmod 6755 /data/local/tcpdump
3 抓包
adb shell tcpdump -w /data/capture0.pcap
adb shell tcpdump ip 10.1.2.13 and 10.2.3.12 -w /data/capture1.pcap
或者
adb shell tcpdump -p -s 0 -w /sdcard/capture.pcap
# "-p": disable promiscuous mode (doesn't work anyway)
# "-s 0": capture the entire packet
# "-w": write packets to a file (rather than printing to stdout)
... do whatever you want to capture,then ^C to stop it ...
4 导出日志
adb pull /data/capture0.pcap /home/linghu/
adb pull /sdcard/capture.pcap /home/linghu/
5 分析
使用Wireshark 下载wireshark查看数据包,地址是http://www.wireshark.org/download.html。
1 下载Android 平台的 Tcpdump
http://www.tcpdump.org
2 push 到手机中
你需要root权限,
adb root
adb remount
adb push 目录\tcpdump /data/local/tcpdump
adb shell chmod 6755 /data/local/tcpdump
3 抓包
adb shell tcpdump -w /data/capture0.pcap
adb shell tcpdump ip 10.1.2.13 and 10.2.3.12 -w /data/capture1.pcap
或者
adb shell tcpdump -p -s 0 -w /sdcard/capture.pcap
# "-p": disable promiscuous mode (doesn't work anyway)
# "-s 0": capture the entire packet
# "-w": write packets to a file (rather than printing to stdout)
... do whatever you want to capture,then ^C to stop it ...
4 导出日志
adb pull /data/capture0.pcap /home/linghu/
adb pull /sdcard/capture.pcap /home/linghu/
5 分析
使用Wireshark 下载wireshark查看数据包,地址是http://www.wireshark.org/download.html。
相关文章推荐
- TCP的连接建立与连接释放
- 网络 协议与分层结构 的学习心得
- Socket编程------模拟QQ聊天(TCP)
- 网络编程之FIFO
- https 常见问题一 PKIX path building failed
- TCP协议的建立与释放及TCP的有限状态基
- 关于Android6.0API,找不到org.apache.http.Header问题记录。
- Okhttp session持久化
- Android HttpConnection获取图片太大 处理办法 防止OOM
- UNIX网络编程之管道
- httpclient 访问https
- Okhttp session持久化
- HttpClient 教程 (一)
- 自己动手从网络加载,缓存,压缩图片
- Android 网络请求框架android-async-http简单使用
- nodejs:本地文件夹http服务器http-server
- http状态码301与302的区别
- android http——网络请求二次封装的框架设计
- Swift学习笔记(3)iOS 9 中的网络请求
- Linux网络编程--进程间通信(一)