generated from amosproj/amos202Xss0Y-projname
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #143 from amosproj/117-finding-symbols-from-oat
Finding symbols from oat/dex files
- Loading branch information
Showing
21 changed files
with
840 additions
and
355 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,5 @@ | |
/captures | ||
.externalNativeBuild | ||
.cxx | ||
local.properties | ||
local.properties | ||
.kotlin |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
// SPDX-FileCopyrightText: 2024 Felix Hilgers <[email protected]> | ||
// SPDX-FileCopyrightText: 2024 Robin Seidl <[email protected]> | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
|
@@ -38,6 +39,10 @@ sealed class Event { | |
|
||
data class Process(val pid: Int, val ppid: Int, val state: String, val cmd: Command?) | ||
|
||
data class StringResponse(val name: String) | ||
|
||
data class Symbol(val method: String, val offset: ULong) | ||
|
||
sealed class Command { | ||
data class Cmdline(val components: List<String>) : Command() | ||
|
||
|
@@ -67,6 +72,10 @@ interface Client { | |
|
||
suspend fun setConfiguration(configuration: Configuration) | ||
|
||
suspend fun getOdexFiles(pid: UInt): Flow<String> | ||
|
||
suspend fun getSymbols(odexFilePath: String): Flow<Symbol> | ||
|
||
suspend fun initStream(): Flow<Event> | ||
} | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
// SPDX-FileCopyrightText: 2024 Felix Hilgers <[email protected]> | ||
// SPDX-FileCopyrightText: 2024 Luca Bretting <[email protected]> | ||
// SPDX-FileCopyrightText: 2024 Robin Seidl <[email protected]> | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
|
@@ -109,6 +110,56 @@ object RustClient : Client { | |
} | ||
} | ||
} | ||
|
||
override suspend fun getOdexFiles(pid: UInt): Flow<String> = flow { | ||
emit("/system/framework/oat/x86_64/android.test.base.odex") | ||
emit("/system/framework/oat/x86_64/android.hidl.base-V1.0-java.odex") | ||
emit("/system/framework/oat/x86_64/org.apache.http.legacy.odex") | ||
emit("/system/framework/oat/x86_64/android.hidl.manager-V1.0-java.odex") | ||
emit("/system_ext/framework/oat/x86_64/androidx.window.sidecar.odex") | ||
emit( | ||
"/data/app/~~0cD8TtY5ggbzXOrlKANgwQ==/de.amosproj3.ziofa-Sm8ZemAtgxCr5VAK1Cwi8Q==/oat/x86_64/base.odex" | ||
) | ||
|
||
emit("/system_ext/framework/oat/x86_64/androidx.window.extensions.odex") | ||
} | ||
|
||
override suspend fun getSymbols(odexFilePath: String): Flow<Symbol> = flow { | ||
emit( | ||
Symbol( | ||
method = | ||
"void androidx.compose.material3.SearchBarDefaults\$InputField\$1\$1.<init>(kotlin.jvm.functions.Function1)", | ||
offset = 6012800u, | ||
) | ||
) | ||
emit( | ||
Symbol( | ||
method = | ||
"void kotlin.collections.ArraysKt___ArraysKt\$asSequence\$\$inlined\$Sequence\$2.<init>(byte[])", | ||
offset = 5915712u, | ||
) | ||
) | ||
emit( | ||
Symbol( | ||
method = | ||
"boolean androidx.compose.ui.platform.ViewLayer\$Companion.getHasRetrievedMethod()", | ||
offset = 24010112u, | ||
) | ||
) | ||
emit( | ||
Symbol( | ||
method = | ||
"androidx.core.app.NotificationCompat\$BubbleMetadata androidx.core.app.NotificationCompat\$BubbleMetadata\$Api29Impl.fromPlatform(android.app.Notification\$BubbleMetadata)", | ||
offset = 25453376u, | ||
) | ||
) | ||
emit( | ||
Symbol( | ||
method = "byte androidx.emoji2.text.flatbuffer.FlexBuffers\$Blob.get(int)", | ||
offset = 26906336u, | ||
) | ||
) | ||
} | ||
} | ||
|
||
class RustClientFactory(val url: String) : ClientFactory { | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
// SPDX-FileCopyrightText: 2024 Felix Hilgers <[email protected]> | ||
// SPDX-FileCopyrightText: 2024 Robin Seidl <[email protected]> | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
|
@@ -77,6 +78,10 @@ private fun Configuration.into() = | |
}, | ||
) | ||
|
||
private fun uniffi.shared.StringResponse.into() = StringResponse(name) | ||
|
||
private fun uniffi.shared.Symbol.into() = Symbol(method, offset) | ||
|
||
class RustClient(private val inner: uniffi.client.Client) : Client { | ||
|
||
override suspend fun serverCount(): Flow<UInt> = inner.serverCountFlow() | ||
|
@@ -102,6 +107,12 @@ class RustClient(private val inner: uniffi.client.Client) : Client { | |
override suspend fun setConfiguration(configuration: Configuration) = | ||
inner.setConfiguration(configuration.into()) | ||
|
||
override suspend fun getOdexFiles(pid: UInt): Flow<String> = | ||
inner.getOdexFilesFlow(pid).mapNotNull { it.into().name } | ||
|
||
override suspend fun getSymbols(odexFilePath: String): Flow<Symbol> = | ||
inner.getSymbolFlow(odexFilePath).mapNotNull { it.into() } | ||
|
||
override suspend fun initStream(): Flow<Event> = inner.initStreamFlow().mapNotNull { it.into() } | ||
} | ||
|
||
|
@@ -141,3 +152,19 @@ fun uniffi.client.Client.initStreamFlow() = flow { | |
} | ||
} | ||
} | ||
|
||
fun uniffi.client.Client.getOdexFilesFlow(pid: UInt) = flow { | ||
getOdexFiles(pid).use { stream -> | ||
while (true) { | ||
stream.next()?.also { file -> emit(file) } ?: break | ||
} | ||
} | ||
} | ||
|
||
fun uniffi.client.Client.getSymbolFlow(odexFilePath: String) = flow { | ||
getSymbols(odexFilePath).use { stream -> | ||
while (true) { | ||
stream.next()?.also { symbol -> emit(symbol) } ?: break | ||
} | ||
} | ||
} |
Oops, something went wrong.