staticalyze object instanciation
This commit is contained in:
parent
6b15bbf748
commit
5fdeb25682
3 changed files with 518 additions and 168 deletions
|
|
@ -5,7 +5,9 @@ use std::path::PathBuf;
|
|||
use androscalpel::{IdMethod, IdType};
|
||||
|
||||
use patcher::get_apk::{get_apk, ApkLocation};
|
||||
use patcher::{transform_method, ReflectionData};
|
||||
use patcher::{
|
||||
transform_method, ReflectionClassNewInstData, ReflectionCnstrNewInstData, ReflectionInvokeData,
|
||||
};
|
||||
|
||||
use clap::Parser;
|
||||
|
||||
|
|
@ -36,25 +38,38 @@ fn main() {
|
|||
.unwrap();
|
||||
//println!("{:#?}", class.direct_methods.keys());
|
||||
//println!("{:#?}", class.virtual_methods.keys());
|
||||
let method = class
|
||||
.virtual_methods
|
||||
.get_mut(
|
||||
&IdMethod::from_smali(
|
||||
"Lcom/example/theseus/reflection/MainActivity;->callVirtualMethodReflectCall()V",
|
||||
)
|
||||
.unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
transform_method(
|
||||
for m in [
|
||||
"Lcom/example/theseus/reflection/MainActivity;->callVirtualMethodReflectCall()V",
|
||||
"Lcom/example/theseus/reflection/MainActivity;->callConstructorVirtualMethodReflectConstr()V",
|
||||
"Lcom/example/theseus/reflection/MainActivity;->callVirtualMethodReflectOldConst()V",
|
||||
] {
|
||||
let method = class
|
||||
.virtual_methods
|
||||
.get_mut(&IdMethod::from_smali(m).unwrap())
|
||||
.unwrap();
|
||||
transform_method(
|
||||
method,
|
||||
&ReflectionData {
|
||||
&ReflectionInvokeData {
|
||||
method: IdMethod::from_smali(
|
||||
"Lcom/example/theseus/reflection/Reflectee;->transfer(Ljava/lang/String;)Ljava/lang/String;",
|
||||
)
|
||||
.unwrap(),
|
||||
},
|
||||
&ReflectionClassNewInstData {
|
||||
constructor: IdMethod::from_smali(
|
||||
"Lcom/example/theseus/reflection/Reflectee;-><init>()V",
|
||||
)
|
||||
.unwrap(),
|
||||
},
|
||||
&ReflectionCnstrNewInstData{
|
||||
constructor: IdMethod::from_smali(
|
||||
"Lcom/example/theseus/reflection/Reflectee;-><init>(Ljava/lang/String;)V",
|
||||
)
|
||||
.unwrap(),
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
let mut dex_files = vec![];
|
||||
let mut files = apk.gen_raw_dex().unwrap();
|
||||
let mut i = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue