有没有私人api来监控iPhone上的网络流量?

我需要实现一个应用程序来监控iPhone上不同应用程序的入站/出站连接。 我的应用程序将在后台运行,使用苹果的背景多任务function为voip和导航器。 我可以使用私有api,因为我的客户端在appstore上不需要这个应用程序。

谢谢。

我完成了这件事。

我不需要任何私有Api来获取入站/出站活动连接的信息。 它只是你需要知道基本的C编程和一些耐心。

我写信给apple dev论坛,并得到了回复 –

From my perspective most of what I have to say about this issue is covered in the post referenced below. > The way to make progress on this is to: o grab the relevant headers from the Mac OS X SDK o look at the Darwin source for netstat to see how the pieces fit together WARNING: There are serious compatibility risks associated with shipping an app that uses this technique; it's fine to use this for debugging and so on, but I recommend against shipping code like this to end users. 

我一步一步做的是 –

1)从BSD opensource下载的netstat代码 –

2)将其添加到您的新iphone项目中。

3)看,ios sdk中没有一些头文件,所以你需要从opensource.apple.com复制它,并在相关路径下添加你的iphone sdk中的那些 –

 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/include 

我的xcode版本是4.5.2。 所以这是与我的xcode相关的路径。 根据xcodes的版本你可以有不同的路径。无论如何。 并记住在iosSdk和iOSSimulatorSdk中添加这些标头,以便代码可以在设备上和模拟器上运行。

4)你可能会发现netstat代码中的一些小错误,这些错误与查找头文件中的某些结构的定义无关。如果是“struct xunpcb64”.dont wory。 那里有定义。你需要在这些头文件中注释一些“#if!TARGET_OS_EMBEDDED”#else,以便ios sdk可以在那些条件中访问并访问定义。(需要一些尝试和错误。耐心。)

5)最后你将编译你的代码。欢呼!

如果你还没有看到这个,我已经在我的iPhone上成功使用了它。

https://developer.apple.com/library/ios/ipad/#qa/qa1176/_index.html

我意识到这不完全是你想要的。

查看网络活动。 请参阅以下链接 ,这可以通过嗅探网络流量来完成。 你也可以使用Fiddler 。

一般来说,我同意Suneet。 您只需要网络嗅探器。

您可以尝试将WireShark的部分端口(它是开源的,它可以在MacOS上运行)到iOS。 iOS和OS X共享内核的大部分内容,因此如果在iOS上没有明确禁止它,它应该适合您。

WireShark是一个非常大的产品,因此您可能需要寻找另一个可在OS X上运行的开源网络嗅探器。