Comments (5)
Given whatever PE, ELF or Mach-O you can compute an imhash (by using imported_functions) as follow:
import lief
from hashlib import md5
elf_pe_macho = lief.parse("/bin/ls")
imphash = md5(",".join(elf_pe_macho.imported_functions).encode()).hexdigest()
print(imphash)
But it doesn't take account of imports by ordinal (for PE files)
from lief.
Yeah, the lack import by ordinal will break quite a lot of hashes so I cannot really rely on it out-of-the-box.
I can just have a wrapper to do it on my end, it's not a big deal.
from lief.
What I could do is to implement this hash in the utils part of the format. Something like this:
import lief
from lief.PE import imphash
pe = lief.parse("...")
print(imphash(pe))
... and handle import by ordinal
from lief.
I'm totally with you on that :)
In the utils part, I could also contribute a MISP object export for example
from lief.
\o/
from lief.
Related Issues (20)
- Unable to add custom note to ELF binary HOT 1
- Does lief support unlinked object files for static libraries in ELF format HOT 1
- MachO: Support for overlay HOT 1
- A bug in lief.PE.parse() HOT 1
- Failing to parse section type for binary HOT 6
- Compatibility with graalpy on MacOSX HOT 3
- Add support for adding or modifying PE's `LoadConfiguration` HOT 1
- PE: PDB might be corrupted, results in error HOT 2
- Adding same sections to same PE produces different builds HOT 2
- use lief.ELF.parse( ) parse 32bit-ARM ELF samples: Can't parse section #00 The .shstr index is out of range of the section table Segment #4 has a physical size larger than the current stream size (27700 > 8884). The content will be truncated with the stream size. Segment #4 has a corrupted file offset (0x3000)
- Failure to build from source using Python instructions HOT 2
- binary->name in machd_reader. c has not been initialized, causing program crashes or random printing of large amounts of data HOT 1
- Regression: MemoryError: std::bad_alloc after v0.12.3 HOT 3
- Unable to add arbitrary addresses as exported functions HOT 3
- How to execute code before main entry point (using __mod_init_func)?
- Long section names in PE HOT 2
- installed by pip missing many attributes HOT 1
- Protections numbers meaning in Mach-O HOT 2
- `lief.PE.parse' function throws an out-of-range exception
- Python API missing `set_resources()` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lief.