extract-shellcode-0.1.0 is not a library.
extract-shellcode
Small Rust toolkit for pulling shellcode out of a Windows PE and (optionally) executing it in-memory for quick validation.
components
extract-shellcode: reads a PE, finds the.textsection, and uses a linker map file to decide how many bytes to keep.test-shellcode: loads a binary blob, allocates executable memory withVirtualAllocon Windows, and jumps to it.
prerequisites
- Rust toolchain (edition 2024).
- Windows for
test-shellcodeexecution (other platforms bail out). - A PE executable and its corresponding
.mapfile; the map line for.textshould look like0001:00000000 00000XXXH .text CODE.
building
usage
Extract shellcode from a PE using its map file:
Inspect and execute a shellcode blob (Windows only):
The runner prints the byte count and first few bytes before executing. Execution uses RWX pages; use only in a controlled environment.
notes and limitations
- The extractor looks for the first
.textsection named exactly.textand trusts the map file length; malformed inputs will error out. - The tester does not apply mitigations (no DEP/CFG bypass), so only run known-safe shellcode.
- CI/tests are not provided; use
cargo clippyandcargo fmtlocally if desired.
Support
If this crate saves you time or helps your work, support is appreciated:
License
This project is licensed under the MIT License; see the license file for details.