IOS 上的 Swizzling 低级 TCP 方法
我正在尝试找到一种方法来获取有关进出我的 IOS 应用程序的所有 TCP 流量的信息。该应用程序非常简单,由单个 UIWebView 对象组成。
我尝试在 NSURLRequest 上使用 swizzling,但运气不佳 - 我的 requestWithURL: 版本在我手动调用 NSURLRequest 时被调用,但在转到 UIWebView 中的页面时似乎从未被调用,所以我猜它在幕后使用了不同的对象。
所以我想尝试挂钩 CFSocket 函数,但这些函数不是类的一部分,所以我不确定如何混合它们(或者是否可能)。
有没有什么方法可以连接到 IOS 上的 C 函数,或者我可以尝试混合以访问 TCP(甚至 HTTP)流量的任何其他 API?
我还尝试使用 NSURLCache,它适用于大多数主 .html 页面,但很多人都发现了 .cs 文件,而其他一些文件似乎没有通过缓存。
谢谢!
I am trying to find a way to get information on all the TCP traffic to and from my IOS application. The application is very simple and composed of a single UIWebView object.
I tried to use swizzling on NSURLRequest but didn't have much luck with that - my version of requestWithURL: is called when I call it NSURLRequest manually, but it doesn't seem to ever be called when going to a page in UIWebView, so I guess its using a different object under the covers.
So I thought of trying to hook into CFSocket functions, but those are not part of a class so I'm not sure how to swizzle them (or if its even possible).
Are there any ways to hook into C functions on IOS, or any other APIs I can try to swizzle to access TCP (or even HTTP) traffic?
I also tried using NSURLCache, which works for most of the main .html pages, but as many people have found out the .cs files and some others don't seem to go through the cache.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需设置一个外部代理(如 Fiddler 或 Charles)来监控 http 流量。或者更复杂的是,Wireshark 适用于任何 TCP 流量。这将比您正在尝试的更容易并且更强大。
Just set up an external proxy like Fiddler or Charles to monitor http traffic. Or more complicated, Wireshark for any tcp traffic. This will be much easier than what you're trying and more powerful.