feat: Implement comprehensive PE support with section classification, import/export parsing, and resource extraction#66
Conversation
- Introduced a new benchmark for PE parsing in `benches/pe.rs` to evaluate performance. - Enhanced the PE parser to include import and export ordinal extraction, improving accuracy in symbol handling. - Updated documentation to reflect new features and extraction capabilities. - Added snapshot tests for PE symbol extraction to ensure consistent output. This commit improves the performance measurement and accuracy of the PE parser, facilitating better analysis of Portable Executable files. Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
- Added support for extracting resource metadata from PE binaries using the pelite library. - Introduced new types for resource metadata, including ResourceMetadata and ResourceType. - Updated ContainerInfo to include an optional resources field for storing extracted resource data. - Refactored PE parser to utilize pelite for resource extraction while maintaining goblin for general PE structure parsing. - Added integration tests to verify resource extraction functionality and ensure robustness. This commit improves the ability to analyze PE binaries by enabling the extraction of meaningful resource information, which is crucial for comprehensive string analysis. Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
- Updated the Rust toolchain version from 1.90 to 1.91.0 in multiple GitHub Actions workflows, including CI, CodeQL, Copilot setup, documentation, and security workflows. - Ensured consistency in the toolchain version used across all workflows to leverage the latest features and improvements. This update enhances the development environment by utilizing the most recent stable Rust version. Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
- Finalized the implementation of resource enumeration and metadata extraction for PE binaries, including VERSIONINFO, STRINGTABLE, and MANIFEST resources. - Updated documentation to reflect the completion of Phase 1, detailing the capabilities of the resource extraction framework. - Enhanced unit tests to cover edge cases and ensure robust handling of various resource scenarios. - Improved error handling and added comprehensive test coverage for resource detection and extraction. This commit significantly enhances the ability to analyze PE binaries by providing detailed resource metadata, laying the groundwork for future string extraction capabilities. Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
- Finalized the implementation of string extraction from PE resources, including VERSIONINFO, STRINGTABLE, and MANIFEST. - Enhanced the extraction process with UTF-16LE decoding utilities and comprehensive unit and integration tests. - Updated documentation to reflect the capabilities of the new extraction features and provided usage examples. - Improved error handling to ensure graceful degradation during extraction failures. This commit significantly enhances the ability to extract meaningful strings from PE binaries, facilitating better analysis and understanding of resource content. Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
|
Caution Review failedFailed to post review comments Summary by CodeRabbitRelease Notes
WalkthroughThis PR implements PE resource extraction capabilities including VERSIONINFO, STRINGTABLE, and MANIFEST parsing, updates Rust toolchain versions across CI workflows, introduces the pelite dependency, extends container types with ordinal support and resource metadata, and adds comprehensive tests and benchmarks. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant PeParser
participant extract_imports
participant extract_exports
participant pe_resources
participant ContainerInfo
User->>PeParser: parse(pe_data)
PeParser->>extract_imports: extract_imports(pe)
extract_imports->>extract_imports: Synthesize ordinal names<br/>Populate ordinal field
extract_imports-->>PeParser: Vec<ImportInfo>
PeParser->>extract_exports: extract_exports(pe)
extract_exports->>extract_exports: Compute ordinals<br/>Detect forwarded exports<br/>Annotate names
extract_exports-->>PeParser: Vec<ExportInfo>
PeParser->>pe_resources: extract_resources(data)
pe_resources->>pe_resources: Parse resource directory<br/>Decode VERSIONINFO/STRINGTABLE<br/>Extract MANIFEST
pe_resources-->>PeParser: Vec<ResourceMetadata>
PeParser->>ContainerInfo: ContainerInfo::new(..., resources)
ContainerInfo-->>User: ContainerInfo with<br/>imports, exports,<br/>resources, ordinals
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes
Possibly related issues
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
|
Documentation Updates 2 document(s) were updated by changes in this PR: stringy |
|
@coderabbitai Fix the PR title |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain@unclesp1d3r I'll update the PR title to better reflect the comprehensive changes in this pull request. The new title better describes the full scope of this PR, which includes:
🏁 Script executed: Length of output: 59 @unclesp1d3r ✅ PR title has been successfully updated! New title: The updated title now:
|
… import/export parsing, and resource extraction (#66) * feat(pe): Add PE benchmark and enhance import/export extraction - Introduced a new benchmark for PE parsing in `benches/pe.rs` to evaluate performance. - Enhanced the PE parser to include import and export ordinal extraction, improving accuracy in symbol handling. - Updated documentation to reflect new features and extraction capabilities. - Added snapshot tests for PE symbol extraction to ensure consistent output. This commit improves the performance measurement and accuracy of the PE parser, facilitating better analysis of Portable Executable files. Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * feat(pe): Enhance resource extraction in PE binaries - Added support for extracting resource metadata from PE binaries using the pelite library. - Introduced new types for resource metadata, including ResourceMetadata and ResourceType. - Updated ContainerInfo to include an optional resources field for storing extracted resource data. - Refactored PE parser to utilize pelite for resource extraction while maintaining goblin for general PE structure parsing. - Added integration tests to verify resource extraction functionality and ensure robustness. This commit improves the ability to analyze PE binaries by enabling the extraction of meaningful resource information, which is crucial for comprehensive string analysis. Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * chore(ci): Update Rust toolchain version to 1.91.0 across workflows - Updated the Rust toolchain version from 1.90 to 1.91.0 in multiple GitHub Actions workflows, including CI, CodeQL, Copilot setup, documentation, and security workflows. - Ensured consistency in the toolchain version used across all workflows to leverage the latest features and improvements. This update enhances the development environment by utilizing the most recent stable Rust version. Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * feat(pe): Complete Phase 1 of PE resource extraction - Finalized the implementation of resource enumeration and metadata extraction for PE binaries, including VERSIONINFO, STRINGTABLE, and MANIFEST resources. - Updated documentation to reflect the completion of Phase 1, detailing the capabilities of the resource extraction framework. - Enhanced unit tests to cover edge cases and ensure robust handling of various resource scenarios. - Improved error handling and added comprehensive test coverage for resource detection and extraction. This commit significantly enhances the ability to analyze PE binaries by providing detailed resource metadata, laying the groundwork for future string extraction capabilities. Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> * feat(pe): Complete Phase 2 of PE resource string extraction - Finalized the implementation of string extraction from PE resources, including VERSIONINFO, STRINGTABLE, and MANIFEST. - Enhanced the extraction process with UTF-16LE decoding utilities and comprehensive unit and integration tests. - Updated documentation to reflect the capabilities of the new extraction features and provided usage examples. - Improved error handling to ensure graceful degradation during extraction failures. This commit significantly enhances the ability to extract meaningful strings from PE binaries, facilitating better analysis and understanding of resource content. Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io> --------- Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
This pull request adds comprehensive support for PE (Portable Executable) resource extraction and section classification, including full implementation of VERSIONINFO, STRINGTABLE, and MANIFEST resource parsing. It also introduces new benchmarks for PE parsing and updates documentation to reflect these enhancements. Additionally, the CI/CD workflows are updated to use newer versions of Rust toolchain and GitHub Actions, and dependencies are updated to support PE resource parsing.
Directly addresses issues #3, #4, and #5.
PE Resource Extraction and Section Classification
pelitedependency toCargo.tomlfor PE resource parsing support.Benchmarks and Testing
benches/pe.rs, covering full parse, import extraction, and export extraction using test fixtures.Cargo.toml.Documentation and Status Updates
README.mdand spec/task files to reflect completed PE resource extraction features (Phase 1 and 2), including implementation notes and usage examples. [1] [2] [3]CI/CD and Workflow Updates
actions/upload-artifactandactions/attest-build-provenanceto v4 and v2 respectively in release workflow for stability. [1] [2] [3] [4] [5] [6]Other Minor Changes
ordinal: Nonefor imports/exports, clarifying ELF symbol handling. [1] [2]