简体   繁体   中英

Capturing network traffic while the application is running on iPhone and connected to xcode

Is there any way I can capture network traffic (using application like Ethereal, on Mac ) while the application is running on iPhone and connected to xcode

Thanks

Connect you mac using an ethernet cable. Share your network connection on the mac over your AirPort. Attach the iPhone to your Mac's ad-hoc network.

Run Wireshark or HTTPScoop on your mac and you will be able to see all traffic from the iPhone.

I'm no aware of any way to do this for the WAN connection though. I'd be surprised if it is possible.

To capture packets from your iPhone using Wireshark, you have to first get your device id for the phone from iTunes. Plug in your iPhone via USB to your Mac...then open iTunes and click the iPhone icon in top navbar.

在此处输入图片说明

You can't copy the UUID, so you have to write it down manually. After you have the UUID, you'll need to mount the device.

Open a terminal and type: rvictl -s <device-id>

I created an alias in ~/.bash_aliases as alias mntios='rvictl -s <device-id>' -- as long as you have the same phone your device UUID won't change, even if you re-install the OS.

Once you have the device mounted startup wireshark. brew install wireshark (see: http://brew.sh )

One of the network adaptors should be rvi0 -- this is the network interface for your iPhone.

Now you can capture packets -- double click it to start capturing.

If you want to filter for specific urls you can type a filter like: http.request.full_uri contains <string-in-url> to filter requests.

On your computer, run an HTTP debugging proxy like Charles (Mac) or Fiddler2 (Windows). In the phone's wi-fi settings, turn on the HTTP proxy, entering your computer's IP address and the port number of the proxy. Make the sure the proxy is configured to allow connections from your phone. (It may allow localhost-only by default.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM