Repository navigation
Description
Summary
Implement the foundational ASCII string extraction module that scans binary data for printable ASCII character sequences (0x20-0x7E) and returns them as FoundString objects with configurable minimum length filtering.
Context
ASCII extraction is the foundational encoding type for StringyMcStringFace's string extraction pipeline. Unlike the traditional strings command which blindly extracts all printable sequences, this implementation will:
- Be section-aware (integrate with
SectionInfofrom the container parsing) - Return properly structured
FoundStringobjects with metadata (offset, RVA, section name, encoding type) - Support configurable minimum length to reduce noise from random byte sequences
- Serve as the reference implementation for future encodings (UTF-8, UTF-16LE, UTF-16BE)
The ASCII extractor will be the first concrete implementation of the string extraction framework and will be used by all binary formats (ELF, PE, Mach-O).
Requirements
- Requirement 2.1: Implement basic string extraction for ASCII encoding
- Must scan byte sequences for contiguous printable ASCII characters (0x20-0x7E)
- Must support configurable minimum length threshold (default: 4 characters)
- Must return
FoundStringobjects as defined insrc/types.rs - Must properly populate metadata fields: offset, section name, encoding, length, source
- Must handle section boundaries correctly (don't span strings across sections)
Proposed Solution
File Structure
Create src/extraction/ascii.rs with the following components:
Core Functions
-
extract_ascii_strings(data: &[u8], config: &ExtractionConfig) -> Vec<FoundString>- Main extraction function
- Scans byte slice for printable ASCII runs
- Filters by minimum length
- Returns vector of FoundString objects
-
is_printable_ascii(byte: u8) -> bool- Helper to check if byte is in printable range (0x20-0x7E)
- Inline for performance
-
extract_from_section(section: &SectionInfo, data: &[u8], config: &ExtractionConfig) -> Vec<FoundString>- Section-aware extraction wrapper
- Calculates correct offsets and RVAs
- Populates section metadata
Configuration Structure
pub struct ExtractionConfig {
pub min_length: usize,
pub max_length: Option<usize>,
// Future: encoding preferences, tag filters, etc.
}Algorithm
- Iterate through byte slice
- Track current string start position and length
- When encountering non-printable byte:
- If accumulated length >= min_length, create FoundString
- Reset accumulator
- Handle end-of-buffer edge case
- Calculate offsets (file offset + buffer start)
- Set encoding to
Encoding::Ascii - Set source to
StringSource::SectionData
Edge Cases to Handle
- Empty sections or zero-length data
- Strings at section boundaries
- Very long continuous runs (potential padding or data tables)
- Null terminators within printable sequences
- Sections smaller than minimum length
- Buffer boundaries
Acceptance Criteria
-
src/extraction/ascii.rscreated with extraction logic - Configurable minimum length parameter (default: 4)
- Correctly identifies printable ASCII range (0x20-0x7E)
- Returns
FoundStringobjects with all required fields populated - Unit tests covering:
- Basic extraction with default minimum length
- Custom minimum length filtering
- Edge case: empty input
- Edge case: no strings found
- Edge case: string at buffer start
- Edge case: string at buffer end
- Edge case: single character (below minimum)
- Edge case: exact minimum length string
- Offset calculation correctness
- Section metadata population
- Documentation with examples
- Integrated into
src/extraction/mod.rs
Implementation Notes
- Start with simple implementation; optimize later if profiling shows bottlenecks
- Consider using SIMD or vectorization in future iterations for performance
- ASCII extraction should be the reference for implementing UTF-8, UTF-16LE, UTF-16BE
- Do not implement semantic tagging yet (that's a separate issue)
- Do not implement scoring yet (that's a separate issue)
Dependencies
- Blocked by: Core String Extraction Framework: StringExtractor Trait and Configuration #8 String Extraction Framework (need base traits/interfaces)
- Blocks: UTF-8 extraction, UTF-16 extraction, main pipeline orchestrator
Related Issues
- Epic: MVP Weekend Implementation - Complete String Extraction Pipeline #39 Epic: MVP Weekend Implementation
- Implement Semantic Boost Scoring for String Ranking #23 Semantic Boost Scoring (future enhancement)
- Implement Noise Penalty Detection for String Quality Scoring #24 Noise Penalty Detection (future enhancement)
Definition of Done
- Code passes
cargo test - Code passes
cargo clippywith no warnings - Unit test coverage >= 80%
- Module properly exported in
extraction/mod.rs - Inline documentation for public API
- Ready for integration with container parsers
Task-ID: stringy-analyzer/basic-ascii-string-extraction
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.
[-]Basic ASCII String Extraction[/-][+]Implement ASCII String Extractor with Configurable Length Filtering[/+]coderabbitai commentedon Sep 30, 2025
Tip
For best results, initiate chat on the files or code changes.
🧩 Analysis chain
🏁 Script executed:
Length of output: 1348
🏁 Script executed:
Length of output: 2261
🏁 Script executed:
Length of output: 6213
🏁 Script executed:
Length of output: 154
@unclesp1d3r I've successfully enhanced issue #9 with comprehensive details! Here's what I updated:
Changes Made:
✅ Improved Title
✅ Enhanced Body Content
Added extensive sections including:
stringscommand✅ Added Labels
priority:highlabel (foundational feature that blocks other work)The issue now provides clear implementation guidance with specific technical details about the
FoundStringstructure, printable ASCII range (0x20-0x7E), and integration points with the existing codebase. It's ready for development! 🚀You can view the enhanced issue here: #9
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.
coderabbitai commentedon Nov 10, 2025
Tip
For best results, initiate chat on the files or code changes.
🧩 Analysis chain
🏁 Script executed:
Length of output: 6054
🏁 Script executed:
Length of output: 2427
🏁 Script executed:
Length of output: 1218
@unclesp1d3r Great news! Issue #9 was already comprehensively enhanced from our previous interaction. I've now added one final touch:
✅ Current Status - Fully Enhanced
Title
✓ "Implement ASCII String Extractor with Configurable Length Filtering"
Body Content
The issue already contains:
src/extraction/ascii.rs)Metadata
area:analyzer- Binary analyzer functionalitytype:enhancement- New featurestatus:backlog- Task statuslang:rust- Rust implementationneeds:tests- Requires test coveragepriority:high- High priority (foundational feature)MVP- [Just Added] - Part of minimum viable productThe issue is production-ready and provides clear implementation guidance with all necessary technical details! 🎯
View the issue: #9
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 parsing for ELF, PE, and Mach-O formats. The
FoundStringtype and related metadata structures are fully defined insrc/types.rs. The extraction module currently only contains format-specific extractors (PE resources, Mach-O load commands) but lacks the foundational ASCII string extraction capability. NoExtractionConfigstructure exists yet. The documentation indocs/src/string-extraction.mdprovides clear guidance on the expected extraction algorithm and configuration structure.Approach
Implement the ASCII string extraction module as the foundational encoding extractor for StringyMcStringFace. Create a new
src/extraction/ascii.rsmodule with three core functions:extract_ascii_stringsfor basic byte-level scanning,is_printable_asciias an inline helper, andextract_from_sectionfor section-aware extraction. Introduce anExtractionConfigstructure to support configurable minimum and maximum length filtering. The implementation will follow the patterns established by existing extractors (PE resources, Mach-O load commands) and properly populate allFoundStringmetadata fields. Comprehensive unit tests will cover the acceptance criteria including edge cases, offset calculations, and section metadata population.Reasoning
I explored the repository structure to understand the module organization, examined
src/types.rsto understand theFoundStringandSectionInfostructures, reviewed existing extraction implementations insrc/extraction/pe_resources.rsandsrc/extraction/macho_load_commands.rsto understand patterns, checked container parsers to see how section data is accessed, verified noExtractionConfigexists, and reviewed documentation to understand the expected architecture and algorithm.Proposed File Changes
📄 src/extraction/ascii.rs (NEW) 🔗
📄 src/extraction/mod.rs (MODIFY) 🔗
📄 src/lib.rs (MODIFY) 🔗
Diagram
sequenceDiagram participant User participant Container Parser participant ASCII Extractor participant FoundString User->>Container Parser: parse(binary_data) Container Parser-->>User: ContainerInfo with SectionInfo[] User->>ASCII Extractor: extract_from_section(section, data, config) ASCII Extractor->>ASCII Extractor: Slice section data using offset+size ASCII Extractor->>ASCII Extractor: extract_ascii_strings(section_data, config) loop For each byte in data ASCII Extractor->>ASCII Extractor: is_printable_ascii(byte)? alt Printable ASCII ASCII Extractor->>ASCII Extractor: Accumulate in current string else Non-printable alt Length >= min_length ASCII Extractor->>FoundString: Create with metadata FoundString-->>ASCII Extractor: FoundString instance end ASCII Extractor->>ASCII Extractor: Reset accumulator end end ASCII Extractor->>ASCII Extractor: Adjust offsets (add section.offset) ASCII Extractor->>ASCII Extractor: Populate section name and RVA ASCII Extractor-->>User: Vec<FoundString> with complete metadataImport 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