Update deps and fix frida-sys issue
This commit is contained in:
parent
d4660c0005
commit
b68121f658
1072
Cargo.lock
generated
1072
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
14
Cargo.toml
14
Cargo.toml
@ -16,26 +16,26 @@ frida = ["dep:frida", "dep:lazy_static", "dep:serde", "dep:serde_json"]
|
|||||||
frida-auto-download = ["frida/auto-download"]
|
frida-auto-download = ["frida/auto-download"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
frida = { git = "https://github.com/dzervas/frida-rust", branch = "armhf-patches", optional = true }
|
frida = { version = "0.16", optional = true }
|
||||||
lazy_static = { version = "1.4.0", optional = true }
|
lazy_static = { version = "1.5.0", optional = true }
|
||||||
serde = { version = "1.0", features = ["derive"], optional = true }
|
serde = { version = "1.0", features = ["derive"], optional = true }
|
||||||
serde_json = { version = "1.0", optional = true }
|
serde_json = { version = "1.0", optional = true }
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
winapi = { version = "0.3.9", features = ["winnt", "libloaderapi"] }
|
winapi = { version = "0.3.9", features = ["winnt", "libloaderapi"] }
|
||||||
windows-sys = { version = "0.52.0", features = [
|
windows-sys = { version = "0.59", features = [
|
||||||
"Win32_System_ClrHosting",
|
"Win32_System_ClrHosting",
|
||||||
], optional = true }
|
], optional = true }
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
ctor = "0.2.8"
|
ctor = "0.2"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
goblin = "0.8.1"
|
goblin = "0.9"
|
||||||
build-target = "0.4"
|
build-target = "0.4"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
toml = "0.8.12"
|
toml = "0.8"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
pretty_assertions = "1.4.0"
|
pretty_assertions = "1.4"
|
||||||
mylib = { path = "tests/mylib" }
|
mylib = { path = "tests/mylib" }
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
#![cfg(feature = "frida")]
|
#![cfg(feature = "frida")]
|
||||||
|
|
||||||
use frida::{DeviceManager, DeviceType, Frida, ScriptHandler, ScriptOption, ScriptRuntime, SpawnOptions};
|
use frida::{DeviceManager, DeviceType, Frida, ScriptHandler, ScriptOption, ScriptRuntime, SpawnOptions, Message, MessageLogLevel};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use serde::Deserialize;
|
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
pub static ref FRIDA: Frida = unsafe { Frida::obtain() };
|
pub static ref FRIDA: Frida = unsafe { Frida::obtain() };
|
||||||
@ -42,11 +41,11 @@ pub fn attach_with(frida_code: &str, mode: AttachMode) {
|
|||||||
let mut script_option = ScriptOption::new()
|
let mut script_option = ScriptOption::new()
|
||||||
.set_runtime(ScriptRuntime::QJS);
|
.set_runtime(ScriptRuntime::QJS);
|
||||||
println!("[*] Script {}", frida_code);
|
println!("[*] Script {}", frida_code);
|
||||||
let script = session
|
let mut script = session
|
||||||
.create_script(frida_code, &mut script_option)
|
.create_script(frida_code, &mut script_option)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
script.handle_message(&mut Handler).unwrap();
|
script.handle_message(Handler).unwrap();
|
||||||
|
|
||||||
script.load().unwrap();
|
script.load().unwrap();
|
||||||
println!("[*] Script loaded");
|
println!("[*] Script loaded");
|
||||||
@ -60,53 +59,23 @@ pub fn attach_with(frida_code: &str, mode: AttachMode) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
|
||||||
struct LogEntry {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
log_type: LogType,
|
|
||||||
level: LogLevel,
|
|
||||||
payload: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
|
||||||
enum LogType {
|
|
||||||
#[serde(rename = "log")]
|
|
||||||
Log,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
|
||||||
enum LogLevel {
|
|
||||||
#[serde(rename = "debug")]
|
|
||||||
Debug,
|
|
||||||
#[serde(rename = "info")]
|
|
||||||
Info,
|
|
||||||
#[serde(rename = "warning")]
|
|
||||||
Warning,
|
|
||||||
#[serde(rename = "error")]
|
|
||||||
Error,
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Handler;
|
struct Handler;
|
||||||
|
|
||||||
impl ScriptHandler for Handler {
|
impl ScriptHandler for Handler {
|
||||||
fn on_message(&mut self, message: &str) {
|
fn on_message(&mut self, message: &Message, _data: Option<Vec<u8>>) {
|
||||||
if let Ok(log_entry) = serde_json::from_str::<LogEntry>(message) {
|
if let Message::Log(log_entry) = message {
|
||||||
match log_entry.log_type {
|
match log_entry.level {
|
||||||
LogType::Log => {
|
MessageLogLevel::Debug => eprint!("[-] "),
|
||||||
match log_entry.level {
|
MessageLogLevel::Info => eprint!("[i] "),
|
||||||
LogLevel::Debug => eprint!("[-] "),
|
MessageLogLevel::Warning => eprint!("[!] "),
|
||||||
LogLevel::Info => eprint!("[i] "),
|
MessageLogLevel::Error => eprint!("[X] "),
|
||||||
LogLevel::Warning => eprint!("[!] "),
|
|
||||||
LogLevel::Error => eprint!("[X] "),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
eprintln!("{}", log_entry.payload);
|
eprintln!("{}", log_entry.payload);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
eprintln!("{message}");
|
eprintln!("{:?}", message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user