某视频app的学习记录
本文为看雪论坛优秀文章
看雪论坛作者ID:xwtwho
一
软硬件环境
二
坑(时间顺序)
3、网络请求相关
之前就看到有使用Cronet模块,想看下实现过程,下过源码(https://github.com/hanpfei/chromium-net),一个是发现跟app使用的并不完全相同,再一个还要自己编译模块,就想到直接使用抖音的模块。
if (!StringsKt.contains$default((CharSequence) name, (CharSequence) "__MACOSX", false, 2, (Object) null)) {
StringsKt.contains((CharSequence) str, (CharSequence) "?", false))public final class FrontMethodFragment$onCreateFailed$1 extends Lambda implements Function0<Unit> {Lambda要带上Lambda<Unit> // 初始化引擎 CronetEngine.Builder myBuilder = new CronetEngine.Builder(getApplicationContext()); CronetEngine cronetEngine = myBuilder.build();
// 创建请求线程 Executor executor = Executors.newSingleThreadExecutor();
// 创建UrlRequest strUrl="http://10.0.0.217/about"; UrlRequest.Builder requestBuilder = cronetEngine.newUrlRequestBuilder( strUrl, new MyUrlRequestCallback(), executor); requestBuilder.addHeader("testHeader","testValue"); UrlRequest request = requestBuilder.build();
// 发起请求 request.start();class MyUrlRequestCallback extends UrlRequest.Callback { private static final String TAG = "ttttt MyUrlRequestCallback";
@Override public void onRedirectReceived(UrlRequest request, UrlResponseInfo info, String newLocationUrl) { android.util.Log.i(TAG, "onRedirectReceived method called."); // You should call the request.followRedirect() method to continue // processing the request. request.followRedirect(); }
@Override public void onResponseStarted(UrlRequest request, UrlResponseInfo info) { //这个函数只会调用一次 android.util.Log.i(TAG, "onResponseStarted method called."); // You should call the request.read() method before the request can be // further processed. The following instruction provides a ByteBuffer object // with a capacity of 102400 bytes to the read() method. request.read(ByteBuffer.allocateDirect(102400)); }
@Override public void onFailed(UrlRequest urlRequest, UrlResponseInfo urlResponseInfo, CronetException cronetException) {
}
@Override public void onReadCompleted(UrlRequest request, UrlResponseInfo info, ByteBuffer byteBuffer) { //这个会调用多次 android.util.Log.i(TAG, "onReadCompleted method called."); // You should keep reading the request until there's no more data. request.read(ByteBuffer.allocateDirect(102400)); }
@Override public void onSucceeded(UrlRequest request, UrlResponseInfo info, String str) { android.util.Log.i(TAG, "onSucceeded method called."); }}// Certificate is not trusted due to non-trusted root of the certificate// chain.static int NO_TRUSTED_ROOT = -2;private <T> T getStaticServiceImplReal(Class<T> cls) { PatchProxyResult proxy = PatchProxy.proxy(new Object[]{cls}, this, changeQuickRedirect, false, 95671); if (proxy.isSupported) { return (T) proxy.result; }
int iHashCode=cls.getName().hashCode(); switch (iHashCode) {FeedActionApi.f71204b.diggItem("7018000130007633191", "7018000130007633191", 1, 0).get(); if (C9859c.m21219a()) { jSONObject.put("netClientType", "CronetClient"); } else { jSONObject.put("netClientType", "TTOkhttp3Client"); }三
学习总结
1、学习了JAV代理类使用,大厂设计模式。
2、熟悉了Cronet模块。
看雪ID:xwtwho
https://bbs.pediy.com/user-home-44250.htm
# 往期推荐
1.Chrom V8分析入门——Google CTF2018 justintime分析
4.人人都可以拯救正版硬件受害者(Jlink提示Clone)
5.frida内存检索svc指令查找sendto和recvfrom进行hook抓包
球分享
球点赞
球在看
点击“阅读原文”,了解更多!