fix
This commit is contained in:
parent
3899ebec39
commit
b5434cb8ac
2 changed files with 15 additions and 6 deletions
|
|
@ -115,7 +115,11 @@ fn main() {
|
||||||
};
|
};
|
||||||
println!("{}", serde_json::to_string(&rt_data).unwrap());
|
println!("{}", serde_json::to_string(&rt_data).unwrap());
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Dynamic Loading
|
||||||
insert_code(&mut apk, &rt_data).unwrap();
|
insert_code(&mut apk, &rt_data).unwrap();
|
||||||
|
|
||||||
|
// Reflection
|
||||||
let mut test_methods = HashMap::new();
|
let mut test_methods = HashMap::new();
|
||||||
let test_class = IdType::class("theseus/T");
|
let test_class = IdType::class("theseus/T");
|
||||||
for method in rt_data.get_method_referenced().iter() {
|
for method in rt_data.get_method_referenced().iter() {
|
||||||
|
|
@ -132,7 +136,7 @@ fn main() {
|
||||||
.into_values()
|
.into_values()
|
||||||
.map(|v| (v.descriptor.clone(), v))
|
.map(|v| (v.descriptor.clone(), v))
|
||||||
.collect();
|
.collect();
|
||||||
apk.add_class("classes0.dex", class).unwrap();
|
apk.add_class("classes.dex", class).unwrap();
|
||||||
let mut dex_files = vec![];
|
let mut dex_files = vec![];
|
||||||
let mut files = apk.gen_raw_dex().unwrap();
|
let mut files = apk.gen_raw_dex().unwrap();
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@ use crate::{dex_types::*, register_manipulation::*, runtime_data::*};
|
||||||
/// `meth`: the method that make reflectif calls. This is the method to patch.
|
/// `meth`: the method that make reflectif calls. This is the method to patch.
|
||||||
/// `ref_data`: the runtime data containing the reflectif calls informations.
|
/// `ref_data`: the runtime data containing the reflectif calls informations.
|
||||||
/// `tester_methods_class`: the class used to define the methods in `tester_methods`
|
/// `tester_methods_class`: the class used to define the methods in `tester_methods`
|
||||||
/// `tester_methods`: the methods used to test if a `java.lang.reflect.Method` is a specific method.
|
/// `tester_methods`: the methods used to test if a `java.lang.reflect.Method` or `java.lang.reflect.Constructor`
|
||||||
/// Methods are indexed by the IdMethod they detect, and have a name derived from the method
|
/// is a specific method. Methods are indexed by the IdMethod they detect, and have a name derived from the method
|
||||||
/// they detect.
|
/// they detect.
|
||||||
pub fn transform_method(
|
pub fn transform_method(
|
||||||
meth: &mut Method,
|
meth: &mut Method,
|
||||||
|
|
@ -275,7 +275,11 @@ fn gen_tester_method(
|
||||||
format!("{c_name}_{m_name}_{hash:016x}").into(),
|
format!("{c_name}_{m_name}_{hash:016x}").into(),
|
||||||
IdMethodType::new(
|
IdMethodType::new(
|
||||||
IdType::boolean(),
|
IdType::boolean(),
|
||||||
vec![IdType::class("java/lang/reflect/Method")],
|
vec![if is_constructor {
|
||||||
|
IdType::class("java/lang/reflect/Constructor")
|
||||||
|
} else {
|
||||||
|
IdType::class("java/lang/reflect/Method")
|
||||||
|
}],
|
||||||
),
|
),
|
||||||
tester_methods_class,
|
tester_methods_class,
|
||||||
);
|
);
|
||||||
|
|
@ -421,17 +425,18 @@ fn gen_tester_method(
|
||||||
lit: 1,
|
lit: 1,
|
||||||
},
|
},
|
||||||
Instruction::Return { reg: reg_arr_val },
|
Instruction::Return { reg: reg_arr_val },
|
||||||
|
Instruction::Label { name: no_label },
|
||||||
Instruction::Const {
|
Instruction::Const {
|
||||||
reg: reg_arr_val,
|
reg: reg_arr_val,
|
||||||
lit: 0,
|
lit: 0,
|
||||||
},
|
},
|
||||||
Instruction::Label { name: no_label },
|
Instruction::Return { reg: reg_arr_val },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
method.is_static = true;
|
method.is_static = true;
|
||||||
method.is_final = true;
|
method.is_final = true;
|
||||||
method.code = Some(Code::new(
|
method.code = Some(Code::new(
|
||||||
3, //registers_size, 3 reg + 1 parameter reg
|
4, //registers_size, 3 reg + 1 parameter reg
|
||||||
insns,
|
insns,
|
||||||
Some(vec![Some("meth".into())]), // parameter_names
|
Some(vec![Some("meth".into())]), // parameter_names
|
||||||
));
|
));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue