Last active
June 25, 2022 02:59
-
-
Save michelerenzullo/384617be130247e7e988f83024c2d18f to your computer and use it in GitHub Desktop.
smali function to patch bytes in a target library - SSL Unpinning in Workplace 372.0.0.20.107-378066467 arm64 by Meta
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.method public static patcher()V | |
.locals 4 | |
.line 15 | |
new-instance v0, Ljava/io/File; | |
const-string v1, "/data/data/com.facebook.work/lib-compressed/libxplat_fizz_client_protocolAndroid.so" | |
invoke-direct {v0, v1}, Ljava/io/File;-><init>(Ljava/lang/String;)V | |
.line 16 | |
invoke-virtual {v0}, Ljava/io/File;->exists()Z | |
move-result v2 | |
if-eqz v2, :cond_0 | |
const/4 v2, 0x1 | |
const/4 v3, 0x0 | |
.line 17 | |
invoke-virtual {v0, v2, v3}, Ljava/io/File;->setReadable(ZZ)Z | |
.line 18 | |
invoke-virtual {v0, v2, v3}, Ljava/io/File;->setWritable(ZZ)Z | |
.line 19 | |
new-instance v0, Ljava/io/RandomAccessFile; | |
const-string v2, "rw" | |
invoke-direct {v0, v1, v2}, Ljava/io/RandomAccessFile;-><init>(Ljava/lang/String;Ljava/lang/String;)V | |
const-wide/32 v1, 0x1dfc0 | |
.line 20 | |
invoke-virtual {v0, v1, v2}, Ljava/io/RandomAccessFile;->seek(J)V | |
const/4 v1, 0x7 | |
.line 21 | |
invoke-virtual {v0, v1}, Ljava/io/RandomAccessFile;->write(I)V | |
.line 22 | |
invoke-virtual {v0, v3}, Ljava/io/RandomAccessFile;->write(I)V | |
.line 23 | |
invoke-virtual {v0, v3}, Ljava/io/RandomAccessFile;->write(I)V | |
const/16 v1, 0x14 | |
.line 24 | |
invoke-virtual {v0, v1}, Ljava/io/RandomAccessFile;->write(I)V | |
.line 25 | |
invoke-virtual {v0}, Ljava/io/RandomAccessFile;->close()V | |
:cond_0 | |
return-void | |
.end method |
Author
michelerenzullo
commented
Jun 25, 2022
- Added check if file exists
- New version, new offset
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment