Safe PE/COFF inspection, import/export extraction, and security metadata auditing for MoonBit.
moon add 404-32/moon-pe-inspect@0.1.0git clone https://github.com/404-32/byc001.git
cd byc001
moon test --target wasmmoon run cmd/main -- inspect examples/minimal-pe32.exemoon run cmd/main -- imports examples/minimal-pe32.exe
moon run cmd/main -- exports examples/minimal-pe32.exemoon run cmd/main -- inspect examples/minimal-pe32plus.exe --json
moon run cmd/main -- security examples/minimal-pe32plus.exe --jsonmoon run cmd/main -- sections C:\Windows\System32\notepad.exe///|
let image = @pe.PEImage::parse(file_bytes)
///|
let sections = image.sections
///|
let imports = image.imports()
///|
let exports = image.exports()
///|
let diagnostics = image.security_diagnostics()
///|
let offset = image.rva_to_offset(0x1000UL)python scripts/generate_fixtures.py
moon check --target wasm --deny-warn
moon test --target wasm --deny-warn
moon fmt --check
moon run cmd/main -- inspect examples/minimal-pe32.exepub(all) struct DataDirectory {
index : Int
name : String
virtual_address : UInt64
size : Int
}pub(all) struct ExportSymbol {
name : String
ordinal : Int
rva : UInt64
forwarder : String?
}pub(all) struct PEImage {
data : Bytes
pe_offset : Int
format : PEFormat
machine : Int
number_of_sections : Int
timestamp : UInt64
symbol_table_pointer : UInt64
number_of_symbols : UInt64
size_of_optional_header : Int
characteristics : Int
entry_point : UInt64
image_base : UInt64
section_alignment : Int
file_alignment : Int
size_of_image : Int
size_of_headers : Int
checksum : UInt64
subsystem : Int
dll_characteristics : Int
sections : Array[Section]
directories : Array[DataDirectory]
}pub(all) struct Section {
name : String
virtual_size : Int
virtual_address : UInt64
raw_size : Int
raw_offset : Int
characteristics : UInt64
}Install
Download zipSafe PE/COFF inspection, import/export extraction, and security metadata auditing for MoonBit.