Commit 71d4869
committed
feat(smalikit): add idempotent method append support and migrate HTMLViewer patch flow
SmaliKit enhancements:
- Add new append_method argument to SmaliArgs in both runtime paths (src/utils and core modifiers) to keep argument contracts aligned.
- Extend SmaliKit initialization to allow append-only operations without requiring method/seek filters.
- Implement append_method processing that appends method blocks only when the signature is missing, preserving idempotency.
- Expose append support in CLI via -am METHOD_SIGNATURE METHOD_BODY.
HTMLViewer refactor:
- Replace manual full-file regex rewrite in htmlviewer plugin with standard smali_patch flow.
- Keep doInBackground rewrite in SmaliKit (method+return_type+remake) and add helper method through append_method.
- Reuse shared _find_file helper from ApkModifierPlugin and remove plugin-local duplicate search logic.
- Remove now-unused imports tied to manual regex patching.
Tests:
- Add tests/utils/test_smalikit.py covering append_method behavior for both missing-signature append and existing-signature no-op paths.1 parent 2b48216 commit 71d4869
4 files changed
Lines changed: 123 additions & 35 deletions
File tree
- src
- core/modifiers
- plugins/apk
- utils
- tests/utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | | - | |
6 | 4 | | |
7 | 5 | | |
8 | 6 | | |
| |||
35 | 33 | | |
36 | 34 | | |
37 | 35 | | |
38 | | - | |
| 36 | + | |
39 | 37 | | |
40 | 38 | | |
41 | 39 | | |
| |||
49 | 47 | | |
50 | 48 | | |
51 | 49 | | |
52 | | - | |
53 | | - | |
| 50 | + | |
54 | 51 | | |
55 | 52 | | |
56 | 53 | | |
| |||
265 | 262 | | |
266 | 263 | | |
267 | 264 | | |
268 | | - | |
269 | 265 | | |
270 | 266 | | |
271 | 267 | | |
| |||
314 | 310 | | |
315 | 311 | | |
316 | 312 | | |
317 | | - | |
318 | | - | |
319 | | - | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
320 | 325 | | |
321 | 326 | | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | 327 | | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | 2 | | |
6 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| |||
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
64 | 70 | | |
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
68 | 74 | | |
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 | + | |
75 | 106 | | |
76 | 107 | | |
77 | 108 | | |
| |||
159 | 190 | | |
160 | 191 | | |
161 | 192 | | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
| 193 | + | |
166 | 194 | | |
167 | 195 | | |
168 | 196 | | |
| |||
188 | 216 | | |
189 | 217 | | |
190 | 218 | | |
191 | | - | |
| 219 | + | |
192 | 220 | | |
193 | 221 | | |
194 | 222 | | |
| |||
205 | 233 | | |
206 | 234 | | |
207 | 235 | | |
208 | | - | |
| 236 | + | |
| 237 | + | |
209 | 238 | | |
210 | 239 | | |
211 | 240 | | |
| |||
281 | 310 | | |
282 | 311 | | |
283 | 312 | | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
284 | 320 | | |
285 | 321 | | |
286 | 322 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
0 commit comments