-
Notifications
You must be signed in to change notification settings - Fork 221
/
Copy pathPmsHookBinderInvocationHandler.smali
189 lines (122 loc) · 5.09 KB
/
PmsHookBinderInvocationHandler.smali
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
.class public Lcn/wjdiankong/hookpms/PmsHookBinderInvocationHandler;
.super Ljava/lang/Object;
.source "PmsHookBinderInvocationHandler.java"
# interfaces
.implements Ljava/lang/reflect/InvocationHandler;
# instance fields
.field private SIGN:Ljava/lang/String;
.field private appPkgName:Ljava/lang/String;
.field private base:Ljava/lang/Object;
# direct methods
.method public constructor <init>(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;I)V
.locals 4
.param p1, "base" # Ljava/lang/Object;
.param p2, "sign" # Ljava/lang/String;
.param p3, "appPkgName" # Ljava/lang/String;
.param p4, "hashCode" # I
.prologue
.line 22
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 20
const-string v1, ""
iput-object v1, p0, Lcn/wjdiankong/hookpms/PmsHookBinderInvocationHandler;->appPkgName:Ljava/lang/String;
.line 24
:try_start_0
iput-object p1, p0, Lcn/wjdiankong/hookpms/PmsHookBinderInvocationHandler;->base:Ljava/lang/Object;
.line 25
iput-object p2, p0, Lcn/wjdiankong/hookpms/PmsHookBinderInvocationHandler;->SIGN:Ljava/lang/String;
.line 26
iput-object p3, p0, Lcn/wjdiankong/hookpms/PmsHookBinderInvocationHandler;->appPkgName:Ljava/lang/String;
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
.line 30
:goto_0
return-void
.line 27
:catch_0
move-exception v0
.line 28
.local v0, "e":Ljava/lang/Exception;
const-string v1, "jw"
new-instance v2, Ljava/lang/StringBuilder;
const-string v3, "error:"
invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-static {v0}, Landroid/util/Log;->getStackTraceString(Ljava/lang/Throwable;)Ljava/lang/String;
move-result-object v3
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
goto :goto_0
.end method
# virtual methods
.method public invoke(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;
.locals 7
.param p1, "proxy" # Ljava/lang/Object;
.param p2, "method" # Ljava/lang/reflect/Method;
.param p3, "args" # [Ljava/lang/Object;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/lang/Throwable;
}
.end annotation
.prologue
const/4 v6, 0x0
.line 34
const-string v4, "jw"
invoke-virtual {p2}, Ljava/lang/reflect/Method;->getName()Ljava/lang/String;
move-result-object v5
invoke-static {v4, v5}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I
.line 35
const-string v4, "getPackageInfo"
invoke-virtual {p2}, Ljava/lang/reflect/Method;->getName()Ljava/lang/String;
move-result-object v5
invoke-virtual {v4, v5}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v4
if-eqz v4, :cond_0
.line 36
aget-object v2, p3, v6
check-cast v2, Ljava/lang/String;
.line 37
.local v2, "pkgName":Ljava/lang/String;
const/4 v4, 0x1
aget-object v0, p3, v4
check-cast v0, Ljava/lang/Integer;
.line 38
.local v0, "flag":Ljava/lang/Integer;
invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I
move-result v4
const/16 v5, 0x40
if-ne v4, v5, :cond_0
iget-object v4, p0, Lcn/wjdiankong/hookpms/PmsHookBinderInvocationHandler;->appPkgName:Ljava/lang/String;
invoke-virtual {v4, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v4
if-eqz v4, :cond_0
.line 39
new-instance v3, Landroid/content/pm/Signature;
iget-object v4, p0, Lcn/wjdiankong/hookpms/PmsHookBinderInvocationHandler;->SIGN:Ljava/lang/String;
invoke-direct {v3, v4}, Landroid/content/pm/Signature;-><init>(Ljava/lang/String;)V
.line 40
.local v3, "sign":Landroid/content/pm/Signature;
iget-object v4, p0, Lcn/wjdiankong/hookpms/PmsHookBinderInvocationHandler;->base:Ljava/lang/Object;
invoke-virtual {p2, v4, p3}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v1
check-cast v1, Landroid/content/pm/PackageInfo;
.line 41
.local v1, "info":Landroid/content/pm/PackageInfo;
iget-object v4, v1, Landroid/content/pm/PackageInfo;->signatures:[Landroid/content/pm/Signature;
aput-object v3, v4, v6
.line 45
.end local v0 # "flag":Ljava/lang/Integer;
.end local v1 # "info":Landroid/content/pm/PackageInfo;
.end local v2 # "pkgName":Ljava/lang/String;
.end local v3 # "sign":Landroid/content/pm/Signature;
:goto_0
return-object v1
:cond_0
iget-object v4, p0, Lcn/wjdiankong/hookpms/PmsHookBinderInvocationHandler;->base:Ljava/lang/Object;
invoke-virtual {p2, v4, p3}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v1
goto :goto_0
.end method