声明:本文章仅做技术研究,请勿用于非法用途。
这个软件试用版有时间限制,过期来就无法使用,需要注册。
用到的工具:APKTOOL、Notepad++
首先用APKTOOL反编译apk
1、搜索关键字“试用”,找到string.xml当中:
<string name="enter_key">输入解锁码</string>
<string name="no_days_left_in_trial">试用期已到期。</string>
<string name="x_days_left_in_trial">试用期还剩%d天。</string>
2、再次搜索no_days_left_in_trial,找到public.xml:
2135 <public type="string" name="untitled_file_name" id="0x7f0b0202" />
2136 <public type="string" name="enter_key" id="0x7f0b0203" />
2137: <public type="string" name="no_days_left_in_trial" id="0x7f0b0204" />
2138 <public type="string" name="x_days_left_in_trial" id="0x7f0b0205" />
2139 <public type="string" name="enter_key_button" id="0x7f0b0206" />
3、下面查找smali文件中在哪里调用了"no_days_left_in_trial"字符串,搜索:0x7f0b0204
smali文件中:\smali\com\mobisystems\registration\c.smali:
method public static a(Landroid/content/Context;Lcom/mobisystems/registration/d;)Ljava/lang/String;
.locals 4
invoke-virtual {p1}, Lcom/mobisystems/registration/d;->auN()Z //判断是否过期,返回值为1过期,为0不过期
move-result v0
if-eqz v0, :cond_0 //关键点,不过期就判断还剩下多少天
const v0, 0x7f0b0204
invoke-virtual {p0, v0}, Landroid/content/Context;->getString(I)Ljava/lang/String;
move-result-object v0
:goto_0
return-object v0
:cond_0
invoke-virtual {p1}, Lcom/mobisystems/registration/d;->auQ()I
move-result v0
const v1, 0x7f0b0205 //试用期还剩%d天。
invoke-virtual {p0, v1}, Landroid/content/Context;->getString(I)Ljava/lang/String;
move-result-object v1
const/4 v2, 0x1
new-array v2, v2, [Ljava/lang/Object;
const/4 v3, 0x0
invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v0
aput-object v0, v2, v3
invoke-static {v1, v2}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
move-result-object v0
goto :goto_0
.end method
上面的代码是经过混淆处理了的,但是我们还是可以通过上下文来推测其中的关键部分。
4、查看Lcom/mobisystems/registration/d;->auN()Z函数,想办法让其返回值始终为0,即永不过期。
.method public declared-synchronized auN()Z
.locals 2
monitor-enter p0
:try_start_0
iget-boolean v0, p0, Lcom/mobisystems/registration/d;->cCw:Z
if-nez v0, :cond_0
invoke-virtual {p0}, Lcom/mobisystems/registration/d;->auO()I
move-result v0
iget-short v1, p0, Lcom/mobisystems/registration/d;->cCq:S
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
if-lt v0, v1, :cond_0
const/4 v0, 0x1 //修改其值为0,让其返回值始终为0
:goto_0
monitor-exit p0
return v0 //v0为返回值
:cond_0
const/4 v0, 0x0
goto :goto_0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
5、至此,可以无限制使用,但是第一次运行程序还是会弹出解锁的框。
下面再改造一下使其成为已注册版,不再弹出解锁的框。
6、搜索"Lcom/mobisystems/registration/c;->a"找到smali\com\mobisystems\office\ai.smali:有调用该函数。
com/mobisystems/office/ai.smali中:
.method public static B(Landroid/content/Context;)Ljava/lang/String;
.locals 2
invoke-static {p0}, Lcom/mobisystems/office/ai;->A(Landroid/content/Context;)Lcom/mobisystems/registration/d;
move-result-object v0
invoke-virtual {v0}, Lcom/mobisystems/registration/d;->auM()Z //判断是否已经注册,返回值1为已注册,0为未注册。
move-result v1
if-eqz v1, :cond_0
const v0, 0x7f0b020c //已经注册
invoke-virtual {p0, v0}, Landroid/content/Context;->getString(I)Ljava/lang/String;
move-result-object v0
:goto_0
return-object v0
:cond_0
invoke-static {p0, v0}, Lcom/mobisystems/registration/c;->a(Landroid/content/Context;Lcom/mobisystems/registration/d;)Ljava/lang/String;
move-result-object v0
goto :goto_0
.end method
其中 通过查找"0x7f0b020c",<public type="string" name="already_registered" id="0x7f0b020c" /> 可以发现是已经注册的字符串信息。
看看auM()Z函数的具体内容;
.method public declared-synchronized auM()Z
.locals 1
monitor-enter p0
:try_start_0
iget-boolean v0, p0, Lcom/mobisystems/registration/d;->cCw:Z
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
monitor-exit p0
return v0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
在return v0之前给返回值v0赋值为1,重建APK,签名,测试,已经注册。
至此,完成注册版本。
附上修改后的apk链接:
http://pan.baidu.com/share/link?shareid=177747&uk=3173678082
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)