Repository navigation
Labels
MVPMinimum viable product featuresMinimum viable product featuresarea:analyzerBinary analyzer functionalityBinary analyzer functionalitylang:rustRust implementationRust implementationneeds:testsNeeds test coverageNeeds test coveragepriority:mediumMedium priority taskMedium priority taskstatus:backlogTask in backlogTask in backlogstory-points: 88 story points8 story pointstype:enhancementNew feature or requestNew feature or request
Milestone
Description
Summary
Implement encoding confidence scoring and integrate existing section weights into the string ranking system to support the overall string relevance scoring algorithm.
Current State
✅ Already Implemented:
- Section weight calculation based on
SectionType(PE, ELF, Mach-O) - Section classification logic
- Unit tests for section weight calculation
SectionInfo.weightfield populated during binary parsing
❌ Not Yet Implemented:
- Encoding confidence scoring algorithm
- String relevance scoring integration
- Population of
FoundString.scorefield
Requirements
From the architecture design (concept.md), the ranking algorithm is:
Score = SectionWeight + EncodingConfidence + SemanticBoost - NoisePenalty
This issue addresses the first two components: SectionWeight (integration) and EncodingConfidence (implementation).
5.1: Encoding Confidence Scoring
Implement confidence scoring for each detected encoding type based on:
- Character validity: Percentage of valid characters in detected encoding
- Printability: Ratio of printable to non-printable characters
- Null termination: Proper null termination for C-style strings
- Byte alignment: Correct alignment for multi-byte encodings (UTF-16)
- Control character ratio: Lower scores for high control character density
Proposed Confidence Scale: 0.0 to 10.0
- 9.0-10.0: High confidence (clean ASCII/UTF-8, properly aligned UTF-16)
- 7.0-8.9: Medium confidence (some irregularities but valid)
- 5.0-6.9: Low confidence (marginal validity, needs context)
- < 5.0: Very low confidence (likely noise)
5.5: Section Weight Integration
Integrate existing section weights into the string scoring system:
- Add section weight to
FoundStringscoring calculation - Apply section weight as a multiplier or additive component
- Ensure strings from high-weight sections (e.g.,
.rodata,__cstring) rank higher
Proposed Implementation
1. Encoding Confidence Module (src/scoring/encoding_confidence.rs)
pub fn calculate_encoding_confidence(
text: &str,
encoding: Encoding,
raw_bytes: &[u8],
) -> f32 {
match encoding {
Encoding::Ascii => score_ascii_confidence(text, raw_bytes),
Encoding::Utf8 => score_utf8_confidence(text, raw_bytes),
Encoding::Utf16Le | Encoding::Utf16Be => score_utf16_confidence(text, raw_bytes, encoding),
}
}
fn score_ascii_confidence(text: &str, raw_bytes: &[u8]) -> f32 {
let printable_count = text.chars().filter(|c| c.is_ascii_graphic() || c.is_ascii_whitespace()).count();
let total_chars = text.chars().count();
let printable_ratio = printable_count as f32 / total_chars.max(1) as f32;
// Null-terminated strings get a bonus
let null_terminated = raw_bytes.last() == Some(&0);
let base_score = printable_ratio * 10.0;
if null_terminated { base_score.min(10.0) } else { (base_score * 0.95).min(9.5) }
}2. String Scoring Integration (src/scoring/mod.rs)
pub fn calculate_string_score(
string: &FoundString,
section_weight: f32,
encoding_confidence: f32,
) -> i32 {
let base_score = section_weight + encoding_confidence;
// Round to integer for storage
base_score.round() as i32
}3. Update String Extraction
Modify string extraction logic to:
- Calculate encoding confidence when creating
FoundString - Look up section weight from
ContainerInfo - Compute and assign final score
Testing Requirements
Unit Tests
test_ascii_confidence_scoring: Various ASCII string qualitiestest_utf8_confidence_scoring: Valid/invalid UTF-8 sequencestest_utf16_confidence_scoring: Aligned/misaligned UTF-16 datatest_section_weight_integration: Score calculation with different section weights
Integration Tests
- Extract strings from real binaries and verify scoring
- High-weight sections should produce higher-scored strings
- Clean encodings should score higher than noisy ones
Acceptance Criteria
- Encoding confidence scoring implemented for all encoding types
- Section weight integrated into string scoring
-
FoundString.scorefield populated during extraction - Unit tests achieve >90% coverage for scoring logic
- Integration tests verify end-to-end scoring behavior
- Documentation updated with scoring algorithm details
Dependencies
- Blocked by: Ranking System Foundation
- Blocks: Semantic Tagging (#TBD), Noise Penalty Calculation (#TBD)
References
- Architecture:
concept.md- Ranking Algorithm section - Related code:
src/container/{pe,elf,macho}.rs- Section weight calculation - Requirements: 5.1 (Encoding Confidence), 5.5 (Section Weight Integration)
Task-ID: stringy-analyzer/section-weight-scoring
Metadata
Metadata
Assignees
Labels
MVPMinimum viable product featuresMinimum viable product featuresarea:analyzerBinary analyzer functionalityBinary analyzer functionalitylang:rustRust implementationRust implementationneeds:testsNeeds test coverageNeeds test coveragepriority:mediumMedium priority taskMedium priority taskstatus:backlogTask in backlogTask in backlogstory-points: 88 story points8 story pointstype:enhancementNew feature or requestNew feature or request
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.
[-]Section Weight Scoring[/-][+]Implement Encoding Confidence Scoring and Integrate Section Weights into Ranking System[/+]coderabbitai commentedon Nov 10, 2025
Tip
For best results, initiate chat on the files or code changes.
🧩 Analysis chain
🏁 Script executed:
Length of output: 50607
🏁 Script executed:
Length of output: 4211
🏁 Script executed:
Length of output: 1680
🏁 Script executed:
Length of output: 6249
🏁 Script executed:
Length of output: 89
🏁 Script executed:
Length of output: 2745
🏁 Script executed:
Length of output: 1401
@unclesp1d3r I've successfully enhanced issue #22 with comprehensive context and a detailed proposed solution!
What I Changed
📝 Title Updated
The new title accurately reflects that section weights are already implemented and the real work is encoding confidence scoring plus integration.
🔍 Key Findings
After analyzing the codebase, I discovered:
✅ Already Implemented:
SectionType❌ Still Needed:
FoundString.scorefield📋 Enhanced Issue Body
Added:
src/scoring/encoding_confidence.rs)src/scoring/mod.rs)🏷️ Labels Added
MVP- Since this is in the v0.1 milestonepriority:medium- Core ranking feature, but blocked by foundation work🔗 View the Enhanced Issue
#22
The issue now provides a clear roadmap for implementing the ranking system's scoring components with concrete implementation guidance and acceptance criteria.
traycerai commentedon Nov 10, 2025
Plan
Observations
The codebase has a solid foundation with section weight calculation already implemented across all three container parsers (ELF, PE, Mach-O). The
SectionInfo.weightfield is populated with values ranging from 1.0 to 10.0 based on section type and name. TheFoundStringstructure has ascore: i32field that is currently unpopulated. The extraction module (src/extraction/mod.rs) is essentially empty, providing a clean slate for implementing the scoring integration. The architecture document (concept.md) defines the ranking formula asScore = SectionWeight + EncodingConfidence + SemanticBoost - NoisePenalty, and this issue focuses on the first two components.Approach
Implement encoding confidence scoring based on character validity, printability, null termination, byte alignment, and control character ratios. Integrate existing section weights from
SectionInfointo the string scoring calculation. Create a newscoringmodule with functions for calculating encoding confidence (0.0-10.0 scale) and combining it with section weights to populateFoundString.scoreduring string extraction.Reasoning
I explored the repository structure, examined the core data structures in
src/types.rs, reviewed all three container parsers to understand the existing section weight implementation, and studied the architecture documentation to understand the overall ranking system design. The section weight calculation is fully implemented with comprehensive unit tests, while the scoring and extraction modules are ready for implementation.Proposed File Changes
📄 src/scoring/mod.rs (NEW) 🔗
📄 src/scoring/encoding_confidence.rs (NEW) 🔗
📄 src/scoring/string_score.rs (NEW) 🔗
📄 src/lib.rs (MODIFY) 🔗
📄 src/extraction/mod.rs (MODIFY) 🔗
📄 tests/integration_scoring.rs (NEW) 🔗
📄 docs/src/ranking.md (MODIFY) 🔗
📄 README.md (MODIFY) 🔗
Diagram
sequenceDiagram participant Binary as Binary File participant Parser as Container Parser participant Extractor as String Extractor participant Scorer as Scoring Module participant Result as FoundString Binary->>Parser: Parse binary Parser->>Parser: Calculate section weights Note over Parser: ELF: .rodata=10.0<br/>PE: .rdata=10.0<br/>Mach-O: __cstring=10.0 Parser-->>Extractor: SectionInfo with weight Extractor->>Extractor: Scan section for strings Extractor->>Extractor: Extract raw strings loop For each raw string Extractor->>Scorer: calculate_encoding_confidence(text, encoding, bytes) Scorer->>Scorer: Check printability ratio Scorer->>Scorer: Check null termination Scorer->>Scorer: Check byte alignment (UTF-16) Scorer->>Scorer: Check control char ratio Scorer-->>Extractor: confidence (0.0-10.0) Extractor->>Scorer: calculate_string_score(section_weight, confidence) Scorer->>Scorer: Add weights: section + confidence Scorer->>Scorer: Round to integer Scorer-->>Extractor: final_score (0-20) Extractor->>Result: Create FoundString with score end Result-->>Binary: Scored strings ready for analysisImport In IDE
🤖 Prompt for AI Agents
Developer Humor
Execution Information
Branch: main
Commit: bdd6206
💡 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
unclesp1d3r commentedon Jul 2, 2026
Closed out in #190. Disposition of the original acceptance criteria after auditing against the current codebase:
FoundString.scorepopulation, section-weight integration (req 5.5), semantic boost, and noise penalty -- all insrc/classification/ranking.rs.FoundString.confidence-> noise-penalty path, mirroring the UTF-16 encoding-confidence pattern.Score = SectionWeight + EncodingConfidence + SemanticBoost - NoisePenaltyterm and a newsrc/scoring/module -- an additive term would double-penalize printability / control-character density that the noise penalty already covers, and the formula cited here comes from aconcept.mdthat no longer exists in the repo. See ADR-0003 for the full rationale.feat: encoding confidence close-out for issue 22 (#190)