mirror of
https://codeberg.org/unspeaker/vestal.git
synced 2025-12-06 08:36:41 +01:00
show some import addresses
This commit is contained in:
parent
18fbfe62ac
commit
513166ddd5
4 changed files with 44 additions and 5 deletions
16
Cargo.lock
generated
16
Cargo.lock
generated
|
|
@ -216,6 +216,12 @@ dependencies = [
|
||||||
"generic-array",
|
"generic-array",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "either"
|
||||||
|
version = "1.13.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "equivalent"
|
name = "equivalent"
|
||||||
version = "1.0.2"
|
version = "1.0.2"
|
||||||
|
|
@ -338,6 +344,15 @@ version = "1.70.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itertools"
|
||||||
|
version = "0.14.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
|
||||||
|
dependencies = [
|
||||||
|
"either",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jack"
|
name = "jack"
|
||||||
version = "0.13.0"
|
version = "0.13.0"
|
||||||
|
|
@ -685,6 +700,7 @@ dependencies = [
|
||||||
"exe",
|
"exe",
|
||||||
"hexy",
|
"hexy",
|
||||||
"iced-x86",
|
"iced-x86",
|
||||||
|
"itertools",
|
||||||
"object",
|
"object",
|
||||||
"pretty-hex",
|
"pretty-hex",
|
||||||
"syscalls",
|
"syscalls",
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ hexy = "0.1.4"
|
||||||
pretty-hex = "0.4.1"
|
pretty-hex = "0.4.1"
|
||||||
exe = "0.5.6"
|
exe = "0.5.6"
|
||||||
iced-x86 = "1.21.0"
|
iced-x86 = "1.21.0"
|
||||||
|
itertools = "0.14.0"
|
||||||
#elf = "0.7.4"
|
#elf = "0.7.4"
|
||||||
#goblin = "0.9.3"
|
#goblin = "0.9.3"
|
||||||
#lancelot = "0.9.7"
|
#lancelot = "0.9.7"
|
||||||
|
|
|
||||||
|
|
@ -140,14 +140,35 @@ impl Vestal {
|
||||||
for descriptor in directory.descriptors {
|
for descriptor in directory.descriptors {
|
||||||
let dep = descriptor.get_name(dll)?.as_str()?;
|
let dep = descriptor.get_name(dll)?.as_str()?;
|
||||||
let resolved = self.resolve(&dep)?.expect("no path for {name}");
|
let resolved = self.resolve(&dep)?.expect("no path for {name}");
|
||||||
print!("\n (module\n {dep:?}\n {:?}", &resolved);
|
print!("\n (module {dep:?} 0x{:>08x} 0x{:>08x}\n {resolved:?}",
|
||||||
|
&descriptor.first_thunk.0,
|
||||||
|
&descriptor.original_first_thunk.0);
|
||||||
let mut imports = Vec::new();
|
let mut imports = Vec::new();
|
||||||
for import in descriptor.get_imports(dll)? {
|
let thunks = descriptor.get_first_thunk(dll)?;
|
||||||
|
let origs = descriptor.get_original_first_thunk(dll)?;
|
||||||
|
let lookups = descriptor.get_lookup_thunks(dll)?;
|
||||||
|
for (thunk, orig, lookup, import) in izip!(
|
||||||
|
thunks.iter().map(|thunk|format!("0x{:08x}", match thunk {
|
||||||
|
Thunk::Thunk32(t) => panic!("32 bit thunk"),
|
||||||
|
Thunk::Thunk64(t) => t.0
|
||||||
|
})),
|
||||||
|
origs.iter().map(|thunk|format!("0x{:08x}", match thunk {
|
||||||
|
Thunk::Thunk32(t) => panic!("32 bit original thunk"),
|
||||||
|
Thunk::Thunk64(t) => t.0
|
||||||
|
})),
|
||||||
|
lookups.iter().map(|thunk|format!("0x{:08x}", match thunk {
|
||||||
|
Thunk::Thunk32(t) => panic!("32 bit original thunk"),
|
||||||
|
Thunk::Thunk64(t) => t.0
|
||||||
|
})),
|
||||||
|
descriptor.get_imports(dll)?
|
||||||
|
) {
|
||||||
match import {
|
match import {
|
||||||
ImportData::Ordinal(x) => print!("\n (import-ordinal 0x{x:>04x})"),
|
ImportData::Ordinal(x) =>
|
||||||
ImportData::ImportByName(n) => print!("\n (import-by-name {n:?})"),
|
print!("\n (import-ordinal {thunk} 0x{x:>04x})"),
|
||||||
|
ImportData::ImportByName(n) =>
|
||||||
|
print!("\n (import-by-name {thunk} {n:?})"),
|
||||||
}
|
}
|
||||||
imports.push(import);
|
imports.push((thunk, orig, import));
|
||||||
}
|
}
|
||||||
import_map.insert(dep, (resolved, imports));
|
import_map.insert(dep, (resolved, imports));
|
||||||
println!(")")
|
println!(")")
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ pub(crate) use std::error::Error;
|
||||||
pub(crate) use std::path::{Path, PathBuf};
|
pub(crate) use std::path::{Path, PathBuf};
|
||||||
pub(crate) use std::collections::{HashMap, HashSet};
|
pub(crate) use std::collections::{HashMap, HashSet};
|
||||||
pub(crate) use std::fs::{read, canonicalize};
|
pub(crate) use std::fs::{read, canonicalize};
|
||||||
|
pub(crate) use itertools::izip;
|
||||||
//pub(crate) use ::lancelot::loader::pe::{PE, reloc::apply_relocations};
|
//pub(crate) use ::lancelot::loader::pe::{PE, reloc::apply_relocations};
|
||||||
//pub(crate) use ::goblin::{error, Object, pe::{import::Import, export::Export}};
|
//pub(crate) use ::goblin::{error, Object, pe::{import::Import, export::Export}};
|
||||||
pub(crate) use ::object::endian::LittleEndian;
|
pub(crate) use ::object::endian::LittleEndian;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue