如何挂钩/监控集成第三方库的网络呼叫? [英] How to hook/monitor network calls made by integrated third party libraries?

查看:84
本文介绍了如何挂钩/监控集成第三方库的网络呼叫?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在开展广告调解项目,该项目需要将任意数量的第三方库集成到更大的框架中。所有库都有联系外部服务器并返回有效的Android布局或失败的常见行为,但我们可以不假设或控制其内部功能。

We are working on an ad mediation project that requires integrating an arbitrary number of third party libraries into a larger framework. All libraries have the common behavior of contacting an external server and returning a valid Android layout or failing, but we can assume no knowledge or control over their internal functions.

服务器从启动呼叫序列的框架/应用程序的角度来看,第三方库执行的交互是不透明的。这可能允许任何库实现基于应用程序的权限访问和传输敏感信息。

The server interaction carried out by a third-party library is opaque from the standpoint of the framework/app that initiates the call sequence. This potentially allows any library implemented to access and transmit sensitive information based on the permissions of an app.

目标是让调用进程能够捕获http请求在传递到网络之前由框架/应用程序级别的集成库创建。理想的情况是处理和潜在阻止请求的能力。另一种方法是找到一种记录请求并为可操作分析提供反馈的方法。

The objective is for the calling process to be able to capture the http request being made by an integrated library at the framework/app level before it is passed out to the network. Ideal case would be the ability to process and potentially block the request. An alternative would be to find a way to log requests and provide feedback for actionable analysis.

我在文档或搜索论坛中找不到任何有用的信息。这在Android中是否可行?

I'm not finding anything helpful in the docs or searching forums. Is this possible in Android?

推荐答案

创建自定义URLStreamHandlerFactory和URLStreamHandler并通过调用URL.setURLStreamHandlerFactory从应用程序onCreate()设置它这个)
它将允许捕获甚至由第三方库制作的所有网络流量。

Create custom URLStreamHandlerFactory and URLStreamHandler and set it from application onCreate() by calling URL.setURLStreamHandlerFactory(this) it will allow to capture all network traffic even made by third party library.

这篇关于如何挂钩/监控集成第三方库的网络呼叫?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆