-
Notifications
You must be signed in to change notification settings - Fork 1
/
Xposed.smali
525 lines (357 loc) · 12.1 KB
/
Xposed.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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
.class public Lmt/Xposed;
.super Landroid/content/ContentProvider;
# interfaces
.implements Ljava/lang/Runnable;
# instance fields
.field private final scheduler:Ljava/util/concurrent/ScheduledExecutorService;
# direct methods
.method public constructor <init>()V
.registers 2
.prologue
.line 19
invoke-direct {p0}, Landroid/content/ContentProvider;-><init>()V
.line 20
const/4 v0, 0x1
invoke-static {v0}, Ljava/util/concurrent/Executors;->newScheduledThreadPool(I)Ljava/util/concurrent/ScheduledExecutorService;
move-result-object v0
iput-object v0, p0, Lmt/Xposed;->scheduler:Ljava/util/concurrent/ScheduledExecutorService;
return-void
.end method
.method private static checkXpFormMap()Z
.registers 9
.prologue
const/4 v6, 0x1
.line 92
invoke-static {}, Landroid/os/Process;->myPid()I
move-result v0
.line 93
.local v0, "Pid":I
if-gez v0, :cond_26
.line 94
new-instance v3, Ljava/io/File;
const-string v7, "/proc/self/maps"
invoke-direct {v3, v7}, Ljava/io/File;-><init>(Ljava/lang/String;)V
.line 99
.local v3, "maps":Ljava/io/File;
:goto_e
:try_start_e
new-instance v5, Ljava/io/BufferedReader;
new-instance v7, Ljava/io/InputStreamReader;
new-instance v8, Ljava/io/FileInputStream;
invoke-direct {v8, v3}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V
invoke-direct {v7, v8}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;)V
invoke-direct {v5, v7}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V
.line 101
.local v5, "reader":Ljava/io/BufferedReader;
:cond_1d
invoke-virtual {v5}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;
:try_end_20
.catch Ljava/lang/Exception; {:try_start_e .. :try_end_20} :catch_66
move-result-object v4
.line 102
.local v4, "readLine":Ljava/lang/String;
move-object v2, v4
.line 103
.local v2, "line":Ljava/lang/String;
if-nez v4, :cond_45
.line 104
const/4 v6, 0x0
.line 113
.end local v2 # "line":Ljava/lang/String;
.end local v4 # "readLine":Ljava/lang/String;
.end local v5 # "reader":Ljava/io/BufferedReader;
:cond_25
:goto_25
return v6
.line 96
.end local v3 # "maps":Ljava/io/File;
:cond_26
new-instance v3, Ljava/io/File;
new-instance v7, Ljava/lang/StringBuilder;
invoke-direct {v7}, Ljava/lang/StringBuilder;-><init>()V
const-string v8, "/proc/"
invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v7
invoke-virtual {v7, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v7
const-string v8, "/maps"
invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v7
invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v7
invoke-direct {v3, v7}, Ljava/io/File;-><init>(Ljava/lang/String;)V
.restart local v3 # "maps":Ljava/io/File;
goto :goto_e
.line 106
.restart local v2 # "line":Ljava/lang/String;
.restart local v4 # "readLine":Ljava/lang/String;
.restart local v5 # "reader":Ljava/io/BufferedReader;
:cond_45
:try_start_45
const-string v7, "libdexposed"
invoke-virtual {v2, v7}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z
move-result v7
if-nez v7, :cond_25
const-string v7, "libsubstrate.so"
invoke-virtual {v2, v7}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z
move-result v7
if-nez v7, :cond_25
const-string v7, "libepic.so"
invoke-virtual {v2, v7}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z
move-result v7
if-nez v7, :cond_25
.line 109
const-string v7, "libxposed"
invoke-virtual {v2, v7}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z
:try_end_62
.catch Ljava/lang/Exception; {:try_start_45 .. :try_end_62} :catch_66
move-result v7
if-eqz v7, :cond_1d
goto :goto_25
.line 111
.end local v2 # "line":Ljava/lang/String;
.end local v4 # "readLine":Ljava/lang/String;
.end local v5 # "reader":Ljava/io/BufferedReader;
:catch_66
move-exception v1
.line 112
.local v1, "e":Ljava/lang/Exception;
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
goto :goto_25
.end method
.method private static isHookByStack()Z
.registers 9
.prologue
.line 66
const/4 v1, 0x0
.line 68
.local v1, "isHook":Z
:try_start_1
new-instance v4, Ljava/lang/Exception;
const-string v5, "blah"
invoke-direct {v4, v5}, Ljava/lang/Exception;-><init>(Ljava/lang/String;)V
throw v4
:try_end_9
.catch Ljava/lang/Exception; {:try_start_1 .. :try_end_9} :catch_9
.line 69
:catch_9
move-exception v0
.line 70
.local v0, "e":Ljava/lang/Exception;
const/4 v3, 0x0
.line 71
.local v3, "zygoteInitCallCount":I
invoke-virtual {v0}, Ljava/lang/Exception;->getStackTrace()[Ljava/lang/StackTraceElement;
move-result-object v5
array-length v6, v5
const/4 v4, 0x0
:goto_11
if-ge v4, v6, :cond_75
aget-object v2, v5, v4
.line 72
.local v2, "stackTraceElement":Ljava/lang/StackTraceElement;
invoke-virtual {v2}, Ljava/lang/StackTraceElement;->getClassName()Ljava/lang/String;
move-result-object v7
const-string v8, "com.android.internal.os.ZygoteInit"
invoke-virtual {v7, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v7
if-eqz v7, :cond_27
add-int/lit8 v3, v3, 0x1
const/4 v7, 0x2
if-ne v3, v7, :cond_27
.line 73
const/4 v1, 0x1
.line 75
:cond_27
invoke-virtual {v2}, Ljava/lang/StackTraceElement;->getClassName()Ljava/lang/String;
move-result-object v7
const-string v8, "com.saurik.substrate.MS$2"
invoke-virtual {v7, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v7
if-eqz v7, :cond_40
invoke-virtual {v2}, Ljava/lang/StackTraceElement;->getMethodName()Ljava/lang/String;
move-result-object v7
const-string v8, "invoked"
invoke-virtual {v7, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v7
if-eqz v7, :cond_40
.line 76
const/4 v1, 0x1
.line 78
:cond_40
invoke-virtual {v2}, Ljava/lang/StackTraceElement;->getClassName()Ljava/lang/String;
move-result-object v7
const-string v8, "de.robv.android.xposed.XposedBridge"
invoke-virtual {v7, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v7
if-eqz v7, :cond_59
invoke-virtual {v2}, Ljava/lang/StackTraceElement;->getMethodName()Ljava/lang/String;
move-result-object v7
const-string v8, "main"
invoke-virtual {v7, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v7
if-eqz v7, :cond_59
.line 79
const/4 v1, 0x1
.line 81
:cond_59
invoke-virtual {v2}, Ljava/lang/StackTraceElement;->getClassName()Ljava/lang/String;
move-result-object v7
const-string v8, "de.robv.android.xposed.XposedBridge"
invoke-virtual {v7, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v7
if-eqz v7, :cond_72
invoke-virtual {v2}, Ljava/lang/StackTraceElement;->getMethodName()Ljava/lang/String;
move-result-object v7
const-string v8, "handleHookedMethod"
invoke-virtual {v7, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v7
if-eqz v7, :cond_72
.line 82
const/4 v1, 0x1
.line 71
:cond_72
add-int/lit8 v4, v4, 0x1
goto :goto_11
.line 85
.end local v2 # "stackTraceElement":Ljava/lang/StackTraceElement;
:cond_75
return v1
.end method
# virtual methods
.method public delete(Landroid/net/Uri;Ljava/lang/String;[Ljava/lang/String;)I
.registers 5
.param p1, "uri" # Landroid/net/Uri;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p2, "selection" # Ljava/lang/String;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end param
.param p3, "selectionArgs" # [Ljava/lang/String;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end param
.prologue
.line 48
const/4 v0, 0x0
return v0
.end method
.method public getType(Landroid/net/Uri;)Ljava/lang/String;
.registers 3
.param p1, "uri" # Landroid/net/Uri;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/Nullable;
.end annotation
.prologue
.line 37
const/4 v0, 0x0
return-object v0
.end method
.method public insert(Landroid/net/Uri;Landroid/content/ContentValues;)Landroid/net/Uri;
.registers 4
.param p1, "uri" # Landroid/net/Uri;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p2, "values" # Landroid/content/ContentValues;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end param
.annotation build Landroidx/annotation/Nullable;
.end annotation
.prologue
.line 43
const/4 v0, 0x0
return-object v0
.end method
.method public onCreate()Z
.registers 8
.prologue
.line 24
iget-object v0, p0, Lmt/Xposed;->scheduler:Ljava/util/concurrent/ScheduledExecutorService;
const-wide/16 v2, 0x0
const-wide/16 v4, 0x3
sget-object v6, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;
move-object v1, p0
invoke-interface/range {v0 .. v6}, Ljava/util/concurrent/ScheduledExecutorService;->scheduleAtFixedRate(Ljava/lang/Runnable;JJLjava/util/concurrent/TimeUnit;)Ljava/util/concurrent/ScheduledFuture;
.line 25
const/4 v0, 0x0
return v0
.end method
.method public query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;
.registers 7
.param p1, "uri" # Landroid/net/Uri;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p2, "projection" # [Ljava/lang/String;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end param
.param p3, "selection" # Ljava/lang/String;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end param
.param p4, "selectionArgs" # [Ljava/lang/String;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end param
.param p5, "sortOrder" # Ljava/lang/String;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end param
.annotation build Landroidx/annotation/Nullable;
.end annotation
.prologue
.line 31
const/4 v0, 0x0
return-object v0
.end method
.method public run()V
.registers 3
.prologue
const/4 v1, 0x1
.line 58
invoke-static {}, Lmt/Xposed;->checkXpFormMap()Z
move-result v0
if-eqz v0, :cond_a
.line 59
invoke-static {v1}, Ljava/lang/System;->exit(I)V
.line 60
:cond_a
invoke-static {}, Lmt/Xposed;->isHookByStack()Z
move-result v0
if-eqz v0, :cond_13
.line 61
invoke-static {v1}, Ljava/lang/System;->exit(I)V
.line 62
:cond_13
return-void
.end method
.method public update(Landroid/net/Uri;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I
.registers 6
.param p1, "uri" # Landroid/net/Uri;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p2, "values" # Landroid/content/ContentValues;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end param
.param p3, "selection" # Ljava/lang/String;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end param
.param p4, "selectionArgs" # [Ljava/lang/String;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end param
.prologue
.line 53
const/4 v0, 0x0
return v0
.end method