QQ: 1659809758
魔改 Rhino 源码 ,
使用IDEA 运行 java 进行 js 转 dex
https://github.com/xxxxue/Autojs_Rhino_Dex_Self
家(203118908) 大佬开源的地址
https://github.com/snailuncle/batchJs2Dex
仓库应该已经更新了 , 点击进入 这篇博文中使用的分支,
http://jshaman.com/protect.html
混淆之前 将 UI 剪切 出来
混淆成功后 将 JS 代码 粘贴到 VSCode 中 并将 UI代码 粘贴到 对应的 位置
手动批量 将 {{ 绑定值 }} 格式的 UI 绑定 .修改为 混淆后的变量名
使用 VSCode运行 … 确定 无误后 将 JS 代码 放入 aaa.js
aaa.js 文件 地址 改为你自己电脑上的路径
-nosource 编译后的class 去掉 js 源码
-encoding 设置 编码格式. 默认的 是 GBK 会 中文乱码
@echo off
Setlocal enabledelayedexpansion
echo org.mozilla.javascript.tools.jsc.Main.main(["-nosource","-encoding", "UTF-8","E:/Work/GitHub/batchJs2Dex/other/aaa.js"]) | java -jar rhino1712.jar
pause && exit
start cmd /k "dx --dex --output =aaa.dex aaa.class"
免费版 4.1.1
其他版本 出错的话,自己改一改
如果调试 Dex 依然是 乱码的话,
就试一试 打包后的apk,
打包的apk 执行Dex 不乱码 就可以了
按 返回键的 方式 无法完全 杀掉 后台. app 依然会使用 dex 的缓存.
正确的操作方法是
点击 Home 键 旁边的 任务键,
将 app 手动 关闭,(杀掉后台)
再打开app 即可 更新到最新的版本
"ui";
var DexName = "aaa.dex";
var DexVersionName = "DexVersion.js";
//本地文件
var LocalDirPath = "/sdcard/代码侠辅助/";
var LocalDexPath = LocalDirPath + DexName;
var LocalVersionFilePath = LocalDirPath + DexVersionName;
//网络文件
var RemoteHost = "http://自己的地址/";
var RemoteDexFilePath = RemoteHost + DexName;
var RemoteVersionFilePath = RemoteHost + DexVersionName;
var Header = {
headers: {
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3754.400 QQBrowser/10.5.4034.400 ",
},
};
/**
* 开始运行
*/
function Run() {
try {
var checkState = false;
//更新
threads
.start(function () {
checkState = CheckVersion();
})
.join();
if (checkState) {
//加载dex并运行
runtime.loadDex(LocalDexPath);
new Packages["aaa"]()();
}
} catch (error) {
toast("检查更新状态失败\n" + error);
console.warn("Run Error: " + error);
}
}
/**
* 检查版本
*/
function CheckVersion() {
var res = true;
try {
if (!files.exists(LocalVersionFilePath)) {
console.log("创建版本文件");
files.createWithDirs(LocalVersionFilePath);
/** 默认值 */
files.write(LocalVersionFilePath, "0.0.0");
}
var localVersion = files.read(LocalVersionFilePath);
var remoteVersion = http.get(RemoteVersionFilePath,Header).body.string();
if (localVersion != remoteVersion || !files.exists(LocalDexPath)) {
console.warn("本地版本: " + localVersion);
console.warn("远程版本: " + remoteVersion);
if (DownloadDex()) {
files.write(LocalVersionFilePath, remoteVersion);
} else {
//res = false;
}
} else {
toast("最新版,无需更新");
}
} catch (error) {
console.warn("CheckVersion Error: " + error);
toast("检查版本发生异常\n" + error);
//OpenLog();
}
return res;
}
/**
* 下载Dex
*/
function DownloadDex() {
var res = false;
try {
console.warn("dex开始更新");
var res = http.get(RemoteDexFilePath,Header);
if (Http200(res)) {
files.writeBytes(LocalDexPath, res.body.bytes());
if (files.exists(LocalDexPath)) {
console.warn("dex更新成功");
toast("更新成功");
res = true;
}
} else {
console.warn("DownloadDex 下载失败: " + res);
toast("DownloadDex 下载失败: " + res);
OpenLog();
threads.shutDownAll();
sleep(99999);
}
} catch (error) {
console.warn("DownloadDex Error: " + error);
toast("下载新的dex 异常.\n" + error);
// OpenLog();
}
return res;
}
/**
* 判断是否 不是 空
* @param {any}} content 内容
*/
function IsNotNullOrEmpty(content) {
return content != null && content != undefined && Trim(content).length > 0;
}
/**
* http200验证
* @param {object} content http返回的json
*/
function Http200(content) {
return (
IsNotNullOrEmpty(content) &&
(content.statusCode == 200 || content.statusCode == "200")
);
}
/**
* 去除左右空格
* @param {string} content
*/
function Trim(content) {
return (content + "").replace(/(^\s*)|(\s*$)/g, "");
}
function OpenLog() {
ui.run(function () {
// app.startActivity("console");
});
}
Run();