Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

iphone

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

like image 698
ebaccount Avatar asked May 28 '09 19:05

ebaccount


3 Answers

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.

like image 181
Rog Avatar answered Sep 19 '22 16:09

Rog


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.

enter image description here

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.

like image 27
chovy Avatar answered Sep 19 '22 16:09

chovy


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.)

like image 27
Chris Lundie Avatar answered Sep 21 '22 16:09

Chris Lundie