don't rename platform classes
This commit is contained in:
parent
a999338cd0
commit
09448752c0
3 changed files with 25 additions and 7 deletions
14
patcher/Cargo.lock
generated
14
patcher/Cargo.lock
generated
|
|
@ -35,9 +35,10 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "androscalpel"
|
||||
version = "0.1.0"
|
||||
source = "git+ssh://git@gitlab.inria.fr/androidoftheseus/androscalpel.git?rev=3cc02a3#3cc02a32925db36b3398224a7604fcaa37ddc4d2"
|
||||
source = "git+ssh://git@gitlab.inria.fr/androidoftheseus/androscalpel.git?rev=1f2de8b#1f2de8b60daf3c2beba1193174e537175f939e4a"
|
||||
dependencies = [
|
||||
"adler",
|
||||
"androscalpel_platform_api_list",
|
||||
"androscalpel_serializer",
|
||||
"anyhow",
|
||||
"apk_frauder",
|
||||
|
|
@ -48,10 +49,15 @@ dependencies = [
|
|||
"sha1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "androscalpel_platform_api_list"
|
||||
version = "0.1.0"
|
||||
source = "git+ssh://git@gitlab.inria.fr/androidoftheseus/androscalpel.git?rev=1f2de8b#1f2de8b60daf3c2beba1193174e537175f939e4a"
|
||||
|
||||
[[package]]
|
||||
name = "androscalpel_serializer"
|
||||
version = "0.1.0"
|
||||
source = "git+ssh://git@gitlab.inria.fr/androidoftheseus/androscalpel.git?rev=3cc02a3#3cc02a32925db36b3398224a7604fcaa37ddc4d2"
|
||||
source = "git+ssh://git@gitlab.inria.fr/androidoftheseus/androscalpel.git?rev=1f2de8b#1f2de8b60daf3c2beba1193174e537175f939e4a"
|
||||
dependencies = [
|
||||
"androscalpel_serializer_derive",
|
||||
"log",
|
||||
|
|
@ -60,7 +66,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "androscalpel_serializer_derive"
|
||||
version = "0.1.0"
|
||||
source = "git+ssh://git@gitlab.inria.fr/androidoftheseus/androscalpel.git?rev=3cc02a3#3cc02a32925db36b3398224a7604fcaa37ddc4d2"
|
||||
source = "git+ssh://git@gitlab.inria.fr/androidoftheseus/androscalpel.git?rev=1f2de8b#1f2de8b60daf3c2beba1193174e537175f939e4a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -129,7 +135,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "apk_frauder"
|
||||
version = "0.1.0"
|
||||
source = "git+ssh://git@gitlab.inria.fr/androidoftheseus/androscalpel.git?rev=3cc02a3#3cc02a32925db36b3398224a7604fcaa37ddc4d2"
|
||||
source = "git+ssh://git@gitlab.inria.fr/androidoftheseus/androscalpel.git?rev=1f2de8b#1f2de8b60daf3c2beba1193174e537175f939e4a"
|
||||
dependencies = [
|
||||
"androscalpel_serializer",
|
||||
"anyhow",
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ edition = "2024"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
androscalpel = { git = "ssh://git@gitlab.inria.fr/androidoftheseus/androscalpel.git", rev = "3cc02a3", features = ["code-analysis"] }
|
||||
apk_frauder = { git = "ssh://git@gitlab.inria.fr/androidoftheseus/androscalpel.git", rev = "3cc02a3"}
|
||||
androscalpel = { git = "ssh://git@gitlab.inria.fr/androidoftheseus/androscalpel.git", rev = "1f2de8b", features = ["code-analysis"] }
|
||||
apk_frauder = { git = "ssh://git@gitlab.inria.fr/androidoftheseus/androscalpel.git", rev = "1f2de8b"}
|
||||
#androscalpel = { path = "../../androscalpel/androscalpel", features = ["code-analysis"] }
|
||||
#apk_frauder = { path = "../../androscalpel/apk_frauder"}
|
||||
anyhow = { version = "1.0.95", features = ["backtrace"] }
|
||||
|
|
|
|||
|
|
@ -249,6 +249,8 @@ impl ClassLoader<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Rename the definition of `cls` in the class loader.
|
||||
///
|
||||
pub fn rename_classdef(&mut self, cls: &IdType) -> Result<()> {
|
||||
let id = self.id.clone();
|
||||
let mut i = 0;
|
||||
|
|
@ -310,12 +312,22 @@ impl ClassLoader<'_> {
|
|||
r
|
||||
}
|
||||
|
||||
/// Return the new name of a type after class renaming.
|
||||
/// This method select the right renamed type by modeling the behavior of
|
||||
/// the android SDK class loaders.
|
||||
/// If the class loader is not a class loader from the android SDK, default
|
||||
/// to the behavior of DexClassLoader: Platform classes have precedence over
|
||||
/// classes defined by a parent classloader that have precedence over classes
|
||||
/// defined by the classloader itself.
|
||||
pub fn get_ref_new_name(
|
||||
&self,
|
||||
ty: &IdType,
|
||||
class_loaders: &HashMap<String, Self>,
|
||||
) -> Option<IdType> {
|
||||
// TODO: Check Platform Classes
|
||||
if ty.is_platform_class() {
|
||||
// Platform classes have precedence for all android SDK classloader.
|
||||
return Some(ty);
|
||||
}
|
||||
if self.class == *DELEGATE_LAST_CLASS_LOADER {
|
||||
if let Some(new_ty) = self.renamed_classes.get(ty) {
|
||||
return Some(new_ty.clone());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue