1. 将手机通过usb口连在mac电脑上
2. 通过xcode查看手机的uuid,如 rvictl -s f7f41359d97aa34487f574a4db2e028dfd4f7aa
3. 打开终端,开启虚拟网口
$rvictl -s f7f41359d97aa34487f574a4db2e028dfd4f7aa
Starting device f7f41359d97aa34487f574a4db2e028dfd4f7aa [SUCCEEDED] with interface rvi0 (rvi0就是虚拟网口的名字,抓包的时候需要使用)
$sudo tcpdump -i rvi0 -w trace.pcap
tcpdump: WARNING: rvi0: That device doesn't support promiscuous mode
(BIOCPROMISC: Operation not supported on socket)
tcpdump: listening on rvi0, link-type PKTAP (Packet Tap), capture size 262144 bytes
4. 然后就可以在手机上运行app,执行你想要的操作了。所有报文会存储在trace.pcap文件上
5. 抓包结束后,记得删除虚拟接口
$ rvictl -x f7f41359d97aa34487f574a4db2e028dfd4f7aa
参考资料: