Android利用tcpdump抓包
16lz
2021-12-04
Android利用tcpdump抓包
Instructions
http://source.android.com/porting/tcpdump.html
Source Code and Documents
http://www.tcpdump.org/
Compiled Binary Download
http://www.strazzere.com/android/tcpdump
数据包分析工具Wireshark
http://www.wireshark.org/download.html
Installing tcpdump
Pushing the binary to an existing device
Download tcpdump from http://www.tcpdump.org/, then execute:
adb root adb remount adb push /wherever/you/put/tcpdump /system/xbin/tcpdump adb shell chmod 6755 /data/local/tmp/tcpdump
Running tcpdump
You need to have root access on your device.
Batch mode capture
The typical procedure is to capture packets to a file and then examine the file on the desktop, as illustrated below:
Cmd代码
- adbshelltcpdump-iany-p-s0-w/sdcard/capture.pcap
- #"-iany":listenonanynetworkinterface
- #"-p":disablepromiscuousmode(doesn'tworkanyway)
- #"-s0":capturetheentirepacket
- #"-w":writepacketstoafile(ratherthanprintingtostdout)
- ...dowhateveryouwanttocapture,then^Ctostopit...
- adbpull/sdcard/capture.pcap.
You can run tcpdump in the background from an interactive shell or from Terminal. By default, tcpdump captures all traffic without filtering. If you prefer, add an expression like port 80 to the tcpdump command line.
Real time packet monitoring
Execute the following if you would like to watch packets go by rather than capturing them to a file (-n skips DNS lookups. -s 0 captures the entire packet rather than just the header):
Cmd代码
- adbshelltcpdump-n-s0
Typical tcpdump options apply. For example, if you want to see HTTP traffic:
先把内容放这,有空来做些整理和说明。
更多相关文章
- android带图片的AlertDialog和文件管理器(代码)
- 最常用的GitHub—— Android(安卓)开源项目整理(精品)
- Android中隐藏ActionBar的方法
- Android去掉头部标题
- Android屏幕自适应的四种方法
- Android(安卓)Camera使用小结
- Android中的visibility属性的区别
- android 字体&颜色
- Android(安卓)Notification的使用