禁用阿里系App一键登录

禁用阿里系App一键登录

https://help.aliyun.com/zh/pnvs/developer-reference/the-android-client-access

image-20240910133046131

1
com.mobile.auth.gatewayauth.PhoneNumberAuthHelperProxy.checkEnvAvailable(int, com.mobile.auth.gatewayauth.TokenResultListener) 

image-20240910133132341

1
2
3
4
5
6
7
findAndHookMethod("com.ali.user.number.auth.NumAuthComponent", classLoader, "initCheck", "com.ali.user.mobile.model.NumAuthCallback", new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
log("initCheck...");
return null;
}
});

更通用的方法

在初始化环境的时候会检查SIM卡状态,如果不存在SIM卡,就不能进行“一键登录”。

1
2
3
4
5
6
7
8
9
10
// com.ali.user.mobile.utils.NetworkUtil.checkEnv(android.content.Context) : boolean
public static boolean checkEnv(Context context0) {
return (NetworkUtil.hasSimCard(context0)) && !NetworkUtil.isAirModeEnable(context0) && (NetworkUtil.isMobileNetworkOpen(context0));
}


// com.ali.user.mobile.utils.NetworkUtil.hasSimCard(android.content.Context) : boolean
public static boolean hasSimCard(Context context0) {
return ((TelephonyManager)context0.getSystemService("phone")).getSimState() == 5;
}

Hook 代码:

1
2
3
4
5
6
findAndHookMethod(TelephonyManager.class, "getSimState", new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
return TelephonyManager.SIM_STATE_ABSENT;
}
});