forked from frida/frida-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'frida:main' into capstone_remove
- Loading branch information
Showing
29 changed files
with
1,005 additions
and
31 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
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 +1 @@ | ||
16.0.19 | ||
16.1.10 |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[package] | ||
name = "usb_device" | ||
version = "0.1.0" | ||
authors = ["Andras Marczell <[email protected]>"] | ||
edition = "2018" | ||
license = "wxWindows" | ||
publish = false | ||
|
||
[dependencies] | ||
frida = { path = "../../../frida" } | ||
frida-sys = { path = "../../../frida-sys" } | ||
lazy_static = "1.4" |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use frida::DeviceType; | ||
|
||
fn main() { | ||
let frida = unsafe { frida::Frida::obtain() }; | ||
let device_manager = frida::DeviceManager::obtain(&frida); | ||
|
||
// get the first usb device (assuming there is one attached) | ||
let device = device_manager.get_device_by_type(DeviceType::USB).unwrap(); | ||
assert_eq!(device.get_type(), DeviceType::USB); | ||
println!( | ||
"found {} with type: {}", | ||
device.get_name(), | ||
device.get_type() | ||
); | ||
|
||
// get the device id and use it to obtain a the device by the id | ||
let device_id = device.get_id(); | ||
let device = device_manager.get_device_by_id(device_id).unwrap(); | ||
assert_eq!(device.get_id(), device_id); | ||
println!("found {} with id: {}", device.get_name(), device.get_id()); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[package] | ||
name = "monitor-memory-access" | ||
version = "0.1.0" | ||
authors = ["Liu Xiangru <[email protected]>"] | ||
edition = "2021" | ||
license = "MIT" | ||
description = "Example of monitoring memory access using Frida's MemoryAccessMonitor API" | ||
|
||
[dependencies] | ||
frida-gum = { path = "../../../frida-gum", features = [ | ||
"memory-access-monitor", | ||
] } |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use frida_gum::{MemoryAccessMonitor, MemoryRange, NativePointer}; | ||
use std::sync::atomic::AtomicUsize; | ||
|
||
static HIT: AtomicUsize = AtomicUsize::new(0); | ||
const BLK_SIZE: usize = 0x3; | ||
|
||
fn main() { | ||
let block = | ||
unsafe { std::alloc::alloc(std::alloc::Layout::from_size_align_unchecked(BLK_SIZE, 1)) }; | ||
let range = MemoryRange::new(NativePointer(block as *mut _), BLK_SIZE); | ||
let gum = unsafe { frida_gum::Gum::obtain() }; | ||
let mam = MemoryAccessMonitor::new( | ||
&gum, | ||
vec![range], | ||
frida_gum::PageProtection::Write, | ||
true, | ||
|_, details| { | ||
println!( | ||
"[monitor callback] hit: {}, details: {}", | ||
HIT.fetch_add(1, std::sync::atomic::Ordering::SeqCst), | ||
details | ||
); | ||
}, | ||
); | ||
if let Ok(()) = mam.enable() { | ||
unsafe { | ||
for i in 0..BLK_SIZE { | ||
println!("writing at block + {:#x}", i); | ||
let ptr = block.add(i); | ||
std::ptr::write(ptr, 0); | ||
} | ||
} | ||
mam.disable(); | ||
} else { | ||
println!("failed to enable memory access monitor"); | ||
} | ||
} |
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,7 +1,7 @@ | ||
[package] | ||
name = "frida-gum-sys" | ||
version = "0.8.1" | ||
authors = ["Keegan Saunders <[email protected]>"] | ||
version = "0.8.3" | ||
authors = ["Keegan Saunders <[email protected]>", "Shmarya Rubenstein <[email protected]>"] | ||
edition = "2018" | ||
license = "wxWindows" | ||
repository = "https://github.com/frida/frida-rust" | ||
|
@@ -15,7 +15,7 @@ stalker-observer = ["cc"] | |
stalker-params = ["cc"] | ||
|
||
[build-dependencies] | ||
bindgen = "0.63" | ||
bindgen = "0.69.1" | ||
cc = { version = "1.0", optional = true } | ||
frida-build = { path = "../frida-build", version = "0.2.1", optional = true } | ||
|
||
|
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 +1 @@ | ||
16.0.19 | ||
16.1.10 |
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,7 +1,7 @@ | ||
[package] | ||
name = "frida-gum" | ||
version = "0.13.2" | ||
authors = ["Keegan Saunders <[email protected]>"] | ||
version = "0.13.4" | ||
authors = ["Keegan Saunders <[email protected]>", "Shmarya Rubenstein <[email protected]>"] | ||
edition = "2018" | ||
license = "wxWindows" | ||
repository = "https://github.com/frida/frida-rust" | ||
|
@@ -12,13 +12,14 @@ auto-download = ["frida-gum-sys/auto-download"] | |
backtrace = ["libc"] | ||
event-sink = ["frida-gum-sys/event-sink"] | ||
invocation-listener = ["frida-gum-sys/invocation-listener"] | ||
memory-access-monitor = [] | ||
module-names = [] | ||
stalker-observer = ["frida-gum-sys/stalker-observer"] | ||
stalker-params = ["frida-gum-sys/stalker-params"] | ||
|
||
[dependencies] | ||
cstr_core = { version = "0.2.6", default-features = false, features = ["alloc"] } | ||
frida-gum-sys = { path = "../frida-gum-sys", version = "0.8.1" } | ||
frida-gum-sys = { path = "../frida-gum-sys", version = "0.8.3" } | ||
libc = { version = "0.2.93", default-features = false, optional = true } | ||
num = { version = "0.3.1", default-features = false } | ||
num-derive = { version = "0.3.3", default-features = false } | ||
|
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
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
Oops, something went wrong.