-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from ohchase/version-0.2.0
Version 0.2.0
- Loading branch information
Showing
19 changed files
with
1,150 additions
and
1,869 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,23 +1,25 @@ | ||
[package] | ||
name = "plt-rs" | ||
version = "0.1.0" | ||
version = "0.2.0" | ||
edition = "2021" | ||
authors = ["ohchase"] | ||
license = "MIT" | ||
description = "Library for iterating and hooking linux and android applications PLT (Procedure Linkage Table) at runtime" | ||
description = "Library for inspecting, analyzing, and instrumenting linux and android applications runtime symbol linkage" | ||
documentation = "https://docs.rs/plt-rs" | ||
readme = "README.md" | ||
repository = "https://github.com/ohchase/plt-rs/" | ||
homepage = "https://github.com/ohchase/plt-rs/" | ||
keywords = ["hacking", "linux", "android", "reversing", "plt", "elf", "bionic", "linkmap"] | ||
exclude = ["/examples", "/templates"] | ||
exclude = ["/examples"] | ||
|
||
[lib] | ||
crate-type = ["lib"] | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
libc = "0.2.137" | ||
thiserror = "1.0.40" | ||
proc-maps = "0.3.0" | ||
libc = "0.2.149" | ||
thiserror = "1.0.49" | ||
|
||
[dev-dependencies] | ||
anyhow = "1.0.75" |
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,72 @@ | ||
use anyhow::Result; | ||
use plt_rs::{collect_modules, DynamicLibrary, RelocationTable}; | ||
|
||
fn main() -> Result<()> { | ||
let entries = collect_modules(); | ||
|
||
for entry in entries.into_iter() { | ||
println!("[{:?}] Addr: {:#X?}", entry.name(), entry.addr()); | ||
if let Ok(dynamic_lib) = DynamicLibrary::initialize(entry) { | ||
println!( | ||
"Dynamic String Table Length: {}", | ||
dynamic_lib.string_table().total_size() | ||
); | ||
|
||
let dynamic_symbols = dynamic_lib.symbols().expect("symbols..."); | ||
let string_table = dynamic_lib.string_table(); | ||
|
||
println!("dynamic addend relocations:"); | ||
if let Some(dyn_relas) = dynamic_lib.addend_relocs() { | ||
dyn_relas | ||
.entries() | ||
.iter() | ||
.flat_map(|e| { | ||
dynamic_symbols.resolve_name(e.symbol_index() as usize, string_table) | ||
}) | ||
.filter(|s| !s.is_empty()) | ||
.for_each(|s| println!("\t{}", s)); | ||
} | ||
|
||
println!("dynamic relocations:"); | ||
if let Some(dyn_relocs) = dynamic_lib.relocs() { | ||
dyn_relocs | ||
.entries() | ||
.iter() | ||
.flat_map(|e| { | ||
dynamic_symbols.resolve_name(e.symbol_index() as usize, string_table) | ||
}) | ||
.filter(|s| !s.is_empty()) | ||
.for_each(|s| println!("\t{}", s)); | ||
} | ||
|
||
println!("plt:"); | ||
if let Some(plt) = dynamic_lib.plt() { | ||
match plt { | ||
RelocationTable::WithAddend(rel) => { | ||
rel.entries() | ||
.iter() | ||
.flat_map(|e| { | ||
dynamic_symbols | ||
.resolve_name(e.symbol_index() as usize, string_table) | ||
}) | ||
.filter(|s| !s.is_empty()) | ||
.for_each(|s| println!("\t{}", s)); | ||
} | ||
RelocationTable::WithoutAddend(rel) => { | ||
rel.entries() | ||
.iter() | ||
.flat_map(|e| { | ||
dynamic_symbols | ||
.resolve_name(e.symbol_index() as usize, string_table) | ||
}) | ||
.filter(|s| !s.is_empty()) | ||
.for_each(|s| println!("\t{}", s)); | ||
} | ||
} | ||
} | ||
} | ||
println!(); | ||
} | ||
|
||
Ok(()) | ||
} |
Oops, something went wrong.