对ios设备方便的抓包与查看方法

  Apple在官网中给出了如何利用apple的设备进行抓包的详细说明,其中提到的使用remote virtual interface(rvi)的方法十分方便。使用rvi的功能需要使用mac系统,而手头mac系统上面并没有安装wireshark软件,为了方便地进行数据包的查看,采用了和前一篇博文中提到的android系统中抓包方法类似,也就是使用netcat(nc)软件在windows和mac系统之间建立一个tcp连接,将mac系统命令行中tcpdump的输出直接通过已经建立的tcp连接发送到windows系统下的wireshark软件中。具体步骤如下

  • mac系统中的操作[1]
$ # First get the current list of interfaces.
$ ifconfig -l
lo0 gif0 stf0 en0 en1 p2p0 fw0 ppp0 utun0
$ # Then run the tool with the UDID of the device.
$ # UDID可以通过xcode下的organizer或者itunes中设备的summary下面查看到.
$ rvictl -s 74bd53c647548234ddcef0ee3abee616005051ed
 
Starting device 74bd53c647548234ddcef0ee3abee616005051ed [SUCCEEDED]
 
$ # Get the list of interfaces again, and you can see the new virtual
$ # network interface, rvi0, added by the previous command.
$ ifconfig -l
lo0 gif0 stf0 en0 en1 p2p0 fw0 ppp0 utun0 rvi0
Starting device 74bd53c647548234ddcef0ee3abee616005051ed [SUCCEEDED]

$ # Get the list of interfaces again, and you can see the new virtual
$ # network interface, rvi0, added by the previous command.
$ ifconfig -l
lo0 gif0 stf0 en0 en1 p2p0 fw0 ppp0 utun0 rvi0
$ #查看本机地址
$ ifconfig

$使用tcpdump输出到nc
$sudo tcpdump -n -s 0 -w - | nc -l 7100
  • windows系统中的操作:以管理员权限运行命令行程序,进入nc保存目录,输入  
nc mac系统主机的IP地址 7100 | wireshark -k -S -i -
  • 参考

  [1]http://developer.apple.com/library/mac/#qa/qa1176/_index.html

原文地址:https://www.cnblogs.com/jiangz/p/3019490.html