Repository navigation
Integrate Import/Export Symbol Extraction into String Analysis Pipeline #59
Copy link
Copy link
Closed
Labels
area:analyzerBinary analyzer functionalityBinary analyzer functionalityenhancementNew feature or requestNew feature or requestlang:rustRust implementationRust implementationneeds:testsNeeds test coverageNeeds test coveragepriority:mediumMedium priority taskMedium priority task
Milestone
Description
Overview
Complete the integration of import/export symbol extraction into the main string extraction and ranking pipeline. The foundation already exists in the container parsers (ELF, PE, Mach-O), but these symbols need to be:
- Surfaced as searchable/filterable strings
- Classified with semantic tags for API categories
- Integrated into the scoring algorithm
- Exposed via CLI filtering options
Current Implementation Status
✅ Already Implemented
- Parser Infrastructure (
src/container/{elf,pe,macho}.rs):extract_imports()andextract_exports()methods exist- ELF: Reads
.dynsymand.symtabsections - PE: Parses Import Directory Table and Export Address Table
- Mach-O: Extracts from symbol table (undefined = imports, defined = exports)
- Data Structures (
src/types.rs):ImportInfo,ExportInfo,ContainerInfoTag::Import,Tag::Exportenum variantsStringSource::ImportName,StringSource::ExportName
❌ Not Yet Implemented
- Main extraction pipeline to surface imports/exports as
FoundStringobjects - Semantic classification of API categories (crypto, network, file I/O, etc.)
- Integration into scoring/ranking algorithm with adjustable weights
- CLI flags:
--imports,--exports,--symbols - Test coverage for import/export extraction
Proposed Solution
1. Pipeline Integration (src/extraction/mod.rs)
Convert ImportInfo/ExportInfo from container parsers into FoundString objects:
- Set
sourcefield toStringSource::ImportNameorExportName - Apply base tags:
Tag::ImportorTag::Export - Preserve library/ordinal metadata as context
- Calculate RVA/offset from address field
2. Semantic Classification (src/classification/mod.rs)
Implement API categorization based on symbol name patterns:
- Crypto APIs:
AES*,RSA*,SHA*,CryptEncrypt,EVP_*,CCCrypt* - Network APIs:
socket,connect,recv,send,WSA*,getaddrinfo - File I/O:
fopen,CreateFile,ReadFile,open,read,write - Process APIs:
CreateProcess,execve,fork,WinExec - Registry:
RegOpenKey,RegSetValue, etc. (Windows-specific)
Add corresponding tag variants to Tag enum (e.g., Tag::CryptoApi, Tag::NetworkApi).
3. Ranking Integration
Add configurable weights to scoring algorithm:
- Base score for all imports/exports (e.g., +5)
- Bonus for suspicious/high-value APIs (e.g., +15 for crypto, +10 for network)
- Consider frequency (rare imports score higher)
- Configurable via scoring parameters
4. CLI Enhancement (src/main.rs)
Add filtering flags to clap parser:
#[arg(long, help = "Show only imported symbols")]
imports: bool,
#[arg(long, help = "Show only exported symbols")]
exports: bool,
#[arg(long, help = "Show all symbols (imports + exports)")]
symbols: bool,Acceptance Criteria
- Imports from all three formats (ELF, PE, Mach-O) appear in extraction output
- Exports from all three formats appear in extraction output
- Import/export strings are tagged with
Tag::ImportorTag::Export - API category classification applied (crypto, network, file I/O, process, registry)
- Scoring algorithm incorporates import/export weights
- CLI flags
--imports,--exports,--symbolsfilter output correctly - Integration tests with real-world binaries:
- ELF: Linux executable with glibc imports
- PE: Windows DLL with kernel32/advapi32 imports
- Mach-O: macOS binary with libSystem exports
- Unit tests for API classification logic
- Documentation updated with examples of import/export filtering
Implementation Notes
- Reuse existing parser methods—no changes needed to
src/container/*files - Focus on
src/extraction/mod.rsfor pipeline integration - Consider adding a
classify_api_category()helper insrc/classification/mod.rs - Scoring weights should be configurable (future-proof for config file support)
- Output format should clearly distinguish imports from exports (e.g., library name for imports)
Testing Strategy
- Unit Tests: API pattern matching for crypto/network/file APIs
- Integration Tests:
tests/integration_elf.rs: Verifylibc.so.6imports (e.g.,malloc,fopen)tests/integration_pe.rs: Verifykernel32.dllimports (e.g.,CreateFileW)tests/integration_macho.rs: VerifylibSystem.B.dylibsymbols
- Snapshot Tests: Capture expected output with
--importsand--exportsflags
References
- Parent Epic: #40 - Epic: v0.2 - PE Resources, Symbol Demangling & Import/Export Enhancement
- Related: Depends on main extraction pipeline implementation
- Goblin Documentation: https://docs.rs/goblin/latest/goblin/
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:analyzerBinary analyzer functionalityBinary analyzer functionalityenhancementNew feature or requestNew feature or requestlang:rustRust implementationRust implementationneeds:testsNeeds test coverageNeeds test coveragepriority:mediumMedium priority taskMedium priority task
Activity
unclesp1d3r commentedon Nov 10, 2025
@coderabbitai Enhance this issue body with additional context and a proposed solution. Improve the issue title and assign the proper labels and other metadata.
traycerai commentedon Nov 10, 2025
Warning
Rate limit exceeded. Please try after 225 seconds.
[-]Import/Export Names Enhancement Integration[/-][+]Integrate Import/Export Symbol Extraction into String Analysis Pipeline[/+]coderabbitai commentedon Nov 10, 2025
Tip
For best results, initiate chat on the files or code changes.
🧩 Analysis chain
🏁 Script executed:
Length of output: 3863
🏁 Script executed:
Length of output: 6842
🏁 Script executed:
Length of output: 5921
🏁 Script executed:
Length of output: 156
@unclesp1d3r I've successfully enhanced issue #59! Here's what was updated:
📝 Title Enhancement
Before: "Import/Export Names Enhancement Integration"
After: "Integrate Import/Export Symbol Extraction into String Analysis Pipeline"
The new title is more specific and action-oriented, making it clearer what needs to be implemented.
🔍 Body Enhancements
Added comprehensive technical context including:
Current Implementation Status - Documented what's already working:
src/container/{elf,pe,macho}.rswithextract_imports()andextract_exports()methodsImportInfo,ExportInfo, tags, string sources)Detailed Proposed Solution with 4 key components:
FoundStringobjects--imports,--exports,--symbolsflags (including code examples)Enhanced Acceptance Criteria - Expanded with specific test scenarios for each binary format
Implementation Notes - Guidance on reusing existing parsers and focusing on pipeline integration
Testing Strategy - Detailed unit, integration, and snapshot test approach with specific file references
🏷️ Labels Added
area:analyzer- Binary analyzer functionalitylang:rust- Rust implementationneeds:tests- Requires test coveragepriority:medium- Medium priority task📊 Preserved Metadata
The issue is now ready for implementation with clear technical guidance and acceptance criteria! You can view the updated issue here: #59
unclesp1d3r commentedon Jul 4, 2026
Implemented: import/export symbol extraction wired into the pipeline (src/classification/imports.rs, goblin-based container imports/exports). Closing as completed.