apk逆向__懒人听书逆向

去会员之前

关键词搜索

搜索会员,看到AdverSwitchUtils()函数。

定位代码

由于apk 的代码被混淆了,因此没办法通过函数名来分辨出对应的函数功能,但是可以通过函数的代码来判断。

跳转到 bubei.tingshu.commonlib.account.a.Z() 函数内查看,可以看到会返回H()函数

可以看到H 函数返回一个boolean类型的值,因此可以直接hook这个函数。还可以更改vipExpireTime 的值,以及vipType的值。

Frida Hook绕过vip

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
'''
Author : tigerHu
Version : V1.0
Date : 2023-12-21 20:36:52
Description :
'''
#-*- coding:utf-8 -*-
import frida
import sys
import os

def adb_forward():
os.system('adb forward tcp:27042 tcp:27042')
os.system('adb forward tcp:27043 tcp:27043')


jscode = """
Java.perform(function(){
let a = Java.use("bubei.tingshu.commonlib.account.a");
a["H"].implementation = function (i10, j5) {
console.log('H is called' + ', ' + 'i10: ' + i10 + ', ' + 'j5: ' + j5);
let ret = this.H(i10, j5);
console.log('H ret value is ' + ret);
return true;
};
});
"""

def on_message(message, data):
if message['type'] == 'send':
print("[*] {0}".format(message['payload']))
else:
print(message)
adb_forward()
# 查找远程设备并附加到目标进程
# frida.get_remote_device() 远程设备,模拟器
# frida.get_usb_device 获取usb 设备
process = frida.get_usb_device().attach(4603)
#pid = device.spawn(["com.android.chrome"])
#session = device.attach(pid)
#device.resume(pid)
# 在目标进程里创建脚本
script = process.create_script(jscode)
# 注册消息回调
script.on("message", on_message)
print('[*] Hook Start Running')
# 加载创建好的javascript 脚本
script.load()
# 读取系统输入
sys.stdin.read()

frida hook会员剩余时间

在会员页,看到还有0天后过期,看的难受,于是改一下吧。

尝试修改Shared_prefs 文件(失败)

根据字符串信息,可以 vip 过期时间 的设定的函数。

可以直接hook i() 函数,hook 函数的两个参数。
继续往下看,可以看到 r() 函数的函数方法,猜测是获取SharePreferences 内的account_info的值。

使用对应的busybox vi 打开,因为android内没有 vi 命令。
修改为如下

猜测是每次登录的时候,会请求平台的账号信息,然后保存在 account_info
重新进入app,没有改变。

关键词搜索

找到对应的字符串,

找到引用的函数,如果大于7天,那就显示”您已是会员“,如果小于7天,就显示还剩下几天

找到这个 g() 函数,这个函数会根据传入的字符串获取SharePreferences内account_info.xml对应的值,直接hook这个函数。

HOOK 代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
        Java.perform(function(){ 
let a = Java.use("bubei.tingshu.commonlib.account.a");
a["g"].implementation = function (str, i10) {
console.log('g is called' + ', ' + 'str: ' + str + ', ' + 'i10: ' + i10);
if(str == "timeRemaining"){
i10 = 10;
console.log("get timeRemaining" + i10);
let ret = this.g(str, i10);
console.log('timeRemaining ret value is ' + ret);
return 10;
}
else{
let ret = this.g(str, i10);
console.log('g ret value is ' + ret);
return ret;
}
};
});

去会员后


apk逆向__懒人听书逆向
https://tig3rhu.github.io/2024/01/07/68__逆向__懒人听书去会员/
Author
Tig3rHu
Posted on
January 7, 2024
Licensed under