6、tcpdump
<p>tcpdump 命令</p>
<pre><code>接下来就是抓包了,执行命令:
tcpdump -p -vv -s 0 -w /sdcard/tcpdump/cap.pcap
抓的感觉差不多了就直接CTRL+C终止,然后再执行如下命令将捕获文件传回本地:
adb pull /sdcard/cap.pcap d:/cap.pcap
这里我们可以使用yum来直接安装它
yum install -y tcpdump
如果忘记了这个软件的用法,我们可以使用 tcpdump --help 来查看一下使用方法
例如我截取本机(192.168.31.147)和主机114.114.114.114之间的数据
tcpdump -n -i eth0 host 192.168.31.147 and 114.114.114.114
还有截取全部进入服务器的数据可以使用以下的格式
tcpdump -n -i eth0 dst 192.168.31.147
或者服务器有多个IP 可以使用参数
tcpdump -n -i eth0 dst 192.168.31.147 or 192.168.31.157
我们抓取全部进入服务器的TCP数据包使用以下的格式,大家可以参考下
tcpdump -n -i eth0 dst 192.168.31.147 or 192.168.31.157 and tcp
从本机出去的数据包
tcpdump -n -i eth0 src 192.168.31.147 or 192.168.31.157
tcpdump -n -i eth0 src 192.168.31.147 or 192.168.31.157 and port ! 22 and tcp
或者可以条件可以是OR 和 AND 配合使用即可筛选出更好的结果。
adb shell
tcpdump -C 100M -i any -p -vv -w /sdcard/catch.cap
adb pull /sdcard/catch.cap F:/catch.cap
monkey 模拟测试:
adb shell monkey -p 应用的包名 -v -v -v 1000(次数) &gt; D:/test.txt </code></pre>