diff --git a/.gitignore b/.gitignore index 514dcd6..4e0fd3d 100644 --- a/.gitignore +++ b/.gitignore @@ -23,5 +23,3 @@ logs/ data/doc/ data/test/ .vscode/ -com.* -cn.com.* diff --git a/JUSTTRUSTME.md b/JUSTTRUSTME.md new file mode 100644 index 0000000..cfa809e --- /dev/null +++ b/JUSTTRUSTME.md @@ -0,0 +1,94 @@ +# Twitter实战测试 + +### 不使用just_trust_me情况下,抓包失败展示 +![抓包失败展示.png-443.6kB][2] + +### spawn方式启动just_trust_me.js +建议任何app都以spawn方式启动just_trust_me.js。不是建议!是必须,因为要在app完成初始化之前hook住所有的hook点,只有spawn模式下才能做到,attach时机太晚了。所以大家明白? +![启动just_trust_me.gif-2756.5kB][3] + + + +### 启动just_trust_me.js之后正常抓包展示 +久违的请求出来了!!!看!!! +![启动just_trust_me之后.gif-2307.9kB][4] + + +# 某头条资讯APP实战测试 + +### 启动just_trust_me.js +![WechatIMG417.png-1098.4kB][5] + +### 正常抓包展示 +![qutoutiao_result.gif-2120.1kB][6] + + +# 某买菜APP实战测试 + +### 启动just_trust_me.js +![WechatIMG420.png-1185.2kB][7] + +### 正常抓包展示 +![WechatIMG422.png-763.4kB][8] + + +#### 就是这么的简单粗暴,我们继续...... + +# 某汽车资讯APP实战测试 +### 启动just_trust_me.js +![111.png-1099.8kB][9] + +### 正常抓包展示 +![222.png-772.2kB][10] + +# 某国内免费小说APP实战测试 +### 启动just_trust_me.js +![333.png-1054.4kB][11] + +### 正常抓包展示 +![444.png-678.5kB][12] + +# 某宝购物APP +### 启动just_trust_me.js +![666.png-1151.4kB][13] + +### 正常抓包展示 +![555.png-879.3kB][14] + + +还要测吗?这个frida版本的just_trust_me怎么样?有些okhttp库在编译的时候混淆了,你可以通过[just_trust_me_okhttp_hook_finder.js](https://github.com/CreditTone/hooker/blob/master/js/just_trust_me_okhttp_hook_finder.js)把混淆类找回来。如何使用just_trust_me_okhttp_hook_finder请看《实现frida版的JustTrustMe(三)frida版JustTrustMe升级和混淆对抗》 + + +# 再次强调实现frida版JustTrustMe的意义 + +### 快速使用 + 不用我说了吧,大家上面都看到了。xposed有我frida这么洒脱吗?批量刷机都是问题吧?frida只要你手机root即可,这才叫活好不粘人!!! + +### frida的反检测性比xposed好很多 + xposed虽然有许多山寨版,在某些方面魔改可以对抗一些检测。但是依然是投入产出比不高,付出了那么多精力结果反检测性并没有实质性的上去。原因是xposed在设计的时候就走错了,等他发现基于替换zygote进程孵化容易被检测的时候已经晚了。所以xposed一直是错着往前!感兴趣的去看我《实现frida版的JustTrustMe(一)JustTrustMe官方源码学习》在开头讲的。 + +### 对抗混淆 + 我提供了[just_trust_me_okhttp_hook_finder.js](https://github.com/CreditTone/hooker/blob/master/com.twitter.android/just_trust_me_okhttp_hook_finder.js)使你可以快速定位到okhttp[3-4]的混淆点,让你可以快速对每个app进行定制。 + +### frida可定制性好 + frida方面你只要会js就可以修改[just_trust_me.js](https://github.com/CreditTone/hooker/blob/master/com.twitter.android/just_trust_me.js),而xposed要求你至少会基本的java、android开发和熟悉xposed框架api。 + +# 后记 +没有100%能把所有包都抓住,都要基于每个app的反抓包策略进行一些调整。还有包括双向认证,需要在抓包工具上配置客户端证书、还有要vpn转发的、还有走私有协议的是不能用httpproxy类的抓包工具来抓包的等等吧。但是我会尽最大可能,让大家在操作相对简单的情况下帮大家抓到包。节省大家一点点时间,工具的本质就是提效。懒人出科技就是这样! + + + + [1]: http://static.zybuluo.com/1273568669/0gjhwhbgg8yw6nyot1lgsfrw/WechatIMG415.png + [2]: http://static.zybuluo.com/1273568669/pakmqbet9bfkthi3tn1420dk/%E6%8A%93%E5%8C%85%E5%A4%B1%E8%B4%A5%E5%B1%95%E7%A4%BA.png + [3]: http://static.zybuluo.com/1273568669/ayyj2o1o6m9ndluea7p4uaal/%E5%90%AF%E5%8A%A8just_trust_me.gif + [4]: http://static.zybuluo.com/1273568669/vhrma5jzvzjyjtwit99ojxtn/%E5%90%AF%E5%8A%A8just_trust_me%E4%B9%8B%E5%90%8E.gif + [5]: http://static.zybuluo.com/1273568669/al811jvk2act05mhvyzpywp8/WechatIMG417.png + [6]: http://static.zybuluo.com/1273568669/xufqyh60yjfutidit3bbarf1/qutoutiao_result.gif + [7]: http://static.zybuluo.com/1273568669/agierqyhvh78b6vt2m25rs2a/WechatIMG420.png + [8]: http://static.zybuluo.com/1273568669/6xy4b84vnch2i1zjbfu5iqiy/WechatIMG422.png + [9]: http://static.zybuluo.com/1273568669/pmaug9o12xyaofd6kf7vl6z3/111.png + [10]: http://static.zybuluo.com/1273568669/xyf0czutgr1ho2vuxswe5tk9/222.png + [11]: http://static.zybuluo.com/1273568669/qvzlycuwjkfil7i0mz7765sh/333.png + [12]: http://static.zybuluo.com/1273568669/1e6ykjjfsqf8kr4u7d9jldff/444.png + [13]: http://static.zybuluo.com/1273568669/lnikbsd36yq6q8zfw3kp0b5g/666.png + [14]: http://static.zybuluo.com/1273568669/pt49hc31pjy8del9ssh9s2iv/555.png \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..29cac8c --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2021, guozhong + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index fc045ea..367b0c2 100644 --- a/README.md +++ b/README.md @@ -1,1129 +1,748 @@ -[](https://mseep.ai/app/credittone-hooker) +### 欢迎使用hooker逆向工作台 -免责声明 -本项目的所有内容仅供学习与技术交流使用,旨在帮助开发者理解移动应用的结构和工作原理。 +hooker是一个基于frida实现的逆向工具包。为逆向开发人员提供统一化的脚本包管理方式、通杀脚本、自动化生成hook脚本、内存漫游探测activity和service、frida版JustTrustMe。 -本项目不包含任何针对特定应用的破解操作或侵权内容。 -针对某些app存在的简单解包技术内容在各大技术论坛网站均大量存在,并无对这些app造成实际损害 -本项目无意协助任何非法用途,包括但不限于绕过版权保护、修改应用功能或获取未经授权的数据。 -请确保在使用本项目工具时遵守相关法律法规,并仅用于个人学习或研究目的。 +# [hooker开源协议](https://github.com/CreditTone/hooker/blob/master/LICENSE.md) +https://github.com/CreditTone/hooker/blob/master/LICENSE.md -
简体中文 | English
+hooker使用[Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0)开源协议,协议核心规范如下 -# 欢迎使用hooker逆向工作台 - - - - - + 1.授权使用者免费使用个人专利 -hooker是一个基于frida实现的逆向工具包。旨在为安卓逆向开发人员提供一个舒适的命令行界面和一些常用的通杀脚本、自动化生成hook脚本、内存漫游探测activity和service、frida版JustTrustMe、boringssl unpinning全网app通杀 + 2.使用者必须放置协议说明 + 3.使用者需要对修改部分声明 + 4.禁止用作者的名号进行商业广告 + + 5.原作者不承担代码使用后风险 + + +本项目仅作为学习使用,不参与任何入侵、破解计算机信息系统的行为。如有影响您app信息安全的地方,请立即与我联系删除,谢谢!邮箱:1273568669@qq.com + + +### radar增强项目源码 +https://github.com/CreditTone/radar4hooker -为什么你需要hooker? ================= -* [1. frida版JustTrustMe,通杀全网APP,且作者一直在持续维护升级](#12-frida版JustTrustMe包括boringgssl) -* [2. 嵌入式webserver支持把App内部能力快速暴露成HTTP接口,便于做自动化和接口化](#7-嵌入式webserver) -* [3. 快捷设置socks5代理,无需额外安装socksdroid等三方app实现无感知代理](#11-快捷设置socks5无感代理) -
+# 快速定位
+##### [自动化生成frida hook脚本](#j---生成指定类的hook脚本)
+
+##### [frida版just_trust_me](#11-just_trust_mejs)
+##### [frida版just_trust_me实战测试报告](https://github.com/CreditTone/hooker/blob/master/JUSTTRUSTME.md)
----
+##### [disable_sslpinning](#7-disable_sslpinning)
目录
=================
-* [快速开始](#快速开始)
+* [hooker和frida、objection有什么不同](#hooker和frida-objection有什么不同)
+* [hooker环境部署](#环境部署)
* [1. git clone项目](#1-git-clone项目)
- * [2. 安装依赖](#2-安装python3依赖)
- * [3. root手机usb连接](#3-root手机usb连接PC)
- * [4. 启动hooker](#4-启动hooker)
- * [5. 输入调试应用包名](#5-输入调试应用包名)
- * [6. 查看help信息](#6-查看help信息)
- * [7. 嵌入式webserver](#7-嵌入式webserver)
- * [8. 自动化生成frida脚本](#8-自动化生成frida脚本)
- * [9. 列出所有frida脚本](#9-列出应用目录所有frida脚本)
- * [10. attach执行frida脚本](#10-attach执行frida脚本)
- * [11. 快捷设置socks5无感代理](#11-快捷设置socks5无感代理)
- * [12. frida版JustTrustMe](#12-frida版JustTrustMe包括boringgssl)
- * [13. spawn执行frida脚本](#13-spawn执行frida脚本)
- * [14. 取消代理设置](#14-取消代理设置)
- * [15. 重启app](#15-重启app)
- * [16. 获取uid和pid](#16-获取uid和pid)
- * [17. pull文件](#17-pull文件)
- * [18. r0capture](#18-r0capture)
- * [19. hooker自动升级](#19-upgrade)
-* [开发手机API接口](#开发手机api接口)
-* [hooker原生提供的操作API](#hooker原生提供的操作api)
-* [应用工作目录脚本](#应用工作目录脚本)
- * [url.js](#urljs)
- * [just_trust_me.js](#just_trust_mejs)
- * [activity_events.js](#activity_eventsjs)
- * [click.js](#clickjs)
- * [android_ui.js](#android_uijs)
- * [keystore_dump.js](#keystore_dumpjs)
- * [edit_text.js](#edit_textjs)
- * [hook_register_natives.js](#hook_register_nativesjs)
- * [text_view.js](#text_viewjs)
- * [ssl_log.js](#ssllogjs)
- * [just_trust_me_for_ios.js](#just_trust_me_for_iosjs)
- * [dump_dex.js](#dump_dexjs)
- * [trace_init_proc.js](#trace_init_procjs)
- * [hook_artmethod_register.js](#hook_artmethod_registerjs)
- * [find_anit_frida_so.js](#find_anit_frida_sojs)
- * [jni_method_trace.js](#hook_jni_method_tracejs)
- * [replace_dlsym_get_pthread_create.js](#replace_dlsym_get_pthread_createjs)
- * [find_boringssl_custom_verify_func.js](#find_boringssl_custom_verify_funcjs)
- * [get_device_info.js](#get_device_infojs)
- * [apk_shell_scanner.js](#apk_shell_scannerjs)
- * [bypass_frida_svc_detect.js](#bypass_frida_svc_detectjs)
- * [bypass_root_detect.js](#bypass_root_detectjs)
- * [bypass_vpn_detect.js](#bypass_vpn_detectjs)
- * [hook_encryption_algo.js](#hook_encryption_algojs)
- * [hook_encryption_algo2.js](#hook_encryption_algo2js)
- * [webview_enable_debug.js](#webview_enable_debugjs)
-* [Windows安装WSL](#windows安装wsl)
- * [1. 安装wsl ubuntn24.04](#1-安装wsl-ubuntn2404)
- * [2. 进入wsl,配置代理](#2-进入wsl配置代理)
- * [3. 安装python3.8和frida](#3-安装python38和frida)
-* [自定义frida-server](#自定义frida-server)
-* [hooker命令行快捷键](#hooker命令行快捷键)
-
-
-
-手机保证root,无需任何手动启动frida-server等一切配置,hooker会帮你搞定一切。x86架构的模拟器不兼容
-
-# Mac/Linux配置hooker运行环境
-
-Windows请先完成[WSL安装](#windows%E5%AE%89%E8%A3%85wsl),然后跳回到这里
+ * [2. 安装依赖](#2-安装依赖)
+ * [3. 手机连接adb](#3-手机连接adb)
+ * [4. 手机开发环境部署](#4-手机开发环境部署)
+ * [5. 指定fridaserver端口的手机开发环境部署](#5-指定fridaserver端口的手机开发环境部署)
+ * [6. 部署之后手机的增强功能](#6-部署之后手机的增强功能)
+* [快速开始](#快速开始)
+ * [1. 查看可调试进程](#1-查看可调试进程)
+ * [2. attach一个应用](#2-attach一个应用)
+ * [3. 应用工作目录](#3-应用工作目录)
+* [应用工作目录的命令](#应用工作目录的命令)
+ * [1. hooking](#1-hooking)
+ * [2. attach](#2-attach)
+ * [3. spawn](#3-spawn)
+ * [4. objection](#4-objection)
+ * [5. xinitdeploy](#5-xinitdeploy)
+ * [6. kill](#6-kill)
+ * [7. disable_sslpinning](#7-disable_sslpinning)
+* [应用工作目录的通杀脚本](#应用工作目录的通杀脚本)
+ * [1. url.js](#1-urljs)
+ * [2. activity_events.js](#2-activity_eventsjs)
+ * [3. click.js](#3-clickjs)
+ * [4. android_ui.js](#4-android_uijs)
+ * [5. keystore_dump.js](#5-keystore_dumpjs)
+ * [6. edit_text.js](#6-edit_textjs)
+ * [7. text_view.js](#7-text_viewjs)
+ * [8. ssl_log.js](#8-ssl_logjs)
+ * [9. object_store.js](#9-object_storejs)
+ * [10. hook_RN.js](#10-hook_RNjs)
+ * [11. just_trust_me.js](#11-just_trust_mejs)
+ * [12. just_trust_me_okhttp_hook_finder.js](#12-just_trust_me_okhttp_hook_finderjs)
+* [hooker调试命令行](#hooker调试命令行)
+ * [a-打印Activity栈](#a---打印activity栈)
+ * [b-打印Service栈](#b---打印Service栈)
+ * [c-扫描指定Object](#c---扫描指定Object)
+ * [d-展开Object[]、List或Map](#d---%E5%B1%95%E5%BC%80objectlist%E6%88%96map)
+ * [v-以View方式查看对象](#v---以view的方式查看对象)
+ * [e-检测类在内存中是否存在](#e---检测类在内存中是否存在)
+ * [s-正则表达式扫描类](#s---正则表达式扫描类)
+ * [j-生成指定类的hook脚本](#j---生成指定类的hook脚本)
+ * [k-生成字符串hook脚本](#k---%E7%94%9F%E6%88%90%E5%AD%97%E7%AC%A6%E4%B8%B2hook%E8%84%9A%E6%9C%AC)
+* [hooker高级应用](#hooker高级应用)
+ * [radar.dex](#radardex)
+ * [脚本的内置函数](#脚本的内置函数)
+ * [1. loadDexfile(dexfile)](#1-loaddexfiledexfile)
+ * [2. checkLoadDex(className,dexfile)](#2-checkloaddexclassname-dexfile)
+ * [3. loadXinitDexfile(dexfile)](#3-loadxinitdexfiledexfile)
+ * [4. loadXRadarDexfile()](#4-loadxradardexfile)
+ * [5. fastTojson(javaObject)](#5-fasttojsonjavaobject)
+ * [6. getPrettyString(javaObject)](#6-getprettystringjavaobject)
+ * [7. getField(javaObject, fieldName)](#7-getfieldjavaobject-fieldname)
+ * [8. storeObjectAndLog(javaObject)](#8-storeobjectandlogjavaobject)
+ * [原生ui自动化](#原生ui自动化)
+ * [1. startActivity(activityName)](#1-startactivityactivityname)
+ * [2. contextStartActivity(activityName)](#1-startactivityactivityname)
+ * [3. contextStartActivity(activityName)](#1-startactivityactivityname)
+ * [4. home()](#1-startactivityactivityname)
+ * [5. back()](#1-startactivityactivityname)
+ * [6. finishCurrentActivity()](#1-startactivityactivityname)
+ * [7. clickByText(text)](#1-startactivityactivityname)
+ * [8. clickById(id)](#1-startactivityactivityname)
+ * [9. hover(x,y,upStepLength)](#1-startactivityactivityname)
+ * [10. viewTree()](#1-startactivityactivityname)
+ * [远程frida支持](#远程frida支持)
+* [更新教程](#更新教程)
+ * [1. clone最新项目](#1-clone最新项目)
+ * [2. 方式一覆盖核心文件到你的hooker](#2-方式一覆盖核心文件到你的hooker)
+ * [3. 方式二覆盖你的应用工作目录到最新hooker](#3-方式二覆盖你的应用工作目录到最新hooker)
+
+# hooker和frida、objection有什么不同
+- 职责不同:frida注重打造调试引擎、objection注重将frida的api简单封装一下让你好快速上手frida。而hooker是重新站在一个安卓应用开发和安卓逆向工程师的角度去打造的更加专业Android逆向工作台,重新定义了逆向android的工作方式。
+- 封装不同:frida是基于gumjs(V8)、C/C++封装的调试引擎,用于动态Hook跟踪、拦截和主动调用函数等。hooker是基于frida作为引擎和自己打造的Dex库(radar)调用Android Framework层代码完成的。
+- 交互方式不一样:frida和objection只有attach上才能操作各种指令,而hooker提供shell命令行交互式让你可以通过jadx进行动静结合分析。
+- 更注提供重Android逆向思路和线索:frida和objection没有对任何Android Freamwork层的hook和能主动调用代码点位进行封装,这使得难以有逆向思路。而hooker的几乎所有命令都是围绕Android Freamwork进行封装,让一个即使没有Android开发经验的人也能快速找到逆向分析思路。
+- hook脚本产出方式不一样:frida你需要先进行很多语法方面的学习,才能完成对各种类的各种方法进行frida脚本的编写。hooker不需要你了解frida语法细节,比如你只需通过j okhttp3.OkHttpClient:newCall 就可以生成一个hook okhttp3.OkHttpClient类的newCall方法的脚本, 即使对于任何一个被混淆的类操作也是如此。(你应该把更多的时间和精力放在逆向思路上,而不是熟悉某些语法上。)
+- 提供操作原生AndroidUI功能:你可以./attach每个app目录下的android_ui.js脚本,它提供了通过ViewId、ViewText找到Android原生的View并点击,或者你想强制打开某个Activity(比如某个界面只有会员才能进入,这时候你就可以采用Android"原生代码"打开的方式)。
+
+# 环境部署
+前言:hooker仅支持在Linux和MacOS下运行,并且现在和将来都不会支持windows操作系统!windows做开发是没有灵魂的!
### 1. git clone项目
```shell
-stephen@Mac:~$ git clone https://github.com/CreditTone/hooker.git
-stephen@Mac:~$ cd hooker
+stephen@ubuntu:~$ git clone https://github.com/CreditTone/hooker.git
+stephen@ubuntu:~$ cd hooker
+stephen@ubuntu:~$ ls
+colorful.py com.mokee.aegis mobile-deploy.tar
+com.alibaba.wireless com.sankuai.meituan org.mokee.lawnchair
+com.changba com.sdiread.kt.ktandroid org.mokee.weatherservice
+com.google.android.youtube com.smile.gifmaker __pycache__
+com.jifen.qukan com.ss.android.article.news radar.dex
+com.jzg.jzgoto.phone com.ss.android.ugc.aweme README.md
+com.koudai.weidian.buyer com.tencent.karaoke run_env.py
+com.kugou.shiqutouch com.tencent.mm sogou.mobile.explorer
+com.lululemon.shop hooker spider.py
+com.meicai.mall hooker.py traceJNI
+com.meitu.meipaimv js xapk
+com.miui.screenrecorder mobile-deploy.sh xinitdeploy.py
```
-### 2. 安装python3依赖
+### 2. 安装依赖
```shell
-stephen@Mac:~/hooker$ pip3 install -r requirements.txt
+stephen@ubuntu:~/hooker$ pip3 install -r requirements.txt
```
-### 3. root手机usb连接PC
+### 3. 手机连接adb
```shell
-stephen@Mac:~/hooker$ adb devices
+stephen@ubuntu:~/hooker$ adb devices
List of devices attached
FA77C0301476 device
```
-### 4. 启动hooker
-
-这里注意,不要用绝对路径去执行,一定要cd到hooker目录下执行python3 hooker.py
+### 4. 手机开发环境部署
+如果你的手机已经启动了frida-server,可以忽略这步。
-hooker启动后将收集所有可调试app的信息,字段含义如下
-- PID:当前app的主进程id,如果app没有启动则为0
-- APP:app的名称
-- IDENTIFIER:app的包名
-- EXIST_REVERSE_DIRECTORY:如果app曾经被调试过就是✅,从没被调试过就是❌
+注意:部分手机出现部署之后adb连不上的问题,那请使用deploy2.sh。
```shell
-stephen@Mac:~/hooker$ python3 hooker.py
-hooker Let's enjoy reverse engineering together
------------------------------------------------------------------------------------------------
-PID APP IDENTIFIER EXIST_REVERSE_DIRECTORY
-0 全球上网 com.miui.virtualsim ❌
-0 爱奇艺 com.qiyi.video ❌
-0 红手指云手机 com.redfinger.app ❌
-0 Reqable com.reqable.android ❌
-0 美团 com.sankuai.meituan ✅
-0 得物 com.shizhuang.duapp ❌
-0 某皮 cxm.shxpxx.sg ✅
-0 微博 com.sina.weibo ❌
-0 今日头条 com.ss.android.article.news ✅
-0 西瓜视频 com.ss.android.article.video ✅
-0 懂车帝 com.ss.android.auto ✅
-0 抖音火山版 com.ss.android.ugc.live ✅
-0 抖音精选 com.ss.android.yumme.video ❌
-0 淘宝 com.taobao.taobao ✅
-0 腾讯视频 com.tencent.qqlive ❌
-0 Termux com.termux ❌
-0 轻奢 com.tm.bachelorparty ✅
-0 WiFi ADB com.ttxapps.wifiadb ❌
-0 VMOS Pro com.vmos.pro ✅
-0 游戏中心 com.xiaomi.gamecenter ❌
-0 小米商城 com.xiaomi.shop ❌
-0 米家 com.xiaomi.smarthome ❌
-0 小米有品 com.xiaomi.youpin ✅
-0 小红书 com.xingin.xhs ✅
-0 运满满货主 com.xiwei.logistics.consignor ✅
-0 拼多多 com.xunmeng.pinduoduo ✅
-0 EnvCheck com.yimian.envcheck ✅
-0 check_env com.yuuki.check_env ❌
-0 TikTok com.zhiliaoapp.musically ❌
-0 XPrivacyLua eu.faircode.xlua ❌
-0 imToken im.token.app ❌
-0 SocksDroid net.typeblog.socks ❌
-0 F-Droid org.fdroid.fdroid ❌
-0 ProxyDroid org.proxydroid ❌
-3457 手机管家 com.miui.securitycenter ✅
-3509 优信拍 com.uxin.buyerphone ✅
-18780 抖音 com.ss.android.ugc.aweme ✅
-20174 应用商店 com.xiaomi.market ❌
-20913 设置 com.android.settings ❌
-30500 小爱同学 com.miui.voiceassist ❌
-32163 相机 com.android.camera ✅
-Please enter the identifier that needs to be reversed
-hooker(Identifier):
+#以piexl2为例
+stephen@ubuntu:~/hooker$ adb push mobile-deploy/ /sdcard/
+stephen@ubuntu:~/hooker$ adb shell #进入手机命令行界面
+sailfish:/ $ su #进入root权限命令行模式
+sailfish:/ $ sh /sdcard/mobile-deploy/deploy.sh
+disable android firewall.
+start frida-server
+start network adb.
+deploy successfull.
+stephen@ubuntu:~/hooker$ #如果你看到你的adb命令被弹出来了,表示已经正常部署。
```
+
***
-
-### 5. 输入调试应用包名
-
-- 输入调试应用包名回车后,如果是第一次调试应用,hooker将创建应用目录,应用目录名称为应用的Identifier,用于存放所有js脚本和快捷命令。
-
-- hooker将帮你检测当前app是否启动且在手机前台,如不在启动帮你启动,如不在前台帮你切到前台
-
-- frida通杀脚本可以在hooker交互式命令行下用attach/spawn执行,也可以手动cd到应用目录用快捷命令或原生的frida命令执行。
-
-- 你可以修改应用工作目录下任何脚本
-
+### 5. 指定fridaserver端口的手机开发环境部署
```shell
-hooker(Identifier): cxm.shxpxx.sg
-✅ App cxm.shxpxx.sg is already in the foreground
-Creating working directory: cxm.shxpxx.sg
-Generating frida shortcut command...
-Generating built-in frida script...
-pull /data/app/cxm.shxpxx.sg-L8zkrpFVICv0-hOrtmPPxA==/base.apk to cxm.shxpxx.sg/ShopeeSG_3.43.40.apk successful
-Working directory create successful
-just_trust_me.js empty.js keystore_dump.js
-edit_text.js activity_events.js find_boringssl_custom_verify_func.js
-ssl_log.js hook_register_natives.js click.js
-get_device_info.js apk_shell_scanner.js dump_dex.js
-object_store.js hook_artmethod_register.js replace_dlsym_get_pthread_create.js
-just_trust_me_for_ios.js trace_initproc.js android_ui.js
-jni_method_trace.js url.js just_trust_me_okhttp_hook_finder_for_android.js
-text_view.js find_anit_frida_so.js
-某皮 >
+stephen@ubuntu:~/hooker$ adb shell #进入手机命令行界面
+sailfish:/ $ su #进入root权限命令行模式
+sailfish:/ $ sh /sdcard/mobile-deploy/deploy.sh 6666 #deploy.sh启动失败的同样可以尝试deploy2.sh
+disable android firewall.
+set firda_server_bind_port to 6666
+start frida-server
+start network adb.
+deploy successfull.
+stephen@ubuntu:~/hooker$ #如果你看到你的adb命令被弹出来了,表示已经正常部署。
```
-
***
+注意:自定义frida server端口的开发环境必须走host:post的方式调试,因为usb默认找27042端口。所以请务必[更改本地.hooker_driver文件](#远程frida支持),否则hooker无法正常工作。
-
-
-### 6. 查看help信息
-
-在使用hooker过程中,如不记得命令,可随时调出help查看操作手册。
-
-```shell
-某皮 > help
-h, help show this help message
-a, activitys show the activity stack
-s, services show the service stack
-o, object [object_id] show object info by object_id
-v, view [view_id] show view info by view_id of view
-gs, generatescript [class_name:method_name] specify the class name and method name to generate a frida hook java script file. For example: generatescript
- okhttp3.Request$Builder:addHeader
-p, proxy [socks5_proxy_server] set up a socks5 proxy for this app. For example: proxy socks5://192.168.0.100:9998
-up, unproxy remove socks5 proxy for this app
-trust, justtrustme quickly spawn just_trust_me.js script to kill all ssl pinning
-ls list all the frida scripts of the current app
-attach [script_file_name] quickly execute a frida script, similar to executing the command "frida -U com.example.app -l xxx.js". For example: attach url.js
-spawn [script_file_name] quickly spawn a frida script, similar to executing the command "frida -U -f -n com.example.app -l xxx.js". For example: spawn
- just_trust_me.js
-restart restart this app
-pid get pid of this app main process
-uid get pid of this app
-exit return to the previous level
-某皮 >
-```
-
+### 6. 部署之后手机的增强功能
+- 1.关闭iptables防火墙,解决部分手机默认防火墙开启的问题
+- 2.启动frida-server,如果你的手机是arm64他将优先启动arm64位的frida-server
+- 3.在/data/mobile-deploy目录生成tools_env.rc 当你有内网穿透和网络服务转发、编辑文件、检测网络方面的需求时可以执行source /data/mobile-deploy/tools_env.rc,它将临时生成vi、telnet、frpc、tcpforward、ll命令以便你进行更便捷的开发,如图
+
***
-
-
-
-### 7. 嵌入式webserver
-
-hooker 支持在手机中注入一个轻量级 webserver。启动后会在目标 App 进程内开启一个 HTTP 服务,默认端口是 `8080`。这个服务既可以暴露 patch 项目里自定义的 controller,也会自动挂载一组内置调试接口。
-
-- 启动内置 webserver
-
-```shell
-某音火山版 > webserver start
-Http server port: 8080
-Http server: http://10.112.101.249:8080
-```
-
-启动内置 webserver 后,浏览器打开首页即可看到当前已注册的 API 列表。常用能力包括:
-
-- 服务管理:`/` 查看欢迎页和接口清单,`/stop` 停止当前 webserver。
-- UI 自动化:`/hooker/ui/...` 提供点击控件、按文本点击、按坐标点击、设置输入框文本、触发返回/Home、启动 Activity、获取屏幕信息、翻页、滚动 RecyclerView、尝试关闭弹窗等能力,适合做半自动化操作和页面联调。
-- 页面结构导出:`/hooker/uiauto/dump`、`/hooker/uiauto/window_dump.xml`、`/hooker/uiauto/window_dump.json` 可以导出当前窗口层级,方便定位控件和分析页面结构。
-- 截图能力:`/hooker/screencap/screenshot` 可直接调用系统 `screencap` 截图;`/hooker/mediaprojection/...` 支持申请 MediaProjection 权限并抓取整屏 PNG,更适合做远程观察和自动化闭环。
-- App 信息读取:`/hooker/appinfo` 可读取包名、版本、组件、权限、签名和目录信息;`/hooker/appinfo/shared_prefs`、`/hooker/appinfo/databases`、`/hooker/appinfo/read_table` 可以直接查看 `shared_prefs`、数据库结构和表数据。
-- 类/对象辅助调用:`/hooker/classhelper/invoke_static_method`、`/hooker/classhelper/invoke_method` 支持通过 HTTP 直接调用静态方法或已缓存对象的方法,便于快速验证算法、补环境或调试业务逻辑。
-- 文件回传:`/file?filename=...` 可以把绝对路径文件或 webserver 缓存目录里的文件直接通过 HTTP 返回。
-- MCP 风格 UI 工具:`/hooker/mcp/ui/tools` 和 `/hooker/mcp/ui/call` 把常用 UI 操作封装成统一工具接口,便于外部脚本或 Agent 通过 HTTP 驱动当前 App。
-
-
-- 7.1 启动自定义 webserver
-
-给定一个patch工程的jar包,将爬虫接口启动为webserver。
-
-```shell
-某宝 > webserver start taxbax-patch.jar
-Converting taxbax-patch.jar to taxbax-patch.dex...
-Successfully converted to taxbax-patch.dex (7160 bytes)
-push file OK /data/user/0/com.taxbax.taxbax/hooker_server.dex
-Http server port: 2026
-Http server: http://10.112.101.249:2026
-```
-
-这里的 `taxbax-patch.jar` 可以理解成“运行在目标 App 进程里的业务插件”。`hooker` 会先把 jar 转成 dex,再注入到目标进程中,扫描其中带注解的类,然后把这些类注册成 HTTP 路由。
-
-- 7.2 自定义 webserver 适合做这类事情:
-
-- 暴露目标 App 内部已经存在的业务能力,比如搜索、评论、详情页、签名、加解密、用户资料、直播接口等。
-- 直接复用目标 App 自己的登录态、网络栈、环境参数和对象实例,避免在外部重复补协议。
-- 把异步回调、Observable、Listener、页面对象调用收敛成一个同步 HTTP 接口,对外统一返回 JSON 或文本。
-
-你可以像开发springboot一样优雅的开发嵌入式的httpserver,并调用目标app的任何java代码而无需像有些xposed插件一样TMD的反射、反射、再反射,跟SB一样😊
-
-- 用 `@HookerWebServerConfiguration(port = 2026)` 指定端口,不写时默认走 `8080`。
-- 用 `@HookerController("/taobao")`、`@HookerController("/douyin")` 这类注解定义业务前缀。
-- 用 `@HookerRequestMapping(path = "/getProductDetail")` 之类的注解暴露具体接口。
-- 用 `@HookerRequestParam`、`@HookerRequestPostJson` 接收查询参数和 POST JSON。
-
-
-具体开发文档,将在https://github.com/CreditTone/radar4hooker详细介绍
-
-
-- 7.3 webserver 持久化
-
-如果你已经为某个 App 开发好了 patch 工程,并且需要在多台设备上长期部署,那么 `frida + hooker` 的临时注入方式会比较重。针对这种场景,作者提供了 Xposed 插件 `HookerServer`:
-
-`https://github.com/CreditTone/HookerServer`
-
-只要手机支持 Xposed/LSPosed,就可以借助这个插件把 webserver 持久化到目标 App 中。
-
-操作步骤:
-
-1. 从 `https://github.com/CreditTone/HookerServer/releases` 下载最新 APK。
-2. 把 `patch.dex` 推送到 `/data/user/0/{package}/hooker_server.dex`。
-3. 在 Xposed/LSPosed 中启用 `HookerServer`,并勾选目标 App。
-4. 重启 App,webserver 即可自动启动。
-
-其中 `patch.dex` 可以在第一次部署 `patch.jar` 后获得,hooker 会自动完成 jar 转 dex,并把生成结果放到目标应用的工作目录中。
-
-
+- 4.启动网络adb,即你可以直接通过远程adb调试手机。例如:adb connect 192.168.0.105
+
***
+# 快速开始
-### 8. 自动化生成frida脚本
-自动化生成脚本是hooker的杀器。虽然现在AI大模型也可以写,但是我们离内存近,更快,也不需要联网。生成的脚本自带打印堆栈等信息,和一些你可能需要的扩展方法。
-另外在生成脚本的过程中,命令行类名、方法名提示也可以当作搜索使用,能通过关键词快速搜索定位类方法。hooker搜索类比jadx快很多,不信就试试......
-
-
-- Command语法:gs, generatescript [class_name:method_name]
-
-
-- 8.1 生成指定方法的frida hook脚本:
-gs okhttp3.Request$Builder:addHeader,参数部分(String, String)不是必须写的
-
+### 1. 查看可调试进程
```shell
-某信拍 > gs okhttp3.Request$Builder:addHeader(String, String)
-Generating frida script, please wait for a few seconds
-frida hook script: okhttp3.Request.Builder.addHeader.js
-某信拍 >
-```
-
-```js
-//cat okhttp3.Request.Builder.addHeader.js
-Java.perform(function() {
- var okhttp3_Request_Builder_clz = Java.use('okhttp3.Request$Builder');
- var okhttp3_Request_Builder_clz_method_addHeader_2grl = okhttp3_Request_Builder_clz.addHeader.overload('java.lang.String', 'java.lang.String');
- okhttp3_Request_Builder_clz_method_addHeader_2grl.implementation = function(string, string_x2) {
- var executor = this.hashCode();
- var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.addHeader(java.lang.String,java.lang.String)';
- var beat = newMethodBeat(beatText, executor);
- var ret = okhttp3_Request_Builder_clz_method_addHeader_2grl.call(this, string, string_x2);
- console.log("header name:" + string + " header value:" + string_x2);
- printBeat(beat);
- return ret;
- };
-});
+stephen@ubuntu:~/hooker$ ./hooker
+ PID Name Identifier
+----- ----------------------------- -------------------------------------------------------------
+ 2857 Android Auto com.google.android.projection.gearhead
+ 1779 Android Services Library com.google.android.ext.services
+ 929 Android 系统 android
+ 5073 Carrier Services com.google.android.ims
+11051 Device Health Services com.google.android.apps.turbo
+ 2913 Device Personalization S… com.google.android.as
+ 2522 Google com.google.android.googlequicksearchbox
+15189 Google Play 商店 com.android.vending
+ 2101 Google Play 服务 com.google.android.gms
+ 2833 Google VR 服务 com.google.vr.vrcore
+ 7710 Google 服务框架 com.google.android.gsf
+ 2546 NFC服务 com.android.nfc
+ 929 NetworkStack com.android.networkstack.inprocess
+ 929 一体化位置信息 com.android.location.fused
+14468 云端硬盘 com.google.android.apps.docs
+14403 信息 com.google.android.apps.messaging
+12073 存储已屏蔽的号码 com.android.providers.blockednumber
+ 1574 实时数据壁纸 com.ustwo.lwp
+15637 抖音 com.ss.android.ugc.aweme
+ 2480 搜狗输入法 com.sohu.inputmethod.sogou
+12073 用户字典 com.android.providers.userdictionary
+13362 电话 com.google.android.dialer
+ 1704 电话和短信存储 com.android.providers.telephony
+ 1704 电话服务 com.android.phone
+11818 知乎 com.zhihu.android
+ 1451 系统界面 com.android.systemui
+12424 紧急警报 com.android.cellbroadcastreceiver
+12073 联系人存储 com.android.providers.contacts
+ 1431 蓝牙 com.android.bluetooth
+ 929 设置存储 com.android.providers.settings
+10149 运营商设置 com.google.android.wfcactivation
+14376 通讯录 com.google.android.contacts
+ 929 通话管理 com.android.server.telecom
+14807 阿里巴巴 com.alibaba.wireless
+Enter the need to attach package.
+:
```
-***
-
-
-
-- 8.2 生成指定类的所有成员方法的frida hook脚本:
-gs okhttp3.Request$Builder
+### 2. attach一个应用
```shell
-某信拍 > generatescript okhttp3.Request$Builder
-Generating frida script, please wait for a few seconds
-frida hook script: okhttp3.Request.Builder.allfunc.js
+stephen@ubuntu:~/hooker$ ./hooker
+ PID Name Identifier
+----- ----------------------------- -------------------------------------------------------------
+15637 抖音 com.ss.android.ugc.aweme
+ 2480 搜狗输入法 com.sohu.inputmethod.sogou
+12073 用户字典 com.android.providers.userdictionary
+13362 电话 com.google.android.dialer
+ 1704 电话和短信存储 com.android.providers.telephony
+ 1704 电话服务 com.android.phone
+11818 知乎 com.zhihu.android
+ 1451 系统界面 com.android.systemui
+12424 紧急警报 com.android.cellbroadcastreceiver
+12073 联系人存储 com.android.providers.contacts
+ 1431 蓝牙 com.android.bluetooth
+ 929 设置存储 com.android.providers.settings
+10149 运营商设置 com.google.android.wfcactivation
+14376 通讯录 com.google.android.contacts
+ 929 通话管理 com.android.server.telecom
+14807 阿里巴巴 com.alibaba.wireless
+Enter the need to attach package.
+: com.ss.android.ugc.aweme #在此处输入进程的Identifier即可调试应用
+It's com.ss.android.ugc.aweme that you have attached app.
+--------------------------------------------------
+Please enter e, s, j, c or ex command.
+a: Discovering activities.
+b: Discovering services.
+c: Discovering object. eg:'c {objectId}'
+d: Object2Explain. eg:'d {objectId}'
+v: Discovering view. eg:'v {viewId}'
+e: Determines whether a class exists. eg:'e android.app.Application'
+s: Discovering classes by a class'regex. eg:'s com.tencent.mm.Message.*'
+t: Discovering offspring classes by a class'name. eg:'t com.tencent.mm.BasicActivity'
+j: Generating hooked js. eg:'j okhttp3.Request$Builder:build'
+k: Generating hooked the string generation js with a keyword. eg:'k {YourKeyword}'
+l: Generating hooked the param generation js with a param keyword. eg:'l {YourKeyword}'
+m: Discovering so module.
+ex: Exit to the upper layer. eg:'ex'
+:
```
-***
-
-```js
-//cat okhttp3.Request.Builder.allfunc.js
-//okhttp3.Request$Builder
-Java.perform(function() {
- var okhttp3_Request_Builder_clz = Java.use('okhttp3.Request$Builder');
- var okhttp3_Request_Builder_clz_method_header_ng3n = okhttp3_Request_Builder_clz.header.overload('java.lang.String', 'java.lang.String');
- okhttp3_Request_Builder_clz_method_header_ng3n.implementation = function(string, string_x2) {
- var executor = this.hashCode();
- var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.header(java.lang.String,java.lang.String)';
- var beat = newMethodBeat(beatText, executor);
- var ret = okhttp3_Request_Builder_clz_method_header_ng3n.call(this, string, string_x2);
- printBeat(beat);
- return ret;
- };
- var okhttp3_Request_Builder_clz_method_cacheControl_q8q5 = okhttp3_Request_Builder_clz.cacheControl.overload('okhttp3.CacheControl');
- okhttp3_Request_Builder_clz_method_cacheControl_q8q5.implementation = function(cacheControl) {
- var executor = this.hashCode();
- var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.cacheControl(okhttp3.CacheControl)';
- var beat = newMethodBeat(beatText, executor);
- var ret = okhttp3_Request_Builder_clz_method_cacheControl_q8q5.call(this, cacheControl);
- printBeat(beat);
- return ret;
- };
- var okhttp3_Request_Builder_clz_method_method_bjk9 = okhttp3_Request_Builder_clz.method.overload('java.lang.String', 'okhttp3.RequestBody');
- okhttp3_Request_Builder_clz_method_method_bjk9.implementation = function(string, requestBody) {
- var executor = this.hashCode();
- var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.method(java.lang.String,okhttp3.RequestBody)';
- var beat = newMethodBeat(beatText, executor);
- var ret = okhttp3_Request_Builder_clz_method_method_bjk9.call(this, string, requestBody);
- printBeat(beat);
- return ret;
- };
- var okhttp3_Request_Builder_clz_method_head_a5nq = okhttp3_Request_Builder_clz.head.overload();
- okhttp3_Request_Builder_clz_method_head_a5nq.implementation = function() {
- var executor = this.hashCode();
- var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.head()';
- var beat = newMethodBeat(beatText, executor);
- var ret = okhttp3_Request_Builder_clz_method_head_a5nq.call(this);
- printBeat(beat);
- return ret;
- };
- var okhttp3_Request_Builder_clz_method_headers_to5i = okhttp3_Request_Builder_clz.headers.overload('okhttp3.Headers');
- okhttp3_Request_Builder_clz_method_headers_to5i.implementation = function(headers) {
- var executor = this.hashCode();
- var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.headers(okhttp3.Headers)';
- var beat = newMethodBeat(beatText, executor);
- var ret = okhttp3_Request_Builder_clz_method_headers_to5i.call(this, headers);
- printBeat(beat);
- return ret;
- };
- var okhttp3_Request_Builder_clz_method_post_heaq = okhttp3_Request_Builder_clz.post.overload('okhttp3.RequestBody');
- okhttp3_Request_Builder_clz_method_post_heaq.implementation = function(requestBody) {
- var executor = this.hashCode();
- var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.post(okhttp3.RequestBody)';
- var beat = newMethodBeat(beatText, executor);
- var ret = okhttp3_Request_Builder_clz_method_post_heaq.call(this, requestBody);
- printBeat(beat);
- return ret;
- };
- var okhttp3_Request_Builder_clz_method_build_rmqx = okhttp3_Request_Builder_clz.build.overload();
- okhttp3_Request_Builder_clz_method_build_rmqx.implementation = function() {
- var executor = this.hashCode();
- var beatText = 'public okhttp3.Request okhttp3.Request$Builder.build()';
- var beat = newMethodBeat(beatText, executor);
- var ret = okhttp3_Request_Builder_clz_method_build_rmqx.call(this);
- printBeat(beat);
- return ret;
- };
- var okhttp3_Request_Builder_clz_method_patch_hp9u = okhttp3_Request_Builder_clz.patch.overload('okhttp3.RequestBody');
- okhttp3_Request_Builder_clz_method_patch_hp9u.implementation = function(requestBody) {
- var executor = this.hashCode();
- var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.patch(okhttp3.RequestBody)';
- var beat = newMethodBeat(beatText, executor);
- var ret = okhttp3_Request_Builder_clz_method_patch_hp9u.call(this, requestBody);
- printBeat(beat);
- return ret;
- };
- var okhttp3_Request_Builder_clz_method_url_0owi = okhttp3_Request_Builder_clz.url.overload('java.lang.String');
- okhttp3_Request_Builder_clz_method_url_0owi.implementation = function(string) {
- var executor = this.hashCode();
- var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.url(java.lang.String)';
- var beat = newMethodBeat(beatText, executor);
- var ret = okhttp3_Request_Builder_clz_method_url_0owi.call(this, string);
- printBeat(beat);
- return ret;
- };
- var okhttp3_Request_Builder_clz_method_removeHeader_uzb9 = okhttp3_Request_Builder_clz.removeHeader.overload('java.lang.String');
- okhttp3_Request_Builder_clz_method_removeHeader_uzb9.implementation = function(string) {
- var executor = this.hashCode();
- var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.removeHeader(java.lang.String)';
- var beat = newMethodBeat(beatText, executor);
- var ret = okhttp3_Request_Builder_clz_method_removeHeader_uzb9.call(this, string);
- printBeat(beat);
- return ret;
- };
- var okhttp3_Request_Builder_clz_method_url_ykbd = okhttp3_Request_Builder_clz.url.overload('java.net.URL');
- okhttp3_Request_Builder_clz_method_url_ykbd.implementation = function(url) {
- var executor = this.hashCode();
- var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.url(java.net.URL)';
- var beat = newMethodBeat(beatText, executor);
- var ret = okhttp3_Request_Builder_clz_method_url_ykbd.call(this, url);
- printBeat(beat);
- return ret;
- };
- var okhttp3_Request_Builder_clz_method_delete_dqyl = okhttp3_Request_Builder_clz.delete.overload();
- okhttp3_Request_Builder_clz_method_delete_dqyl.implementation = function() {
- var executor = this.hashCode();
- var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.delete()';
- var beat = newMethodBeat(beatText, executor);
- var ret = okhttp3_Request_Builder_clz_method_delete_dqyl.call(this);
- printBeat(beat);
- return ret;
- };
- //.......省略N行代码
-```
-***
-
+##### 提示1: 第一次调试你的应用时hooker将在当前目录生成以进程Identifier命名的应用专有工作目录,并初始化生成一些你可能会用到的通杀脚本。
+##### 提示2: 成功attach一个应用时,命令将pause在等待输入调试指令的阶段。pause状态下使用命令进行高级调试请直接跳到[hooker调试命令行](#hooker调试命令行)
+##### 提示3: attach时hooker会将[radar.dex](#radardex)文件拷贝到手机的/data/user/0/{package}/目录下
+
-- 8.3 生成指定类的构造方法的frida hook脚本:
-gs okhttp3.Request$Builder:_ 或者gs okhttp3.Request$Builder:\
+```shell
+export LATEST_HOOKER=~/Download/hooker #这里要设置你下载的最新hooker目录
+export MY_HOOKER=~/hooker #这里要设置你的hooker目录
+
+#上面两个环境变量改好之后,下面的命令可以照抄
+cp -f $LATEST_HOOKER/hooker $MY_HOOKER/hooker
+cp -f $LATEST_HOOKER/hooker.py $MY_HOOKER/hooker.py
+cp -f $LATEST_HOOKER/radar.dex $MY_HOOKER/radar.dex
+cp -f $LATEST_HOOKER/run_env.py $MY_HOOKER/run_env.py
+cp -f $LATEST_HOOKER/xinitdeploy.py $MY_HOOKER/xinitdeploy.py
+cp -f $LATEST_HOOKER/spider.py $MY_HOOKER/spider.py
+cp -f $LATEST_HOOKER/colorful.py $MY_HOOKER/colorful.py
+cp -f $LATEST_HOOKER/requirements.txt $MY_HOOKER/requirements.txt
+cp -rf $LATEST_HOOKER/js/* $MY_HOOKER/js/
+cp -rf $LATEST_HOOKER/mobile-deploy/* $MY_HOOKER/mobile-deploy/
+```
+### 3. 方式二覆盖你的应用工作目录到最新hooker
+如果你不需要维护自己的hooker版本,就可以用这个方式。简单粗暴!
-# Windows安装WSL
+```shell
+export LATEST_HOOKER=~/Download/hooker #这里要设置你下载的最新hooker目录
+export MY_HOOKER=~/hooker #这里要设置你的hooker目录
-WSL是适用于Linux 的Windows 子系统(WSL)允许开发人员直接在Windows 上运行GNU/Linux 环境(包括大多数命令行工具、实用工具和应用程序),无需传统虚拟机或双启动设置的开销。
+#你有多少个目录就拷贝多少个吧
+cp -rf $MY_HOOKER/{your_app_package} $LATEST_HOOKER/
+```
-### 1. 安装wsl ubuntn24.04
-访问:https://learn.microsoft.com/zh-cn/windows/wsl/install-manual#downloading-distributions
+hooker实战应用
+=================
-下载Ubuntu24.04
+### 亲测好用的脱壳工具
+https://github.com/CodingGay/BlackDex
-双击Ubuntu2404-240425.AppxBundle 安装Ubuntu
+https://github.com/GuoQiang1993/Frida-Apk-Unpack
+https://github.com/hanbinglengyue/FART
-### 2. 进入wsl,配置代理
-窗口输入wsl进入ubuntu命令行
+### 通信降级案例(亲测有效)
+https://blog.csdn.net/qq314000558/article/details/105958847
-- cmd
-- wsl
+# 关于作者
-切换到root用户
+```javascript
+var author = {
+ name : "stephen",
+ bilibili : "https://space.bilibili.com/105035514",
+ email : "1273568669@qq.com",
+ experience : ["Android应用开发", "网络爬虫", "Android逆向", "JAVA/Go后台开发", "中间件开发"]
+}
+```
-- sudo su
+# 加密货币打赏
-配置翻墙代理,如果你有
+### Dogecoin tipping
-- export http_proxy="http://10.115.164.50:8080"
-- export https_proxy="http://10.115.164.50:8080"
+
-### 3. 安装python3.8和frida
-- apt update
-- apt install -y build-essential libssl-dev zlib1g-dev libbz2-dev
-libreadline-dev libsqlite3-dev wget curl llvm xz-utils tk-dev
-libffi-dev liblzma-dev
-- apt install -y git
-- apt install -y pyenv
-- pyenv install 3.8.8
-- pyenv local 3.8
+### Kevacoin tipping
-# 自定义frida-server
-- 将您自定义的frida-server文件拷贝到mobile-deploy文件夹下
-- 修改hooker.py,default_frida_server_arm和default_frida_server_arm64变量的名字为你自定义的文件名
+
-```python
-default_frida_server_arm = "your-custom-frida-server-android-arm"
-default_frida_server_arm64 = "your-custom-frida-server-android-arm64"
-```
-# hooker命令行快捷键
+没有Kevacoin的同学可以用你的普通pc进行挖矿。这个币目前全网算力不高,再垃圾的cpu都能挖的动。[挖矿教程https://www.dxpool.com/help/zh/kva-mining-tutorial](https://www.dxpool.com/help/zh/kva-mining-tutorial),教程中获取钱包地址部分可以跳过,直接填入我的钱包地址VLuXBaaDzGRukEFPwRmzKm4zhYvX4Xmy1R进行挖矿。只要跑半个小时我就有收益,感谢支持!!!
-- Ctrl + U:整行清空
-- Ctrl + W:删除一个单词
-- Ctrl + K:从光标删到行尾
+### End
+[1]: https://github.com/frida/frida "frida"
diff --git a/README_EN.md b/README_EN.md
deleted file mode 100644
index 396aaad..0000000
--- a/README_EN.md
+++ /dev/null
@@ -1,642 +0,0 @@
-⚠️ Disclaimer
-All contents of this project are intended solely for learning and technical exchange purposes. The goal is to help developers understand the structure and internal mechanisms of mobile applications.
-
-This project does not contain any cracking operations or infringing content targeting specific applications.
-Some simple unpacking techniques related to certain apps are widely available on major technical forums and do not cause actual harm to the applications.
-This project is not intended to assist with any illegal activities, including but not limited to bypassing copyright protection, modifying app functionality, or accessing unauthorized data.
-Please ensure compliance with relevant laws and regulations when using the tools provided by this project, and use them only for personal learning or research purposes.
-
-English | 简体中文
- -# 👋 Welcome to Hooker Reverse Engineering Toolkit - - - - - - -Hooker is a reverse engineering toolkit based on Frida, designed to provide Android reverse engineers with a comfortable command-line interface, - -A unified script package management system - -Universal (通杀) scripts - -Automated hook script generation - -In-memory roaming for detecting Activity and Service components - -A Frida-based implementation of JustTrustMe - -Global app support for boringssl unpinning - -One picture to prove why you need Hooker: - - -- 1. A Frida-based implementation of JustTrustMe for universal SSL pinning bypass, with ongoing maintenance. -- 2. An embedded webserver that can quickly expose in-app capabilities as HTTP endpoints for automation and API-style workflows. -- 3. Automated Frida hook script generation with detailed, extensible templates. -- 4. One-click SOCKS5 proxy setup without requiring third-party apps such as SocksDroid. -- 5. A highly streamlined command-line workflow that makes daily reversing much more comfortable. - -## 📚 Table of Contents - -- [Quick Start](#quick-start) - - [1. Clone the repository](#1-clone-the-repository) - - [2. Install Python dependencies](#2-install-python-dependencies) - - [3. Connect your rooted device via USB](#3-connect-your-rooted-device-via-usb) - - [4. Launch Hooker](#4-launch-hooker) - - [5. Enter the package name of the target app](#5-enter-the-package-name-of-the-target-app) - - [6. View help information](#6-view-help-information) - - [7. Embedded webserver](#7-embedded-webserver) - - [8. Generate Frida hook scripts for a specific class and method](#8-generate-frida-hook-scripts-for-a-specific-class-and-method) - - [9. List all available Frida scripts](#9-list-all-available-frida-scripts) - - [10. Attach and execute a specific Frida script](#10-attach-and-execute-a-specific-frida-script) - - [11. Set a SOCKS5 proxy for the app](#11-set-a-socks5-proxy-for-the-app) - - [12. Run JustTrustMe to disable all SSL pinning (including boringssl)](#12-run-justtrustme-to-disable-all-ssl-pinning-including-boringssl) - - [13. Spawn the app and execute a specific Frida script](#13-spawn-the-app-and-execute-a-specific-frida-script) - - [14. Clear the proxy settings](#14-clear-the-proxy-settings) - - [15. Restart the app](#15-restart-the-app) - - [16. Get the app's UID and PID](#16-get-uid-and-pid) - - -# 🚀 Quick Start - -Ensure your device is rooted. No need to manually start frida-server or do any configuration—Hooker handles everything for you. - - -### 1. Clone the repository -```shell -stephen@ubuntu:~$ git clone https://github.com/CreditTone/hooker.git -stephen@ubuntu:~$ cd hooker -``` - -### 2. Install Python dependencies -```shell -stephen@ubuntu:~/hooker$ pip3 install -r requirements.txt -``` - - -### 3. Connect your rooted device via USB -```shell -stephen@ubuntu:~/hooker$ adb devices -List of devices attached -FA77C0301476 device -``` - - -### 4. Launch Hooker -```shell -stephen@ubuntu:~/hooker$ python3 hooker.py -hooker Let's enjoy reverse engineering together ------------------------------------------------------------------------------------------------ -PID APP IDENTIFIER EXIST_REVERSE_DIRECTORY -0 全球上网 com.miui.virtualsim ❌ -0 爱奇艺 com.qiyi.video ❌ -0 红手指云手机 com.redfinger.app ❌ -0 Reqable com.reqable.android ❌ -0 美团 com.sankuai.meituan ✅ -0 得物 com.shizhuang.duapp ❌ -0 某皮 cxm.shxpxx.sg ✅ -0 微博 com.sina.weibo ❌ -0 今日头条 com.ss.android.article.news ✅ -0 西瓜视频 com.ss.android.article.video ✅ -0 懂车帝 com.ss.android.auto ✅ -0 抖音火山版 com.ss.android.ugc.live ✅ -0 抖音精选 com.ss.android.yumme.video ❌ -0 淘宝 com.taobao.taobao ✅ -0 腾讯视频 com.tencent.qqlive ❌ -0 Termux com.termux ❌ -0 轻奢 com.tm.bachelorparty ✅ -0 WiFi ADB com.ttxapps.wifiadb ❌ -0 VMOS Pro com.vmos.pro ✅ -0 游戏中心 com.xiaomi.gamecenter ❌ -0 小米商城 com.xiaomi.shop ❌ -0 米家 com.xiaomi.smarthome ❌ -0 小米有品 com.xiaomi.youpin ✅ -0 小红书 com.xingin.xhs ✅ -0 运满满货主 com.xiwei.logistics.consignor ✅ -0 拼多多 com.xunmeng.pinduoduo ✅ -0 EnvCheck com.yimian.envcheck ✅ -0 check_env com.yuuki.check_env ❌ -0 TikTok com.zhiliaoapp.musically ❌ -0 XPrivacyLua eu.faircode.xlua ❌ -0 imToken im.token.app ❌ -0 SocksDroid net.typeblog.socks ❌ -0 F-Droid org.fdroid.fdroid ❌ -0 ProxyDroid org.proxydroid ❌ -3457 手机管家 com.miui.securitycenter ✅ -3509 优信拍 com.uxin.buyerphone ✅ -18780 抖音 com.ss.android.ugc.aweme ✅ -20174 应用商店 com.xiaomi.market ❌ -20913 设置 com.android.settings ❌ -30500 小爱同学 com.miui.voiceassist ❌ -32163 相机 com.android.camera ✅ -Please enter the identifier that needs to be reversed -hooker(Identifier): -``` -*** - -### 5. Enter the package name of the target app -```shell -hooker(Identifier): cxm.shxpxx.sg -✅ App cxm.shxpxx.sg is already in the foreground -Creating working directory: cxm.shxpxx.sg -Generating frida shortcut command... -Generating built-in frida script... -pull /data/app/cxm.shxpxx.sg-L8zkrpFVICv0-hOrtmPPxA==/base.apk to cxm.shxpxx.sg/ShopeeSG_3.43.40.apk successful -Working directory create successful -just_trust_me.js empty.js keystore_dump.js -edit_text.js activity_events.js find_boringssl_custom_verify_func.js -ssl_log.js hook_register_natives.js click.js -get_device_info.js apk_shell_scanner.js dump_dex.js -object_store.js hook_artmethod_register.js replace_dlsym_get_pthread_create.js -just_trust_me_for_ios.js trace_initproc.js android_ui.js -jni_method_trace.js url.js just_trust_me_okhttp_hook_finder_for_android.js -text_view.js find_anit_frida_so.js -某皮 > -``` - -*** - - - - -### 6. View help information - -```shell -某皮 > help -h, help show this help message -a, activitys show the activity stack -s, services show the service stack -o, object [object_id] show object info by object_id -v, view [view_id] show view info by view_id of view -gs, generatescript [class_name:method_name] specify the class name and method name to generate a frida hook java script file. For example: generatescript - okhttp3.Request$Builder:addHeader -p, proxy [socks5_proxy_server] set up a socks5 proxy for this app. For example: proxy socks5://192.168.0.100:9998 -up, unproxy remove socks5 proxy for this app -trust, justtrustme quickly spawn just_trust_me.js script to kill all ssl pinning -ls list all the frida scripts of the current app -attach [script_file_name] quickly execute a frida script, similar to executing the command "frida -U com.example.app -l xxx.js". For example: attach url.js -spawn [script_file_name] quickly spawn a frida script, similar to executing the command "frida -U -f -n com.example.app -l xxx.js". For example: spawn - just_trust_me.js -restart restart this app -pid get pid of this app main process -uid get pid of this app -exit return to the previous level -某皮 > -``` - -*** - - -### 7. Embedded webserver - -Hooker can inject a lightweight webserver into the target app process. Once started, it launches an HTTP service inside the app. The default port is `8080`. This service can expose both your custom patch controllers and a built-in set of debugging endpoints. - -- Start the built-in webserver - -```shell -某音火山版 > webserver start -Http server port: 8080 -Http server: http://10.112.101.249:8080 -``` - -After the built-in webserver starts, open the root page in a browser to see all registered APIs. Common built-in capabilities include: - -- Service management: `/` shows the welcome page and API list, and `/stop` stops the current webserver. -- UI automation: `/hooker/ui/...` provides view clicking, text-based clicking, coordinate tapping, setting EditText values, triggering Back/Home, launching activities, querying screen info, swiping pagers, scrolling RecyclerView, and dismissing dialogs. -- UI hierarchy export: `/hooker/uiauto/dump`, `/hooker/uiauto/window_dump.xml`, and `/hooker/uiauto/window_dump.json` export the current window hierarchy for inspection and control discovery. -- Screenshot capture: `/hooker/screencap/screenshot` uses the system `screencap` command, while `/hooker/mediaprojection/...` supports MediaProjection permission flow and full-screen PNG capture. -- App information: `/hooker/appinfo`, `/hooker/appinfo/shared_prefs`, `/hooker/appinfo/databases`, and `/hooker/appinfo/read_table` let you inspect package metadata, permissions, signatures, shared preferences, database schemas, and table rows. -- Class and object helpers: `/hooker/classhelper/invoke_static_method` and `/hooker/classhelper/invoke_method` let you invoke static methods or stored object methods over HTTP. -- File serving: `/file?filename=...` returns an absolute-path file or a file generated in the webserver cache directory. -- MCP-style UI tools: `/hooker/mcp/ui/tools` and `/hooker/mcp/ui/call` package common UI actions into a consistent tool interface for external scripts or agents. - -- Start a custom webserver - -```shell -某宝 > webserver start taxbax-patch.jar -Converting taxbax-patch.jar to taxbax-patch.dex... -Successfully converted to taxbax-patch.dex (7160 bytes) -push file OK /data/user/0/com.taxbax.taxbax/hooker_server.dex -Http server port: 2026 -Http server: http://10.112.101.249:2026 -``` - -Here `taxbax-patch.jar` is essentially a business plugin running inside the target app process. Hooker converts the jar to dex, injects it into the app, scans annotated classes, and registers them as HTTP routes. - -Custom webservers are useful for: - -- Exposing app-internal business capabilities such as search, comments, product details, signatures, encryption/decryption, user profiles, or live-stream APIs. -- Reusing the target app's own login state, networking stack, environment values, and in-memory objects instead of rebuilding protocol details externally. -- Wrapping asynchronous callbacks, observables, listeners, or page-object calls into synchronous HTTP endpoints that return JSON or plain text. - -Patch projects typically define endpoints like this: - -- Use `@HookerWebServerConfiguration(port = 2026)` to specify the port. If omitted, the default is `8080`. -- Use `@HookerController("/taobao")` or `@HookerController("/douyin")` to define the route prefix. -- Use `@HookerRequestMapping(path = "/getProductDetail")` to expose concrete endpoints. -- Use `@HookerRequestParam` and `@HookerRequestPostJson` to receive query parameters and POST JSON. - -This is also the recommended way to build mobile-facing APIs with Hooker: keep generic debugging features in the main repository, keep app-specific business logic in patch projects, and expose those capabilities through the embedded webserver. - -- Webserver persistence - -If you already have a patch project for an app and need to deploy it at scale, the temporary `frida + hooker` injection model can become heavy. For this scenario, the author provides an Xposed plugin named `HookerServer`: - -`https://github.com/CreditTone/HookerServer` - -If the device supports Xposed/LSPosed, you can use this plugin to persist the webserver inside the target app. - -Steps: - -1. Download the latest APK from `https://github.com/CreditTone/HookerServer/releases`. -2. Push `patch.dex` to `/data/user/0/{package}/hooker_server.dex`. -3. Enable `HookerServer` for the target app in Xposed/LSPosed. -4. Restart the app, and the webserver will start automatically. - -The `patch.dex` file becomes available after the first time you deploy `patch.jar`; Hooker automatically converts the jar to dex and places the output in the target app's working directory. -*** - - -### 8. Generate Frida hook scripts for a specific class and method - - - -- Command Syntax:gs, generatescript [class_name:method_name] - - -- 8.1 Generate a Frida hook script for a specific method: -gs okhttp3.Request$Builder:addHeader — the parameter part (String, String) is not required. - -```shell -某信拍 > gs okhttp3.Request$Builder:addHeader(String, String) -Generating frida script, please wait for a few seconds -frida hook script: okhttp3.Request.Builder.addHeader.js -某信拍 > -``` - -```js -//cat okhttp3.Request.Builder.addHeader.js -Java.perform(function() { - var okhttp3_Request_Builder_clz = Java.use('okhttp3.Request$Builder'); - var okhttp3_Request_Builder_clz_method_addHeader_2grl = okhttp3_Request_Builder_clz.addHeader.overload('java.lang.String', 'java.lang.String'); - okhttp3_Request_Builder_clz_method_addHeader_2grl.implementation = function(string, string_x2) { - var executor = this.hashCode(); - var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.addHeader(java.lang.String,java.lang.String)'; - var beat = newMethodBeat(beatText, executor); - var ret = okhttp3_Request_Builder_clz_method_addHeader_2grl.call(this, string, string_x2); - console.log("header name:" + string + " header value:" + string_x2); - printBeat(beat); - return ret; - }; -}); -``` -*** - - - -- 8.2 Generate a Frida hook script for all member methods of a specified class: -gs okhttp3.Request$Builder - -```shell -某信拍 > generatescript okhttp3.Request$Builder -Generating frida script, please wait for a few seconds -frida hook script: okhttp3.Request.Builder.allfunc.js -``` -*** - -```js -//cat okhttp3.Request.Builder.allfunc.js -//okhttp3.Request$Builder -Java.perform(function() { - var okhttp3_Request_Builder_clz = Java.use('okhttp3.Request$Builder'); - var okhttp3_Request_Builder_clz_method_header_ng3n = okhttp3_Request_Builder_clz.header.overload('java.lang.String', 'java.lang.String'); - okhttp3_Request_Builder_clz_method_header_ng3n.implementation = function(string, string_x2) { - var executor = this.hashCode(); - var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.header(java.lang.String,java.lang.String)'; - var beat = newMethodBeat(beatText, executor); - var ret = okhttp3_Request_Builder_clz_method_header_ng3n.call(this, string, string_x2); - printBeat(beat); - return ret; - }; - var okhttp3_Request_Builder_clz_method_cacheControl_q8q5 = okhttp3_Request_Builder_clz.cacheControl.overload('okhttp3.CacheControl'); - okhttp3_Request_Builder_clz_method_cacheControl_q8q5.implementation = function(cacheControl) { - var executor = this.hashCode(); - var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.cacheControl(okhttp3.CacheControl)'; - var beat = newMethodBeat(beatText, executor); - var ret = okhttp3_Request_Builder_clz_method_cacheControl_q8q5.call(this, cacheControl); - printBeat(beat); - return ret; - }; - var okhttp3_Request_Builder_clz_method_method_bjk9 = okhttp3_Request_Builder_clz.method.overload('java.lang.String', 'okhttp3.RequestBody'); - okhttp3_Request_Builder_clz_method_method_bjk9.implementation = function(string, requestBody) { - var executor = this.hashCode(); - var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.method(java.lang.String,okhttp3.RequestBody)'; - var beat = newMethodBeat(beatText, executor); - var ret = okhttp3_Request_Builder_clz_method_method_bjk9.call(this, string, requestBody); - printBeat(beat); - return ret; - }; - var okhttp3_Request_Builder_clz_method_head_a5nq = okhttp3_Request_Builder_clz.head.overload(); - okhttp3_Request_Builder_clz_method_head_a5nq.implementation = function() { - var executor = this.hashCode(); - var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.head()'; - var beat = newMethodBeat(beatText, executor); - var ret = okhttp3_Request_Builder_clz_method_head_a5nq.call(this); - printBeat(beat); - return ret; - }; - var okhttp3_Request_Builder_clz_method_headers_to5i = okhttp3_Request_Builder_clz.headers.overload('okhttp3.Headers'); - okhttp3_Request_Builder_clz_method_headers_to5i.implementation = function(headers) { - var executor = this.hashCode(); - var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.headers(okhttp3.Headers)'; - var beat = newMethodBeat(beatText, executor); - var ret = okhttp3_Request_Builder_clz_method_headers_to5i.call(this, headers); - printBeat(beat); - return ret; - }; - var okhttp3_Request_Builder_clz_method_post_heaq = okhttp3_Request_Builder_clz.post.overload('okhttp3.RequestBody'); - okhttp3_Request_Builder_clz_method_post_heaq.implementation = function(requestBody) { - var executor = this.hashCode(); - var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.post(okhttp3.RequestBody)'; - var beat = newMethodBeat(beatText, executor); - var ret = okhttp3_Request_Builder_clz_method_post_heaq.call(this, requestBody); - printBeat(beat); - return ret; - }; - var okhttp3_Request_Builder_clz_method_build_rmqx = okhttp3_Request_Builder_clz.build.overload(); - okhttp3_Request_Builder_clz_method_build_rmqx.implementation = function() { - var executor = this.hashCode(); - var beatText = 'public okhttp3.Request okhttp3.Request$Builder.build()'; - var beat = newMethodBeat(beatText, executor); - var ret = okhttp3_Request_Builder_clz_method_build_rmqx.call(this); - printBeat(beat); - return ret; - }; - var okhttp3_Request_Builder_clz_method_patch_hp9u = okhttp3_Request_Builder_clz.patch.overload('okhttp3.RequestBody'); - okhttp3_Request_Builder_clz_method_patch_hp9u.implementation = function(requestBody) { - var executor = this.hashCode(); - var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.patch(okhttp3.RequestBody)'; - var beat = newMethodBeat(beatText, executor); - var ret = okhttp3_Request_Builder_clz_method_patch_hp9u.call(this, requestBody); - printBeat(beat); - return ret; - }; - var okhttp3_Request_Builder_clz_method_url_0owi = okhttp3_Request_Builder_clz.url.overload('java.lang.String'); - okhttp3_Request_Builder_clz_method_url_0owi.implementation = function(string) { - var executor = this.hashCode(); - var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.url(java.lang.String)'; - var beat = newMethodBeat(beatText, executor); - var ret = okhttp3_Request_Builder_clz_method_url_0owi.call(this, string); - printBeat(beat); - return ret; - }; - var okhttp3_Request_Builder_clz_method_removeHeader_uzb9 = okhttp3_Request_Builder_clz.removeHeader.overload('java.lang.String'); - okhttp3_Request_Builder_clz_method_removeHeader_uzb9.implementation = function(string) { - var executor = this.hashCode(); - var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.removeHeader(java.lang.String)'; - var beat = newMethodBeat(beatText, executor); - var ret = okhttp3_Request_Builder_clz_method_removeHeader_uzb9.call(this, string); - printBeat(beat); - return ret; - }; - var okhttp3_Request_Builder_clz_method_url_ykbd = okhttp3_Request_Builder_clz.url.overload('java.net.URL'); - okhttp3_Request_Builder_clz_method_url_ykbd.implementation = function(url) { - var executor = this.hashCode(); - var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.url(java.net.URL)'; - var beat = newMethodBeat(beatText, executor); - var ret = okhttp3_Request_Builder_clz_method_url_ykbd.call(this, url); - printBeat(beat); - return ret; - }; - var okhttp3_Request_Builder_clz_method_delete_dqyl = okhttp3_Request_Builder_clz.delete.overload(); - okhttp3_Request_Builder_clz_method_delete_dqyl.implementation = function() { - var executor = this.hashCode(); - var beatText = 'public okhttp3.Request$Builder okhttp3.Request$Builder.delete()'; - var beat = newMethodBeat(beatText, executor); - var ret = okhttp3_Request_Builder_clz_method_delete_dqyl.call(this); - printBeat(beat); - return ret; - }; - //.......省略N行代码 -``` -*** - - - -- 8.3 Generate a Frida hook script for the constructor(s) of a specified class: -gs okhttp3.Request$Builder:_ or gs okhttp3.Request$Builder:\