简体   繁体   中英

How To Monitor Network Activity From Within App?

I'm trying to monitor network activity on my iPhone from within an app I'm developing. Does iOS support a netstat-like command or something similar that can tell me what what inbound and outbound connections are active?

After some searching I found Apple's code used for netstat .

Everything you need in the void protopr(uint32_t proto, char *name, int af) function.

I tested on the device and sysctlbyname("net.inet.tcp.pcblist_n",...) works.

That should be all you need.

I can't test this but from what I gather you will have to use sysctl in combination with sysctlnametomib or alternatively sysctlbyname for this:

sysctlbyname("net.inet.tcp.pcblist", ...)

and/or

sysctlbyname("net.inet.udp.pcblist", ...)

You can use burp suite for this purpose, By this you can inspect all the http data going through your phone. You have to install this in your mac/ubuntu/windows machine, and then create a proxy server with help of this tool and then modify your wifi setting in iphone/android phone to use your pc as proxy, and then it will capture all the input/output traffic.

Read full instruction here - http://www.engadget.com/2011/02/21/how-to-inspect-ioss-http-traffic-without-spending-a-dime/

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