Repository navigation
Closed
Copy link
Labels
area:analyzerBinary analyzer functionalityBinary analyzer functionalitylang:rustRust implementationRust implementationneeds:testsNeeds test coverageNeeds test coveragestatus:backlogTask in backlogTask in backlogstory-points: 88 story points8 story pointstype:enhancementNew feature or requestNew feature or request
Milestone
Description
Background
StringyMcStringFace aims to be a smarter alternative to the strings command by leveraging format-specific knowledge to extract and prioritize meaningful strings from binaries. The container parsing layer (ELF, PE, Mach-O) is already implemented and provides structured metadata via ContainerInfo. Now we need the core extraction framework that will scan binary data and produce FoundString instances.
Current State
- ✅ Container parsers implemented (
src/container/) - ✅ Type definitions complete (
FoundString,Encoding,SectionType, etc.) - ❌ String extraction logic missing (
src/extraction/mod.rsis empty) - ❌ No extraction configuration framework
- ❌ No trait abstraction for different extraction strategies
Objectives
Create a flexible, trait-based extraction framework in src/extraction/mod.rs that:
- Defines the
StringExtractortrait - An interface for different extraction strategies (basic ASCII, Unicode, context-aware, etc.) - Implements
ExtractionConfig- Configurable parameters for extraction behavior - Provides a default extractor - A basic implementation to get started
Proposed Solution
1. StringExtractor Trait
/// Trait for implementing string extraction strategies
pub trait StringExtractor {
/// Extract strings from binary data with metadata context
fn extract(
&self,
data: &[u8],
container_info: &ContainerInfo,
config: &ExtractionConfig,
) -> Result<Vec<FoundString>>;
/// Extract strings from a specific section
fn extract_from_section(
&self,
data: &[u8],
section: &SectionInfo,
config: &ExtractionConfig,
) -> Result<Vec<FoundString>>;
}2. ExtractionConfig Structure
/// Configuration parameters for string extraction
#[derive(Debug, Clone)]
pub struct ExtractionConfig {
/// Minimum string length to consider
pub min_length: usize,
/// Maximum string length to extract
pub max_length: usize,
/// Encodings to search for
pub encodings: Vec<Encoding>,
/// Whether to extract from executable sections
pub scan_code_sections: bool,
/// Whether to include strings from debug sections
pub include_debug: bool,
/// Section types to prioritize
pub section_priority: Vec<SectionType>,
/// Whether to include import/export names
pub include_symbols: bool,
}
impl Default for ExtractionConfig {
fn default() -> Self {
Self {
min_length: 4,
max_length: 4096,
encodings: vec\![Encoding::Ascii, Encoding::Utf8],
scan_code_sections: true,
include_debug: false,
section_priority: vec\![
SectionType::StringData,
SectionType::ReadOnlyData,
SectionType::Resources,
],
include_symbols: true,
}
}
}3. Basic Implementation
Create a BasicExtractor that implements StringExtractor with straightforward sequential scanning for ASCII and UTF-8 strings.
Architecture Integration
The extraction framework fits into the pipeline as follows:
Binary Data → Container Parser → ContainerInfo
↓
StringExtractor + ExtractionConfig
↓
Vec<FoundString>
↓
Classification (future)
↓
Output Formatting
Implementation Details
File Structure
- Main trait and config:
src/extraction/mod.rs - Basic extractor:
src/extraction/basic.rs(or inline in mod.rs initially) - Tests: Unit tests in each module, integration tests in
tests/
Key Considerations
- Use existing
FoundStringtype (already defined insrc/types.rs) - Leverage
ContainerInfoto make format-aware decisions - Ensure zero-copy where possible (use slices and indices)
- Handle encoding detection robustly (invalid sequences should not panic)
- Set appropriate
StringSourcevalues based on where strings are found
Acceptance Criteria
-
StringExtractortrait defined with documented methods -
ExtractionConfigstruct with sensible defaults - At least one working implementation (
BasicExtractor) - Unit tests covering:
- ASCII string extraction
- UTF-8 string extraction
- Configuration validation
- Edge cases (empty data, invalid encodings, boundary conditions)
- Documentation with usage examples
- Integration with existing
ContainerInfoarchitecture
Related
- Requirement: 2.1 (String Extraction Framework)
- Task ID: stringy-analyzer/string-extraction-framework
- Blocks: Classification and scoring functionality (future issues)
- Repository: https://github.com/EvilBit-Labs/StringyMcStringFace
Notes
- The issue originally mentioned
RawStringstruct, butFoundStringalready exists insrc/types.rsand should be used instead - Future extractors can implement format-specific logic (e.g., PE resource strings, Mach-O LC_ID_DYLIB)
- This is the foundation for the entire extraction pipeline - needs to be solid and extensible
Metadata
Metadata
Assignees
Labels
area:analyzerBinary analyzer functionalityBinary analyzer functionalitylang:rustRust implementationRust implementationneeds:testsNeeds test coverageNeeds test coveragestatus:backlogTask in backlogTask in backlogstory-points: 88 story points8 story pointstype:enhancementNew feature or requestNew feature or request
Activity
unclesp1d3r commentedon Sep 30, 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.
[-]String Extraction Framework[/-][+]Core String Extraction Framework: StringExtractor Trait and Configuration[/+]coderabbitai commentedon Sep 30, 2025
Tip
For best results, initiate chat on the files or code changes.
🧩 Analysis chain
🏁 Script executed:
Length of output: 1167
🏁 Script executed:
Length of output: 3214
🏁 Script executed:
Length of output: 7810
🏁 Script executed:
Length of output: 87
🏁 Script executed:
Length of output: 741
@unclesp1d3r I've successfully enhanced issue #8 with comprehensive details:
Changes Made
✅ Title Updated
Changed from "String Extraction Framework" to "Core String Extraction Framework: StringExtractor Trait and Configuration" for better clarity and specificity.
✅ Body Enhanced With
StringExtractortrait with two methodsExtractionConfigstruct with sensible defaults (min_length: 4, encodings, section priorities, etc.)BasicExtractorimplementationFoundString(notRawString) should be used, and mentioned extensibility for future format-specific extractors✅ Labels & Metadata
Existing labels are perfect and remain unchanged:
area:analyzer- Correct functional areatype:enhancement- Appropriate typestatus:backlog- Current statuslang:rust- Implementation languageneeds:tests- Correctly reflects acceptance criteriaThe issue is now ready for implementation with clear technical specifications and acceptance criteria!
unclesp1d3r commentedon Nov 12, 2025
@traycerai generate
traycerai commentedon Nov 12, 2025
Hi @unclesp1d3r, I have updated the Implementation Plan to reflect the recent changes in the ticket.
traycerai commentedon Nov 12, 2025
Plan
Observations
The codebase has a well-structured foundation with complete container parsers (ELF, PE, Mach-O) and format-specific extractors (PE resources, Mach-O load commands). The missing piece is the core string extraction framework that will scan binary data for ASCII/UTF-8 strings. The existing
FoundStringtype andContainerInfostructure provide all necessary metadata. The task requires implementing a trait-based architecture with configuration support and a basic extractor implementation.Approach
Implement the
StringExtractortrait,ExtractionConfigstruct, andBasicExtractorinsrc/extraction/mod.rs. The trait will define methods for extracting strings from full binary data and individual sections. The config will provide sensible defaults for minimum/maximum lengths, encoding selection, and section filtering. TheBasicExtractorwill implement sequential scanning for ASCII/UTF-8 strings using the algorithm pattern from the documentation. All components will integrate seamlessly with existing types and parsers.Reasoning
I explored the repository structure, examined existing type definitions in
src/types.rs, reviewed container parsers to understand section metadata handling, analyzed format-specific extractors (pe_resources.rs,macho_load_commands.rs) to understand theFoundStringcreation pattern, checked the library and CLI entry points, and reviewed documentation for extraction algorithms and architecture requirements.Proposed File Changes
📄 src/extraction/mod.rs (MODIFY) 🔗
📄 src/lib.rs (MODIFY) 🔗
📄 tests/integration_extraction.rs (NEW) 🔗
Diagram
sequenceDiagram participant User participant BasicExtractor participant ContainerInfo participant SectionInfo participant FoundString User->>BasicExtractor: extract(data, container_info, config) BasicExtractor->>ContainerInfo: Get sections list ContainerInfo-->>BasicExtractor: Vec<SectionInfo> loop For each section BasicExtractor->>BasicExtractor: Filter by config (code/debug) alt Section passes filter BasicExtractor->>BasicExtractor: extract_from_section(data, section, config) BasicExtractor->>BasicExtractor: Get section data slice BasicExtractor->>BasicExtractor: extract_ascii_utf8_strings(slice, min_len) loop For each found string BasicExtractor->>BasicExtractor: Validate UTF-8 BasicExtractor->>BasicExtractor: Calculate offset = section.offset + relative BasicExtractor->>BasicExtractor: Calculate RVA if available BasicExtractor->>FoundString: Create with metadata FoundString-->>BasicExtractor: FoundString instance end end end BasicExtractor-->>User: Vec<FoundString>Import In IDE
🤖 Prompt for AI Agents
Developer Humor
Execution Information
Branch: main
Commit: baf4526
💡 Tips
Supported Commands (Inside Comments)
@traycerai generateto iterate on the previous version of the implementation plan.Supported Commands (Inside Description)
@traycerai ignoreanywhere in the ticket description to prevent this ticket from being processed.@traycerai branch:<branch-name>anywhere in the ticket description to specify the target branch for the implementation plan.Community