破解Autojs Pro

破解Autojs Pro

使用了360加固保,需要先脱壳。

测试版本:

  • 7.x: 7.0.4-1

  • 8.x: 8.5.90

7.x

查找字符串paidServices,发现一个返回值为boolean的函数,疑似为关键函数。

image-20210207144410926

hook这个函数使其返回值为true后,打开软件提示验证失败。抓包发现会发送一个验证请求。

URL: https://pro.autojs.org/api/v1/security/validation

且返回的数据会在so中校验。

先解决返回数据的问题。没购买的账号会返回401,根本不会进入so校验的流程。

hook okhttp3.Request$Builde的构造函数,修改网址,重定向到指定的URL,使其能收到一个JSON。顺便重定向/api/v1/account的请求,达到免登陆的目的。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Class Builder = XposedHelpers.findClass("okhttp3.Request$Builder", classLoader);
findAndHookConstructor("okhttp3.Request", classLoader, Builder, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
Object thiz = param.thisObject;
Field field_url = thiz.getClass().getDeclaredField("url");
field_url.setAccessible(true);
String url = field_url.get(thiz).toString();
if(url.contains("https://pro.autojs.org/api/v1/account")){
XposedBridge.log("replace "+url);
Class HttpUrl = XposedHelpers.findClass("okhttp3.HttpUrl", classLoader);
Object new_url = XposedHelpers.callStaticMethod(HttpUrl, "get", "https://xxx.com/api/v1/account");
field_url.set(thiz, new_url);
}
if(url.contains("https://pro.autojs.org/api/v1/security/validation")){
XposedBridge.log("replace "+url);
Class HttpUrl = XposedHelpers.findClass("okhttp3.HttpUrl", classLoader);
Object new_url = XposedHelpers.callStaticMethod(HttpUrl, "get", "https://xxx.com/api/v1/security/validation");
field_url.set(thiz, new_url);
}
}
}

再来通过patch so文件解决校验的问题。

patch前:

image-20210207145546091

Patch后:

image-20210207145606526

至此,Autojs Pro 7.x就破解成功了。

8.x

同7.x,可以快速定位到关键函数。

image-20210207144238685

hook这个函数并尝试重定向验证请求,失败。抓包也不能抓到验证请求的数据包。

通过分析发现验证请求使用Dart写的,编译成so文件(根本没办法逆向分析),同时还开启了ssl-pinning。没办法通过重定向、修改返回数据包等方式绕过校验请求了。

Hook Dart与原生程序的通信的相关函数,发现只要不让Dart获取到Webview的cookie(autojs使用了webview账号),就不会发送验证请求。

不发验证请求也就不会401的窗口,也不必管so中的校验了。

1
2
3
4
5
6
7
8
9
10
11
Class ByteBuffer = XposedHelpers.findClass("java.nio.ByteBuffer", classLoader);
findAndHookMethod("io.flutter.embedding.engine.FlutterJNI", classLoader, "invokePlatformMessageResponseCallback",int.class,ByteBuffer,int.class, new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
int arg2 = (int)param.args[2];
if(arg2 == 164){
return null;
}
return XposedBridge.invokeOriginalMethod(param.method, param.thisObject, param.args);
}
}

授权就破解成功了。

但8.x为了防黑产滥用,屏蔽了一些热门APP,如微信、QQ、支付宝。

无法使用Autojs在这些页面上查找控件。

Hookjava.lang.String.equals()并打印堆栈信息,很快就定位到了两个比较包名的函数(其中一个是将包名md5后进行比较)。

image-20210207151101146

image-20210207151821502

修改这两个函数的返回值就可以绕过Autojs 8.x的屏蔽了。

image-20210207151455976