Hook逆向离线加密的autojs打包的脚本

效果展示

环境

雷电模拟器Android版本: 7.1.2

Android Studio版本: 4.1.2

jadx-gui版本: 1.2.0

流程

用autojs打包app, 安装到雷电模拟器
用jadx-gui查看app, 主要是查看包名类名
执行frida的hook命令, hook可疑的类, 主要是包含decrypt的类名
打印可疑decrypt方法的参数和返回值, 脚本内容就直接出来了

autojs的测试代码

  1. main.js

engines.execScriptFile("./dog.js");

  1. dog.js

let result = “dog is running!”;
toastLog(result);

frida的Hook代码

  1. hook.js

Java.perform(function () {
var String = Java.use(“java.lang.String”);
var clazz5 = Java.use(“com.stardust.autojs.engine.encryption.ScriptEncryption”);
clazz5.decrypt.implementation = function (a, b, c) {
console.log(“com.stardust.autojs.engine.encryption.ScriptEncryption”);
console.log(“a =”);
console.log(a);
console.log(“b =”);
console.log(b);
console.log(“c =”);
console.log©;
let result = this.decrypt(a, b, c);
let s = String.$new(result);
console.log(“s ====================”);
console.log(s);
return result;
};
});

  1. 打印方法堆栈

function trace() {
var throwable = Java.use(“java.lang.Throwable”);
send(
“Backtrace:\n\t” +
throwable
.$new()
.getStackTrace()
.map((traceElement) => traceElement.toString() + “\n\t”)
.join("")
);
}

  1. 方法堆栈

com.stardust.autojs.engine.encryption.ScriptEncryption.decrypt(Native Method)
com.stardust.autojs.engine.encryption.ScriptEncryption C o m p a n i o n . d e c r y p t ( ) c o m . s t a r d u s t . a u t o j s . e n g i n e . e n c r y p t i o n . S c r i p t E n c r y p t i o n Companion.decrypt() com.stardust.autojs.engine.encryption.ScriptEncryption Companion.decrypt()com.stardust.autojs.engine.encryption.ScriptEncryptionCompanion.decrypt$default()
d.g.c.o.g.a.b(:4)
d.g.c.o.g.a.doExecution(:2)
com.stardust.autojs.engine.JavaScriptEngine.execute()
com.stardust.autojs.engine.LoopBasedJavaScriptEngine.access$001()
d.g.c.n.c.run(:2)
android.os.Handler.handleCallback(Handler.java:751)
android.os.Handler.dispatchMessage(Handler.java:95)
android.os.Looper.loop(Looper.java:154)
com.stardust.autojs.engine.LoopBasedJavaScriptEngine.execute()
com.stardust.autojs.engine.LoopBasedJavaScriptEngine.execute()
com.stardust.autojs.execution.LoopedBasedJavaScriptExecution.doExecution()
com.stardust.autojs.execution.RunnableScriptExecution.execute()
com.stardust.autojs.execution.RunnableScriptExecution.execute()
com.stardust.autojs.execution.RunnableScriptExecution.run()
java.lang.Thread.run(Thread.java:761)

  1. 可疑类, 用jadx搜索关键词 decrypt

com.stardust.autojs.engine.encryption.ScriptEncryption.decrypt(byte[], int, int)
com.stardust.autojs.engine.encryption.ScriptEncryption.decrypt d e f a u l t ( S c r i p t E n c r y p t i o n s c r i p t E n c r y p t i o n , b y t e [ ] b A r r , i n t i 2 , i n t i 3 , i n t i 4 , O b j e c t o b j ) c o m . s t a r d u s t . a u t o j s . e n g i n e . e n c r y p t i o n . S c r i p t E n c r y p t i o n . d e c r y p t ( b y t e [ ] b A r r , i n t i 2 , i n t i 3 ) c o m . s t a r d u s t . a u t o j s . p r o j e c t . P r o j e c t C o n f i g . S c r i p t E n c r y p t i o n default(ScriptEncryption scriptEncryption, byte[] bArr, int i2, int i3, int i4, Object obj) com.stardust.autojs.engine.encryption.ScriptEncryption.decrypt(byte[] bArr, int i2, int i3) com.stardust.autojs.project.ProjectConfig.ScriptEncryption default(ScriptEncryptionscriptEncryption,byte[]bArr,inti2,inti3,inti4,Objectobj)com.stardust.autojs.engine.encryption.ScriptEncryption.decrypt(byte[]bArr,inti2,inti3)com.stardust.autojs.project.ProjectConfig.ScriptEncryptionCompanion.decrypt(byte[] bArr, int i2, int i3)

总结

脚本打包使用离线加密的时候, javascript脚本本身应该先混淆一遍, 然后再用离线打包,

或者, 直接使用自带的离线Dex加密 或者 离线Snapshot加密

  1. List item
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
包括软件及打包apk插件 ------------------------ Auto.js使用JavaScript作为脚本语言,目前使用Rhino 1.7.7.2作为脚本引擎,支持ES5与部分ES6特性。 因为Auto.js是基于JavaScript的,学习Auto.js的API之前建议先学习JavaScript的基本语法和内置对象,可以使用教程前面的两个JavaScript教程链接来学习。 如果您想要使用TypeScript来开发,目前已经有开发者公布了一个可以把使用TypeScript进行Auto.js开发的工具,参见Auto.js DevTools。 如果想要在电脑而不是手机上开发Auto.js,可以使用VS Code以及相应的Auto.js插件使得在电脑上编辑的脚本能推送到手机运行,参见Auto.js-VSCode-Extension。 本文档的章节大致上是以模块来分的,总体上可以分成"自动操作"类模块(控件操作、触摸模拟、按键模拟等)和其他类模块(设备、应用、界面等)。 "自动操作"的部分又可以大致分为基于控件和基于坐标的操作。基于坐标的操作是传统按键精灵、触摸精灵等脚本软件采用的方式,通过屏幕坐标来点击、长按指定位置模拟操作,从而到达目的。例如click(100, 200), press(100, 200, 500)等。这种方式在游戏类脚本中比较有可行性,结合找图找色、坐标放缩功能也能达到较好的兼容性。但是,这种方式对一般软件脚本却难以达到想要的效果,而且这种方式需要安卓7.0版本以上或者root权限才能执行。所以对于一般软件脚本(例如批量添加联系人、自动提取短信验证码等等),我们采用基于控件的模拟操作方式,结合通知事情、按键事情等达成更好的工作流。这些部分的文档参见基于控件的操作和基于坐标的操作。 其他部分主要包括: app: 应用。启动应用,卸载应用,使用应用查看、编辑文件、访问网页,发送应用间广播等。 console: 控制台。记录运行的日志、错误、信息等。 device: 设备。获取设备屏幕宽高、系统版本等信息,控制设备音量、亮度等。 engines: 脚本引擎。用于启动其他脚本。 events: 事件与监听。按键监听,通知监听,触摸监听等。 floaty: 悬浮窗。用于显示自定义的悬浮窗。 files: 文件系统。文件创建、获取信息、读写。 http: HTTP。发送HTTP请求,例如GET, POST等。 images, colors: 图片和图色处理。截图,剪切图片,找图找色,读取保存图片等。 keys: 按键模拟。比如音量键、Home键模拟等。 shell: Shell命令。 threads: 多线程支持。 ui: UI界面。用于显示自定义的UI界面,和用户交互。 除此之外,Auto.js内置了对Promise。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值