frida-okhttp3
一个简单的构造方法
喜欢有趣的人
function hook_okhttp3() {// 1. frida Hook java层的代码必须包裹在Java.perform中,Java.perform会将Hook Java相关API准备就绪。Java.perform(function () {// 2. 准备相应类库,用于后续调用,前两个库是Android自带类库,后三个是使用Okhttp网络库的情况下才有的类var ByteString = Java.use("com.android.okhttp.okio.ByteString");var Buffer = Java.use("com.android.okhttp.okio.Buffer");var Interceptor = Java.use("okhttp3.Interceptor");var ArrayList = Java.use("java.util.ArrayList");var OkHttpClient = Java.use("okhttp3.OkHttpClient");// 注册一个Java类var MyInterceptor = Java.registerClass({name: "okhttp3.MyInterceptor",implements: [Interceptor],methods: {intercept: function (chain) {var request = chain.request();try {console.log("MyInterceptor.intercept onEnter:", request, "\nrequest headers:\n", request.headers());var requestBody = request.body();var contentLength = requestBody ? requestBody.contentLength() : 0;if (contentLength > 0) {var BufferObj = Buffer.$new();requestBody.writeTo(BufferObj);try {console.log("\nrequest body String:\n", BufferObj.readString(), "\n");} catch (error) {try {console.log("\nrequest body ByteString:\n", ByteString.of(BufferObj.readByteArray()).hex(), "\n");} catch (error) {console.log("error 1:", error);}}}} catch (error) {console.log("error 2:", error);}var response = chain.proceed(request);try {console.log("MyInterceptor.intercept onLeave:", response, "\nresponse headers:\n", response.headers());var responseBody = response.body();var contentLength = responseBody ? responseBody.contentLength() : 0;if (contentLength > 0) {console.log("\nresponsecontentLength:", contentLength, "responseBody:", responseBody, "\n");var ContentType = response.headers().get("Content-Type");console.log("ContentType:", ContentType);if (ContentType.indexOf("video") == -1) {if (ContentType.indexOf("application") == 0) {var source = responseBody.source();if (ContentType.indexOf("application/zip") != 0) {try {console.log("\nresponse.body StringClass\n", source.readUtf8(), "\n");} catch (error) {try {console.log("\nresponse.body ByteString\n", source.readByteString().hex(), "\n");} catch (error) {console.log("error 4:", error);}}}}}}} catch (error) {console.log("error 3:", error);}return response;}}});OkHttpClient.$init.overload('okhttp3.OkHttpClient$Builder').implementation = function (Builder) {console.log("OkHttpClient.$init:", this, Java.cast(Builder.interceptors(), ArrayList));this.$init(Builder);};var MyInterceptorObj = MyInterceptor.$new();var Builder = Java.use("okhttp3.OkHttpClient$Builder");console.log(Builder);Builder.build.implementation = function () {this.interceptors().clear();this.interceptors().add(MyInterceptorObj);var result = this.build();return result;};Builder.addInterceptor.implementation = function (interceptor) {this.interceptors().clear();this.interceptors().add(MyInterceptorObj);return this;};console.log("hook_okhttp3...");});
}
hook_okhttp3();
frida-okhttp3相关推荐
- 基于 frida 实现的逆向工具包 hooker
hooker逆向工作台:https://github.com/CreditTone/hooker hooker 是一个基于 frida 实现的 逆向工具包.为逆向开发人员提供统一化的脚本包管理方式.通 ...
- 转载:实用 FRIDA 进阶 --- objection :内存漫游、hook anywhere、抓包
转载:实用FRIDA进阶:内存漫游.hook anywhere.抓包:https://www.anquanke.com/post/id/197657 frida github 地址:https://g ...
- :实用 FRIDA 进阶 --- objection :内存漫游、hook anywhere、抓包
转载:实用FRIDA进阶:内存漫游.hook anywhere.抓包:https://www.anquanke.com/post/id/197657 frida github 地址:https://g ...
- 精品连载丨安卓 App 逆向课程之四 frida 注入 Okhttp 抓包中篇
本篇文章接上篇. 2. Okhttp3 自吐抓包 我们将一次请求的request大致结构罗列如下. •请求方法 GET.POST.PUT.DELETE.HEAD 等•URL•使用的协议版本 HTTP/ ...
- app反爬测试之apk逆向分析-frida
前言: 目前为止,很多app的防护基本也还是用的ssl pinning检测证书. 因为,目前的app要么不用ssl,要么用就是一般的ssl,基本就是在手机上装个相关软件 的代理即可,而且这个代理基本就 ...
- 精品连载丨安卓 App 逆向课程之五 frida 注入 Okhttp 抓包下篇
本篇内容是「肉丝姐教你安卓逆向之 frida 注入 Okhttp 抓包系列的第三篇,建议配合前两篇一起阅读,效果更佳. 精品连载丨安卓 App 逆向课程之三 frida 注入 Okhttp 抓包上篇 ...
- 用frida突破SSL pinning抓包
python任意版本安装frida,手机端使用的mumu模拟器,其他的也可以 pip install frida adb 连接 mumu模拟器 查看内核 adb shell su cat /proc/ ...
- 基于Frida实现OKHttp的抓包
前言 在进行逆向分析时候,抓包有很多种方式,今天带来了一种新方法对基于OKHttp实现的网络请求进行抓包,该方法有一定的局限性. Frida Frida是一款轻量级的Hook框架,Java与Nativ ...
- 利用Frida手动绕过Android-APP证书校验
HTTPS证书校验绕过有很多成熟的方法,比如SSL Unpinning,JustTrustMe等,但是遇到混淆过或写在so里的校验的时候是无效的. 本文写的可能会有些啰嗦,记录了我整个尝试的思路.没有 ...
- Static interface methods are only supported starting with Android N (--min-api 24): void okhttp3.log
错误内容如下 Error: Static interface methods are only supported starting with Android N (--min-api 24): vo ...
最新文章
- String , StringBuffer 和 StringBuilder 区别
- php namespace原理作用,php 命名空间(namespace)原理与用法实例小结
- linux wget 进度条多行的解决办法
- 来自天秤座的梦想_天秤座:单线全自动机器学习
- 如何看待自己写的烂代码
- XSS漏洞(跨站脚本)
- jQ1.5中的事件系统(低版本的事件系统)
- swift 笔记 (二十一) —— 高级运算符
- 软件项目管理 案例教程复习要点
- WinMTR-路由追踪软件
- 计算机五笔是什么时候学的吗,电脑五笔输入法怎么学
- JVM性能调优(一)(JVM参数详解、内存分析等)
- 压缩气体储能领域新势力「嘉泰新能」获AC资本天使轮投资!
- JPBC部分API说明
- Pubmedy的使用教程
- Oracle 权限详解(grant,revoke)
- windows版Transporter使用方法
- A-level Computer Science 计算机科学学习笔记/经验分享/教学 (1):考试流程和大纲
- Linux pwm_fan 风扇驱动
- iOS 13 LaunchScreen.storyboard 启动图屏幕适配