Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core examples - use LazyLock & clean unnecessary crates #175

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion examples/core/console_log/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ publish = false

[dependencies]
frida = { path = "../../../frida" }
lazy_static = "1.4"
6 changes: 2 additions & 4 deletions examples/core/console_log/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use frida::{DeviceManager, Frida, ScriptHandler, ScriptOption, ScriptRuntime};
use lazy_static::lazy_static;
use std::sync::LazyLock;

lazy_static! {
static ref FRIDA: Frida = unsafe { Frida::obtain() };
}
static FRIDA: LazyLock<Frida> = LazyLock::new(|| unsafe { Frida::obtain() });

fn main() {
let args: Vec<String> = std::env::args().collect();
Expand Down
2 changes: 0 additions & 2 deletions examples/core/get_processes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ publish = false

[dependencies]
frida = { path = "../../../frida" }
frida-sys = { path = "../../../frida-sys" }
lazy_static = "1.5.0"
6 changes: 2 additions & 4 deletions examples/core/get_processes/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use frida::Frida;
use lazy_static::lazy_static;
use std::sync::LazyLock;

lazy_static! {
static ref FRIDA: Frida = unsafe { Frida::obtain() };
}
static FRIDA: LazyLock<Frida> = LazyLock::new(|| unsafe { Frida::obtain() });

fn main() {
let device_manager = frida::DeviceManager::obtain(&FRIDA);
Expand Down
2 changes: 0 additions & 2 deletions examples/core/hello/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ publish = false

[dependencies]
frida = { path = "../../../frida" }
frida-sys = { path = "../../../frida-sys" }
lazy_static = "1.4"
6 changes: 2 additions & 4 deletions examples/core/hello/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/* This example is in the public domain */

use frida::Frida;
use lazy_static::lazy_static;
use std::sync::LazyLock;

lazy_static! {
static ref FRIDA: Frida = unsafe { Frida::obtain() };
}
static FRIDA: LazyLock<Frida> = LazyLock::new(|| unsafe { Frida::obtain() });

fn main() {
println!("Hello, world!");
Expand Down
1 change: 0 additions & 1 deletion examples/core/inject_lib_blob/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ crate-type = ["cdylib"]

[dependencies]
frida = { path = "../../../frida" }
frida-sys = { path = "../../../frida-sys" }
1 change: 0 additions & 1 deletion examples/core/inject_lib_file/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ crate-type = ["cdylib"]

[dependencies]
frida = { path = "../../../frida" }
frida-sys = { path = "../../../frida-sys" }
2 changes: 0 additions & 2 deletions examples/core/list_exports/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ publish = false

[dependencies]
frida = { path = "../../../frida" }
frida-sys = { path = "../../../frida-sys" }
lazy_static = "1.5.0"
6 changes: 2 additions & 4 deletions examples/core/list_exports/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
use frida::{Frida, Message};
use lazy_static::lazy_static;
use std::sync::LazyLock;
use std::{thread, time::Duration};

lazy_static! {
static ref FRIDA: Frida = unsafe { Frida::obtain() };
}
static FRIDA: LazyLock<Frida> = LazyLock::new(|| unsafe { Frida::obtain() });

fn main() {
let device_manager = frida::DeviceManager::obtain(&FRIDA);
Expand Down
2 changes: 0 additions & 2 deletions examples/core/rpc_execute_function/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@ publish = false

[dependencies]
frida = { path = "../../../frida" }
frida-sys = { path = "../../../frida-sys" }
lazy_static = "1.5.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.127"
6 changes: 2 additions & 4 deletions examples/core/rpc_execute_function/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
use frida::{Frida, Message};
use lazy_static::lazy_static;
use serde_json::json;
use std::sync::LazyLock;

lazy_static! {
static ref FRIDA: Frida = unsafe { Frida::obtain() };
}
static FRIDA: LazyLock<Frida> = LazyLock::new(|| unsafe { Frida::obtain() });

fn main() {
let device_manager = frida::DeviceManager::obtain(&FRIDA);
Expand Down
2 changes: 0 additions & 2 deletions examples/core/usb_device/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ publish = false

[dependencies]
frida = { path = "../../../frida" }
frida-sys = { path = "../../../frida-sys" }
lazy_static = "1.4"
Loading