How to track network calls made using iOS Simulator

I am trying to control calls from an application to my server, as Firebug does. I could not find a way to see this in iOS Simulator or in xCode.

Is there a way to do this without sniffing all the traffic? If not, what tool would you suggest?

+100
xcode networking ios-simulator network-monitoring
Jun 20 '12 at 21:19
source share
11 answers

Personally, I use Charles for this kind of material.
When it is turned on, it will track every network request, displaying the details of the extended request, including SSL support and a different request / response format, such as JSON, etc.

You can also configure it to use only requests to specific servers, and not all traffic.

This is commercial software, but there is a trial version, and IMHO is a definitively great tool.

+80
Jun 20 2018-12-12T00:
source share
+28
Jun 20 2018-12-12T00:
source share

The man in the middle proxy, like other answers, is a good solution if you want to see only HTTP / HTTPS traffic. Burp Suite is pretty good. However, it can be painful to set up. I do not know how you could convince the simulator to talk to him. You may need to install the proxy server on your local Mac into your proxy server instance so that it can intercept, since the simulator will use the local Mac environment.

The best solution for batch sniffing (although it only works for real iOS devices, not a simulator), I found using rvictl . This blog post has a good entry. Basically you:

 rvictl -s <iphone-uid-from-xcode-organizer> 

Then you sniff the interface that it creates using Wireshark (or your favorite tool), and when you finish working with the interface:

 rvictl -x <iphone-uid-from-xcode-organizer> 

This is good, because if you want to pack sniff on a simulator, you have to wade through traffic to your local Mac, but rvictl creates a virtual interface that shows you traffic from your iOS device. 'connected to your USB port.

+24
Jun 21 2018-12-12T00:
source share

A free open source proxy that runs easily on a Mac, mitmproxy .

The website includes links to the Mac binary, as well as source code on Github.

The docs contain a very useful introduction for uploading a certificate to a test device to view HTTPS traffic.

Not quite as GUI-tastic as Charles, but it does everything I need, and its free and supported. Good stuff and pretty simple if you used some command line tools before.

UPDATE: I just noticed on the website that mitmproxy is available as a homebrew installation. It couldn't be simpler.

+18
May 23 '13 at 3:30
source share

Xcode provides CFNetwork diagnostic logging. Apple doc

To enable it, add CFNETWORK_DIAGNOSTICS = 3 to the environment variable

This will show requests from the application with its headers and body.

+5
Sep 11 '18 at 1:23
source share

If you have a cable connection and a Mac, then there is a simple and powerful method:

  • install the free Wireshark, make sure it can capture devices with (and you need to do this after every restart of the computer !):

    sudo chmod 644 / dev / bpf *

  • Now share your network with Wi-Fi. System Preferences> Sharing> Internet Sharing. Make sure you have “Share your connections with: Ethernet” and use: Wi-Fi. You can also set up some Wi-Fi protection, this does not interfere with your data monitoring.

  • Connect the phone to the newly created network. I often need a few attempts. If your phone doesn’t want to connect, turn on Wi-Fi Mac, then repeat step 2 above and be patient.

  • Launch Wireshark, capturing your wireless interface with Wireshark, this is probably "en1". Filter the required IP addresses and / or ports. When you find a package of interest, select it, right-click (context menu)> Follow TCP Stream, and you will see a nice textual representation of requests and responses.

And best of all: the exact same trick also works for Android!

+3
Sep 11 '12 at 10:11
source share
  1. Install WireShark
  2. get IP address from xcode network monitor
  3. listen to wifi interface
  4. set the ip.addr filter == 192.168.1.122 in WireShark
+1
Feb 14 '18 at 19:36
source share

Wireshark is

Choose your interface

enter image description here

Add filter start capture

enter image description here




testing

Click on any action or button that will call GET / POST / PUT / DELETE

You will see it listed in Wireshark

enter image description here

If you want to know more information about one particular package, just select it and follow> HTTP Stream .

enter image description here

hope this helps others !!

+1
09 Oct '18 at 13:16
source share

A good solution if you're used to chrome verification tools is the Pony debugger: https://github.com/square/PonyDebugger

It’s a little painful to set up, but as soon as you do it well. Remember to use Safari instead of Chrome to use it.

0
Jun 14 '15 at 11:13
source share
0
Feb 01 '17 at 8:39 on
source share

I am using Netfox. It is very easy to use and integrate. You can use it on the simulator and device. It shows all requests and answers. It supports JSON, XML, HTML, images and other types of responses. You can exchange requests, answers and the full journal using standard IOS exchange formats (Gmail, WhatsApp, email, slack, sms, etc.).

You can check on GitHub: https://github.com/kasketis/netfox

Netfox provides a quick view of all network requests made by your iOS or OSX application. It captures all requests - of course yours, requests from third-party libraries (such as AFNetworking, Alamofire or others), UIWebViews, etc.

0
Jan 11 '19 at 7:05
source share



All Articles