diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1412b93..4d6f904 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,11 +6,15 @@ version: 2 updates: - - package-ecosystem: "devcontainers" + - package-ecosystem: "cargo" directory: "/" schedule: interval: "weekly" - - package-ecosystem: "cargo" + - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "weekly" + interval: "daily" + - package-ecosystem: "rust-toolchain" + directory: "/" + schedule: + interval: "daily" diff --git a/.kiro/hooks/ci-auto-fix.kiro.hook b/.kiro/hooks/ci-auto-fix.kiro.hook index 125b538..cdd4b5f 100644 --- a/.kiro/hooks/ci-auto-fix.kiro.hook +++ b/.kiro/hooks/ci-auto-fix.kiro.hook @@ -8,15 +8,12 @@ "patterns": [ "src/**/*.rs", "Cargo.toml", - "Cargo.lock", "tests/**/*.rs", - "*.md", - "rustfmt.toml", - ".gitignore" + "rustfmt.toml" ] }, "then": { "type": "askAgent", - "prompt": "Source files have been modified. Please run a comprehensive CI check and fix any issues found. This should include:\n\n1. **Code Formatting**: Run `cargo fmt` to fix any formatting issues\n2. **Linting**: Run `cargo clippy --all-targets --all-features -- -D warnings` and fix any clippy warnings\n3. **Compilation**: Ensure `cargo build` and `cargo build --release` both succeed\n4. **Testing**: Run `cargo test` and `cargo nextest run` (if available) and fix any test failures\n5. **Security Audit**: Run `cargo audit` and address any security vulnerabilities\n6. **License Compliance**: Check that all dependencies have compatible licenses\n7. **Documentation**: Ensure `cargo doc` builds without warnings\n8. **Coverage**: Run coverage checks if llvm-cov is available\n\nFor each issue found:\n- Identify the root cause\n- Apply the appropriate fix\n- Verify the fix resolves the issue\n- Ensure no new issues are introduced\n\nIf any issues cannot be automatically fixed, provide clear guidance on manual resolution steps needed." + "prompt": "Source files have been modified. Please run a comprehensive CI check and fix any issues found. This should include:\n\n1. **Code Formatting**: Run `just format` to fix any formatting issues\n2. **Linting**: Run `just lint` and fix any clippy warnings\n3. **Compilation**: Ensure `just build` and `just build-release` both succeed\n4. **Testing**: Run `just test` and `cargo nextest run` (if available) and fix any test failures\n5. **Security Audit**: Run `just audit` and address any security vulnerabilities\n6. **License Compliance**: Check that all dependencies have compatible licenses by running `just deny`\n7. **Documentation**: Ensure `just docs-build` builds without warnings (skip on Windows)\n8. **Coverage**: Run coverage checks with `just coverage-check` to ensure we are meeting our coverage thresholds\n\nFor each issue found:\n- Identify the root cause\n- Apply the appropriate fix\n- Verify the fix resolves the issue\n- Ensure no new issues are introduced\n\nIf any issues cannot be automatically fixed, provide clear guidance on manual resolution steps needed." } } \ No newline at end of file diff --git a/.kiro/specs/stringy-binary-analyzer/tasks.md b/.kiro/specs/stringy-binary-analyzer/tasks.md index 39c598f..e334b75 100644 --- a/.kiro/specs/stringy-binary-analyzer/tasks.md +++ b/.kiro/specs/stringy-binary-analyzer/tasks.md @@ -3,144 +3,166 @@ - [x] 1. Create basic project structure - Create Cargo.toml with essential dependencies (goblin, clap, serde, serde_json) + - Create src/lib.rs and src/main.rs with basic module declarations + - Create directory structure: src/container/, src/extraction/, src/classification/, src/output/ + - _Requirements: 1.1, 9.1_ -- [x] 1.1 Define core data types + - [x] 1.1 Define core data types - - Create src/types.rs with FoundString struct and basic serialization - - Define Encoding enum (Ascii, Utf8, Utf16Le, Utf16Be) - - Define Tag enum for semantic classification - - _Requirements: 1.1, 6.1_ + - Create src/types.rs with FoundString struct and basic serialization + - Define Encoding enum (Ascii, Utf8, Utf16Le, Utf16Be) + - Define Tag enum for semantic classification + - _Requirements: 1.1, 6.1_ -- [x] 1.2 Define container and section types + - [x] 1.2 Define container and section types - - Add SectionType enum (StringData, ReadOnlyData, WritableData, Code, Debug, Resources, Other) - - Add StringSource enum (SectionData, ImportName, ExportName, ResourceString, LoadCommand, DebugInfo) - - Add ContainerInfo and SectionInfo structs - - _Requirements: 1.1, 1.4_ + - Add SectionType enum (StringData, ReadOnlyData, WritableData, Code, Debug, Resources, Other) + - Add StringSource enum (SectionData, ImportName, ExportName, ResourceString, LoadCommand, DebugInfo) + - Add ContainerInfo and SectionInfo structs + - _Requirements: 1.1, 1.4_ -- [x] 1.3 Create error handling framework + - [x] 1.3 Create error handling framework - - Define StringyError enum with common error types - - Create Result type alias for the project - - Add basic error conversion implementations - - _Requirements: 1.4_ + - Define StringyError enum with common error types + - Create Result type alias for the project + - Add basic error conversion implementations + - _Requirements: 1.4_ - [x] 2. Implement basic format detection - Create ContainerParser trait in src/container/mod.rs + - Implement basic format detection using goblin to identify ELF, PE, Mach-O + - Add simple unit test for format detection + - _Requirements: 1.1, 1.4_ -- [x] 2.1 Create ELF container parser stub + - [x] 2.1 Create ELF container parser stub - - Create src/container/elf.rs with basic ELF parser structure - - Implement ELF format detection and basic section enumeration - - Add unit test for ELF section identification - - _Requirements: 1.1_ + - Create src/container/elf.rs with basic ELF parser structure + - Implement ELF format detection and basic section enumeration + - Add unit test for ELF section identification + - _Requirements: 1.1_ -- [x] 2.2 Create PE container parser stub + - [x] 2.2 Create PE container parser stub - - Create src/container/pe.rs with basic PE parser structure - - Implement PE format detection and basic section enumeration - - Add unit test for PE section identification - - _Requirements: 1.2_ + - Create src/container/pe.rs with basic PE parser structure + - Implement PE format detection and basic section enumeration + - Add unit test for PE section identification + - _Requirements: 1.2_ -- [x] 2.3 Create Mach-O container parser stub + - [x] 2.3 Create Mach-O container parser stub - - Create src/container/macho.rs with basic Mach-O parser structure - - Implement Mach-O format detection and basic section enumeration - - Add unit test for Mach-O section identification - - _Requirements: 1.3_ + - Create src/container/macho.rs with basic Mach-O parser structure + - Implement Mach-O format detection and basic section enumeration + - Add unit test for Mach-O section identification + - _Requirements: 1.3_ - [ ] 3. Implement ELF section classification - Enhance ELF parser to classify sections by type (string data vs code vs other) + - Implement logic to identify .rodata, .data.rel.ro, .comment sections + - Add section weight assignment based on likelihood of containing meaningful strings + - _Requirements: 1.1, 1.4_ -- [ ] 3.1 Add ELF import/export extraction + - [ ] 3.1 Add ELF import/export extraction - - Extract import and export symbol names from ELF dynamic section - - Classify symbols as imports vs exports for proper tagging - - Add unit tests for symbol extraction - - _Requirements: 4.2, 4.3_ + - Extract import and export symbol names from ELF dynamic section + - Classify symbols as imports vs exports for proper tagging + - Add unit tests for symbol extraction + - _Requirements: 4.2, 4.3_ - [ ] 4. Implement PE section classification - Enhance PE parser to classify sections (.rdata, .data) by string likelihood + - Add section weight assignment for PE-specific sections + - Implement basic PE import/export table parsing + - _Requirements: 1.2, 1.4_ -- [ ] 4.1 Add PE resource extraction foundation + - [ ] 4.1 Add PE resource extraction foundation - - Add pelite dependency to Cargo.toml - - Implement basic PE resource enumeration - - Create framework for extracting VERSIONINFO and STRINGTABLE resources - - _Requirements: 1.2_ + - Add pelite dependency to Cargo.toml + - Implement basic PE resource enumeration + - Create framework for extracting VERSIONINFO and STRINGTABLE resources + - _Requirements: 1.2_ -- [ ] 4.2 Implement PE resource string extraction + - [ ] 4.2 Implement PE resource string extraction - - Extract strings from VERSIONINFO resources - - Extract strings from STRINGTABLE resources - - Add manifest resource string extraction - - _Requirements: 1.2_ + - Extract strings from VERSIONINFO resources + - Extract strings from STRINGTABLE resources + - Add manifest resource string extraction + - _Requirements: 1.2_ - [ ] 5. Implement Mach-O section classification - Enhance Mach-O parser to identify string-containing sections + - Classify \_\_TEXT,\_\_cstring, \_\_TEXT,\_\_const, \_\_DATA_CONST sections + - Add section weight assignment for Mach-O sections + - _Requirements: 1.3, 1.4_ -- [ ] 5.1 Add Mach-O load command processing + - [ ] 5.1 Add Mach-O load command processing - - Add object crate dependency for enhanced Mach-O support - - Extract strings from load commands - - Implement load command string classification and tagging - - _Requirements: 1.3_ + - Add object crate dependency for enhanced Mach-O support + - Extract strings from load commands + - Implement load command string classification and tagging + - _Requirements: 1.3_ - [ ] 6. Create string extraction framework - Create StringExtractor trait in src/extraction/mod.rs + - Define RawString struct for extracted string data with metadata + - Create ExtractionConfig struct for configurable parameters + - _Requirements: 2.1_ -- [ ] 6.1 Implement basic ASCII string extraction + - [ ] 6.1 Implement basic ASCII string extraction - - Create src/extraction/ascii.rs with ASCII extraction logic - - Implement scanning for printable character runs (0x20-0x7E) - - Add configurable minimum length filtering - - Add unit tests for basic ASCII extraction - - _Requirements: 2.1_ + - Create src/extraction/ascii.rs with ASCII extraction logic + - Implement scanning for printable character runs (0x20-0x7E) + - Add configurable minimum length filtering + - Add unit tests for basic ASCII extraction + - _Requirements: 2.1_ -- [ ] 6.2 Add ASCII noise filtering + - [ ] 6.2 Add ASCII noise filtering - - Implement heuristics to distinguish legitimate strings from binary noise - - Add logic to avoid extracting from obvious padding or table data - - Consider section context when determining string legitimacy - - _Requirements: 1.4, 2.1_ + - Implement heuristics to distinguish legitimate strings from binary noise + - Add logic to avoid extracting from obvious padding or table data + - Consider section context when determining string legitimacy + - _Requirements: 1.4, 2.1_ - [ ] 7. Implement UTF-16LE string extraction - Create src/extraction/utf16.rs with UTF-16LE extraction logic + - Implement detection of even-length sequences with mostly-zero high bytes + - Add configurable minimum length for wide character strings + - Add unit tests for UTF-16LE extraction + - _Requirements: 2.2_ -- [ ] 7.1 Add UTF-16BE support and confidence scoring + - [ ] 7.1 Add UTF-16BE support and confidence scoring - - Extend UTF-16 extractor to handle big-endian byte order - - Implement confidence scoring to avoid false positives - - Add detection of null-interleaved text patterns - - _Requirements: 2.3, 2.4_ + - Extend UTF-16 extractor to handle big-endian byte order + - Implement confidence scoring to avoid false positives + - Add detection of null-interleaved text patterns + - _Requirements: 2.3, 2.4_ - [ ] 8. Implement string deduplication @@ -153,182 +175,208 @@ - [ ] 9. Create semantic classification framework - Create Classifier trait in src/classification/mod.rs + - Define StringContext struct for classification context + - Create basic classification pipeline structure + - _Requirements: 3.1_ -- [ ] 9.1 Implement URL and domain classification + - [ ] 9.1 Implement URL and domain classification - - Add regex dependency to Cargo.toml - - Create src/classification/semantic.rs with URL pattern matching - - Implement domain name detection and validation - - Add unit tests for URL and domain classification - - _Requirements: 3.1, 3.2_ + - Add regex dependency to Cargo.toml + - Create src/classification/semantic.rs with URL pattern matching + - Implement domain name detection and validation + - Add unit tests for URL and domain classification + - _Requirements: 3.1, 3.2_ -- [ ] 9.2 Implement IP address classification + - [ ] 9.2 Implement IP address classification - - Add IPv4 address pattern matching to semantic classifier - - Add IPv6 address pattern matching - - Include unit tests for IP address detection - - _Requirements: 3.3_ + - Add IPv4 address pattern matching to semantic classifier + - Add IPv6 address pattern matching + - Include unit tests for IP address detection + - _Requirements: 3.3_ -- [ ] 9.3 Implement file path classification + - [ ] 9.3 Implement file path classification - - Add POSIX file path pattern matching - - Add Windows file path pattern matching - - Include registry path detection - - Add unit tests for path classification - - _Requirements: 3.4, 3.5_ + - Add POSIX file path pattern matching + - Add Windows file path pattern matching + - Include registry path detection + - Add unit tests for path classification + - _Requirements: 3.4, 3.5_ -- [ ] 9.4 Implement remaining semantic patterns + - [ ] 9.4 Implement remaining semantic patterns - - Add GUID pattern matching - - Add email address pattern matching - - Add Base64 pattern detection - - Add printf-style format string detection - - Add user agent pattern matching - - Include comprehensive unit tests - - _Requirements: 3.6, 3.7, 3.8, 3.9, 3.10_ + - Add GUID pattern matching + - Add email address pattern matching + - Add Base64 pattern detection + - Add printf-style format string detection + - Add user agent pattern matching + - Include comprehensive unit tests + - _Requirements: 3.6, 3.7, 3.8, 3.9, 3.10_ - [ ] 10. Implement symbol processing - Create src/classification/symbols.rs + - Add rustc-demangle dependency to Cargo.toml + - Implement basic Rust symbol demangling + - Add unit tests for symbol demangling + - _Requirements: 4.1_ -- [ ] 10.1 Add import/export classification + - [ ] 10.1 Add import/export classification - - Implement import name identification and tagging - - Implement export name identification and tagging - - Add section name processing and classification - - Include unit tests for import/export detection - - _Requirements: 4.2, 4.3, 4.4_ + - Implement import name identification and tagging + - Implement export name identification and tagging + - Add section name processing and classification + - Include unit tests for import/export detection + - _Requirements: 4.2, 4.3, 4.4_ - [ ] 11. Create ranking system foundation - Create src/classification/ranking.rs with RankingEngine struct + - Define scoring configuration and weight mappings + - Implement basic score calculation framework + - _Requirements: 5.1_ -- [ ] 11.1 Implement section weight scoring + - [ ] 11.1 Implement section weight scoring - - Add section weight calculation based on SectionType - - Implement encoding confidence scoring - - Add unit tests for section-based scoring - - _Requirements: 5.1, 5.5_ + - Add section weight calculation based on SectionType + - Implement encoding confidence scoring + - Add unit tests for section-based scoring + - _Requirements: 5.1, 5.5_ -- [ ] 11.2 Implement semantic boost scoring + - [ ] 11.2 Implement semantic boost scoring - - Add semantic boost calculation for different tag types - - Implement import/export name boost scoring - - Add unit tests for semantic boost calculation - - _Requirements: 5.2, 5.4_ + - Add semantic boost calculation for different tag types + - Implement import/export name boost scoring + - Add unit tests for semantic boost calculation + - _Requirements: 5.2, 5.4_ -- [ ] 11.3 Implement noise penalty detection + - [ ] 11.3 Implement noise penalty detection - - Add high entropy detection and penalty calculation - - Implement excessive length penalty - - Add repeated pattern detection - - Add table data detection heuristics - - Include unit tests for noise penalty calculation - - _Requirements: 5.3_ + - Add high entropy detection and penalty calculation + - Implement excessive length penalty + - Add repeated pattern detection + - Add table data detection heuristics + - Include unit tests for noise penalty calculation + - _Requirements: 5.3_ - [ ] 12. Create output formatting framework - Create src/output/mod.rs with output formatter traits + - Define common output interfaces and structures + - Create output configuration options + - _Requirements: 6.1_ -- [ ] 12.1 Implement JSONL output format + - [ ] 12.1 Implement JSONL output format - - Create src/output/json.rs with JSONL formatter - - Implement serialization of FoundString with all required fields - - Add unit tests for JSONL output format - - _Requirements: 6.1, 6.4_ + - Create src/output/json.rs with JSONL formatter + - Implement serialization of FoundString with all required fields + - Add unit tests for JSONL output format + - _Requirements: 6.1, 6.4_ -- [ ] 12.2 Implement human-readable output + - [ ] 12.2 Implement human-readable output - - Create src/output/human.rs with table formatter - - Implement sorted table display with proper column alignment - - Add unit tests for human-readable output - - _Requirements: 6.2_ + - Create src/output/human.rs with table formatter + - Implement sorted table display with proper column alignment + - Add unit tests for human-readable output + - _Requirements: 6.2_ -- [ ] 12.3 Implement YARA-friendly output + - [ ] 12.3 Implement YARA-friendly output - - Create src/output/yara.rs with YARA rule formatter - - Implement proper string escaping for YARA rules - - Add truncation rules for long strings - - Include unit tests for YARA output format - - _Requirements: 6.3_ + - Create src/output/yara.rs with YARA rule formatter + - Implement proper string escaping for YARA rules + - Add truncation rules for long strings + - Include unit tests for YARA output format + - _Requirements: 6.3_ - [ ] 13. Create basic CLI structure - Implement basic CLI argument parsing in src/main.rs using clap + - Add file input argument and basic error handling + - Create simple CLI structure with help text + - _Requirements: 7.7_ -- [ ] 13.1 Add filtering CLI arguments + - [ ] 13.1 Add filtering CLI arguments - - Implement --min-len argument for minimum string length - - Add --enc argument for encoding selection - - Add --only-tags and --notags for tag filtering - - Include unit tests for argument parsing - - _Requirements: 7.1, 7.2, 7.3, 7.4_ + - Implement --min-len argument for minimum string length + - Add --enc argument for encoding selection + - Add --only-tags and --notags for tag filtering + - Include unit tests for argument parsing + - _Requirements: 7.1, 7.2, 7.3, 7.4_ -- [ ] 13.2 Add output format CLI arguments + - [ ] 13.2 Add output format CLI arguments - - Implement --top argument for result limiting - - Add --json flag for JSONL output format - - Set default to human-readable output when no format specified - - Add integration tests for CLI output format selection - - _Requirements: 7.5, 7.6, 7.7_ + - Implement --top argument for result limiting + - Add --json flag for JSONL output format + - Set default to human-readable output when no format specified + - Add integration tests for CLI output format selection + - _Requirements: 7.5, 7.6, 7.7_ - [ ] 14. Add memory mapping support - Add memmap2 dependency to Cargo.toml + - Implement memory-mapped file reading for large files + - Add fallback to regular file reading for small files + - Include unit tests for memory mapping functionality + - _Requirements: 8.1_ -- [ ] 14.1 Implement regex caching + - [ ] 14.1 Implement regex caching - - Add regex compilation caching to semantic classifier - - Implement lazy initialization of regex patterns - - Add performance benchmarks for regex caching - - _Requirements: 8.3_ + - Add regex compilation caching to semantic classifier + - Implement lazy initialization of regex patterns + - Add performance benchmarks for regex caching + - _Requirements: 8.3_ - [ ] 15. Create basic test infrastructure - Create tests/fixtures/ directory with sample binary files + - Add basic integration test framework + - Create simple ELF, PE, and Mach-O test binaries + - _Requirements: All requirements validation_ -- [ ] 15.1 Add comprehensive integration tests + - [ ] 15.1 Add comprehensive integration tests - - Add criterion dependency for performance benchmarks - - Implement end-to-end CLI functionality tests - - Add insta dependency for snapshot testing - - Create cross-platform validation tests - - _Requirements: All requirements validation_ + - Add criterion dependency for performance benchmarks + - Implement end-to-end CLI functionality tests + - Add insta dependency for snapshot testing + - Create cross-platform validation tests + - _Requirements: All requirements validation_ - [ ] 16. Create main extraction pipeline - Create main extraction orchestrator in src/lib.rs + - Wire together format detection, parsing, extraction, classification, and ranking + - Implement proper error handling throughout the pipeline + - _Requirements: All requirements integration_ -- [ ] 16.1 Complete pipeline integration + - [ ] 16.1 Complete pipeline integration - - Integrate all components with consistent data flow - - Add comprehensive error recovery mechanisms - - Implement end-to-end integration tests - - Validate complete pipeline against all requirements - - _Requirements: All requirements integration_ + - Integrate all components with consistent data flow + - Add comprehensive error recovery mechanisms + - Implement end-to-end integration tests + - Validate complete pipeline against all requirements + - _Requirements: All requirements integration_ diff --git a/.mega-linter.yml b/.mega-linter.yml new file mode 100644 index 0000000..a195820 --- /dev/null +++ b/.mega-linter.yml @@ -0,0 +1,48 @@ +--- +# MegaLinter configuration for StringyMcStringFace +# This configuration minimizes false positives while maintaining code quality + +# Apply linter fixes where safe +APPLY_FIXES: all + +# File/directory exclusions +EXCLUDED_DIRECTORIES: + - target + - dist + - build + - node_modules + - .git + - .cache + - coverage + - docs/book + - docs/build + +# All linters now properly configured + +# ActionLint configuration - suppress shellcheck issues in generated cargo-dist file +ACTION_ACTIONLINT_ARGUMENTS: + - --ignore=SC2086:info + - --ignore=SC2129:style + - --ignore=SC2001:style + +# File-specific exclusions for generated content +FILTER_REGEX_EXCLUDE: | + \.github/workflows/release\.yml + +# Lychee configuration for link checking +SPELL_LYCHEE_ARGUMENTS: + - --no-progress + - --exclude-loopback + - --exclude-private + - --exclude-mail + - --timeout=10 + +# Markdown table formatting exclusions +MARKDOWN_MARKDOWN_TABLE_FORMATTER_FILTER_REGEX_EXCLUDE: | + README\.md + +# Prettier configuration - respect .prettierignore +JSON_PRETTIER_ARGUMENTS: + - --check +YAML_PRETTIER_ARGUMENTS: + - --check diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bc4f23a..8432554 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,90 +1,90 @@ # .pre-commit-config.yaml repos: - # ๐Ÿงผ Standard code cleanup hooks (language agnostic) - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v6.0.0 - hooks: - - id: check-added-large-files - args: ["--maxkb=10240"] - - id: check-case-conflict - - id: check-merge-conflict - - id: check-illegal-windows-names - - id: check-json - - id: check-toml - - id: check-yaml - args: [--allow-multiple-documents] - - id: check-xml - - id: mixed-line-ending - args: [--fix=auto] - - id: check-vcs-permalinks + # ๐Ÿงผ Standard code cleanup hooks (language agnostic) + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: check-added-large-files + args: ["--maxkb=10240"] + - id: check-case-conflict + - id: check-merge-conflict + - id: check-illegal-windows-names + - id: check-json + - id: check-toml + - id: check-yaml + args: [--allow-multiple-documents] + - id: check-xml + - id: mixed-line-ending + args: [--fix=auto] + - id: check-vcs-permalinks - - repo: https://github.com/FeryET/pre-commit-rust - rev: v1.2.1 - hooks: - - id: fmt - - id: clippy - - id: cargo-check - - id: build + - repo: https://github.com/FeryET/pre-commit-rust + rev: v1.2.1 + hooks: + - id: fmt + - id: clippy + - id: cargo-check + - id: build - # ๐Ÿงช GitHub Actions validation - - repo: https://github.com/rhysd/actionlint - rev: v1.7.7 - hooks: - - id: actionlint - files: ".github/workflows/" - exclude: ^.github/workflows/release.yml$ + # ๐Ÿงช GitHub Actions validation + - repo: https://github.com/rhysd/actionlint + rev: v1.7.7 + hooks: + - id: actionlint + files: ".github/workflows/" + exclude: ^.github/workflows/release.yml$ - # ๐Ÿš Shell script validation - - repo: https://github.com/koalaman/shellcheck-precommit - rev: v0.11.0 - hooks: - - id: shellcheck - exclude: ^.github/workflows/release.yml$ + # ๐Ÿš Shell script validation + - repo: https://github.com/koalaman/shellcheck-precommit + rev: v0.11.0 + hooks: + - id: shellcheck + exclude: ^.github/workflows/release.yml$ - # ๐Ÿ“ Commit message linting (commit-msg only, not blocking push) - - repo: https://github.com/commitizen-tools/commitizen - rev: v4.9.1 - hooks: - - id: commitizen - stages: [commit-msg] + # ๐Ÿ“ Commit message linting (commit-msg only, not blocking push) + - repo: https://github.com/commitizen-tools/commitizen + rev: v4.9.1 + hooks: + - id: commitizen + stages: [commit-msg] - # Temporarily disabled due to issues with cargo-machete while we are stubbing out the project - # - repo: https://github.com/bnjbvr/cargo-machete - # rev: v0.9.1 - # hooks: - # - id: cargo-machete + # Temporarily disabled due to issues with cargo-machete while we are stubbing out the project + # - repo: https://github.com/bnjbvr/cargo-machete + # rev: v0.9.1 + # hooks: + # - id: cargo-machete - # ๐Ÿ“ Markdown formatting and linting (temporarily disabled in CI due to path issues) - - repo: https://github.com/hukkin/mdformat - rev: 0.7.22 - hooks: - - id: mdformat - additional_dependencies: - - mdformat-gfm - - mdformat-admon - - mdformat-config - - mdformat-footnote - - mdformat-frontmatter - - mdformat-simple-breaks - - mdformat-tables - - mdformat-web - - mdformat-wikilink - - mdformat-gfm-alerts - - mdformat-rustfmt - - mdformat-toc - files: \.(md|mdx)$ + # ๐Ÿ“ Markdown formatting and linting (temporarily disabled in CI due to path issues) + - repo: https://github.com/hukkin/mdformat + rev: 0.7.22 + hooks: + - id: mdformat + additional_dependencies: + - mdformat-gfm + - mdformat-admon + - mdformat-config + - mdformat-footnote + - mdformat-frontmatter + - mdformat-simple-breaks + - mdformat-tables + - mdformat-web + - mdformat-wikilink + - mdformat-gfm-alerts + - mdformat-rustfmt + - mdformat-toc + files: \.(md|mdx)$ - # ๐Ÿ”’ Security audit for Rust dependencies (moved to CI) - - repo: local - hooks: - - id: cargo-audit - name: cargo-audit - entry: cargo audit - language: system - pass_filenames: false - always_run: true - - repo: https://github.com/DevinR528/cargo-sort - rev: v2.0.2 - hooks: - - id: cargo-sort + # ๐Ÿ”’ Security audit for Rust dependencies (moved to CI) + - repo: local + hooks: + - id: cargo-audit + name: cargo-audit + entry: cargo audit + language: system + pass_filenames: false + always_run: true + - repo: https://github.com/DevinR528/cargo-sort + rev: v2.0.2 + hooks: + - id: cargo-sort diff --git a/.prettierignore b/.prettierignore index b130e18..90dd8c3 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,11 @@ +# Prettier ignore file - exclude Markdown per user preference +*.md **/*.md -**/*.yml + +# Generated files +target/ +dist/ +build/ +node_modules/ +docs/book/ +.github/workflows/release.yml diff --git a/README.md b/README.md index 6929e7d..8918fd8 100644 --- a/README.md +++ b/README.md @@ -74,8 +74,8 @@ Presents the most relevant strings first using a scoring algorithm. ### From Source ```bash -git clone https://github.com/EvilBit-Labs/string_mcstringface -cd string_mcstringface +git clone https://github.com/EvilBit-Labs/StringyMcStringFace +cd StringyMcStringFace cargo build --release ./target/release/stringy --help ``` diff --git a/cspell.config.yaml b/cspell.config.yaml new file mode 100644 index 0000000..face390 --- /dev/null +++ b/cspell.config.yaml @@ -0,0 +1,151 @@ +--- +# cspell configuration for StringyMcStringFace +version: "0.2" + +language: "en" +useGitignore: true +allowCompoundWords: true +caseSensitive: false + +dictionaries: + - en_US + - rust + - bash + - softwareTerms + - companies + - misc + +ignorePaths: + - target/ + - dist/ + - build/ + - node_modules/ + - .git/ + - .cache/ + - coverage/ + - docs/book/ + - docs/build/ + - "*.lock" + - Cargo.lock + - ".github/workflows/release.yml" + +ignoreRegExpList: + # Hex hashes and SHAs + - "/\\b[a-fA-F0-9]{7,}\\b/g" + # UUIDs and GUIDs + - "/\\b[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\\b/g" + # URIs and URLs + - "/https?:\\/\\/[\\w\\-\\.]+[\\w\\-\\._~:\\/?#[\\]@!\\$&'\\(\\)\\*\\+,;=]*/g" + # File paths + - "/[\\/\\\\][\\w\\-\\.]+[\\/\\\\][\\w\\-\\._~\\/?#[\\]@!\\$&'\\(\\)\\*\\+,;=]*/g" + # Code fences and content + - "/```[\\s\\S]*?```/g" + # Inline code + - "/`[^`]+`/g" + # Mermaid diagram blocks + - "/```mermaid[\\s\\S]*?```/g" + # Base64-like strings + - "/\\b[A-Za-z0-9+/]{20,}={0,2}\\b/g" + +languageSettings: + - languageId: "markdown" + allowCompoundWords: true + dictionaries: + - en_US + - rust + - softwareTerms + - companies + - languageId: "yaml,yml" + allowCompoundWords: true + dictionaries: + - en_US + - bash + - softwareTerms + - languageId: "toml" + allowCompoundWords: true + dictionaries: + - en_US + - rust + - softwareTerms + - languageId: "json" + allowCompoundWords: true + dictionaries: + - en_US + - softwareTerms + +words: + # Project-specific terms + - StringyMcStringFace + - stringy + - EvilBit + - evilbitlabs + - UncleSp1d3r + - unclesp1d3r + + # Rust ecosystem + - rustc + - rustup + - clippy + - rustfmt + - tokio + - serde + - goblin + - bstr + - regex + - thiserror + - clap + - insta + - criterion + - nextest + - mdbook + - mdformat + - actionlint + - lychee + - megalinter + - cspell + - justfile + + # Build and CI tools + - dist + - axodotdev + - homebrew + - formulae + - binstall + - auditable + - cyclonedx + - SBOM + - msvc + - musl + - aarch + - x86_64 + + # Binary analysis terms + - rodata + - rdata + - cstring + - strtab + - dynstr + - rsrc + - macho + - mach + - YARA + - GUID + - GUIDs + + # Technical acronyms + - CLI + - JSON + - JSONL + - UTF + - UTF8 + - UTF16 + - UTF16LE + - UTF16BE + - ASCII + - APIs + - regex + - SHA + - API + - URL + - URLs + - IPs \ No newline at end of file diff --git a/docs/src/contributing.md b/docs/src/contributing.md index 7a1b27b..31944ad 100644 --- a/docs/src/contributing.md +++ b/docs/src/contributing.md @@ -13,8 +13,8 @@ We welcome contributions to Stringy! This guide will help you get started with d ### Clone and Setup ```bash -git clone https://github.com/EvilBit-Labs/string_mcstringface -cd string_mcstringface +git clone https://github.com/EvilBit-Labs/StringyMcStringFace +cd StringyMcStringFace # Install development dependencies cargo build diff --git a/docs/src/installation.md b/docs/src/installation.md index 4c838e5..747db97 100644 --- a/docs/src/installation.md +++ b/docs/src/installation.md @@ -22,8 +22,8 @@ source ~/.cargo/env ### Clone and Build ```bash -git clone https://github.com/EvilBit-Labs/string_mcstringface -cd string_mcstringface +git clone https://github.com/EvilBit-Labs/StringyMcStringFace +cd StringyMcStringFace cargo build --release ``` @@ -46,8 +46,8 @@ stringy --help For development and testing: ```bash -git clone https://github.com/EvilBit-Labs/string_mcstringface -cd string_mcstringface +git clone https://github.com/EvilBit-Labs/StringyMcStringFace +cd StringyMcStringFace cargo run -- --help ``` @@ -152,7 +152,7 @@ chmod +x ~/.cargo/bin/stringy If you encounter issues: 1. Check the [troubleshooting guide](./troubleshooting.md) -2. Search existing [GitHub issues](https://github.com/EvilBit-Labs/string_mcstringface/issues) +2. Search existing [GitHub issues](https://github.com/EvilBit-Labs/StringyMcStringFace/issues) 3. Open a new issue with: - Your operating system and version - Rust version (`rustc --version`) diff --git a/docs/src/troubleshooting.md b/docs/src/troubleshooting.md index a84f359..f9270fe 100644 --- a/docs/src/troubleshooting.md +++ b/docs/src/troubleshooting.md @@ -1,6 +1,6 @@ # Troubleshooting -This guide helps resolve common issues when using Stringy. If you don't find a solution here, please check the [GitHub issues](https://github.com/EvilBit-Labs/string_mcstringface/issues) or create a new issue. +This guide helps resolve common issues when using Stringy. If you don't find a solution here, please check the [GitHub issues](https://github.com/EvilBit-Labs/StringyMcStringFace/issues) or create a new issue. ## Installation Issues diff --git a/justfile b/justfile index b2848b7..d73f1a5 100644 --- a/justfile +++ b/justfile @@ -122,7 +122,18 @@ mdformat-install: # FORMATTING AND LINTING # ============================================================================= -format: fmt format-docs +alias format-rust := fmt +alias format-md := format-docs +alias format-just := fmt-justfile + +# Main format recipe - calls all formatters +format: fmt format-json-yaml format-docs fmt-justfile + +# Individual format recipes + +format-json-yaml: + npx prettier --write "**/*.{json,yaml,yml}" + [windows] format-docs: @@ -153,7 +164,21 @@ fmt-justfile: lint-justfile: @just --fmt --check --unstable -lint: lint-rust lint-justfile +# Main lint recipe - calls all sub-linters +lint: lint-rust lint-actions lint-spell lint-docs lint-justfile + +# Individual lint recipes +lint-actions: + actionlint .github/workflows/*.yml + +lint-spell: + cspell "**" --config cspell.config.yaml + +lint-docs: + markdownlint docs/**/*.md README.md + lychee docs/**/*.md README.md + +alias lint-just := lint-justfile # Run clippy with fixes fix: @@ -216,7 +241,6 @@ test-fs: test-ci: cargo nextest run --workspace --no-capture - # Run all tests including ignored/slow tests across workspace test-all: cargo nextest run --workspace --no-capture -- --ignored @@ -274,9 +298,57 @@ dist-check: dist-plan: @dist plan +# Regenerate cargo-dist CI workflow safely +dist-generate-ci: + dist generate --ci github + @echo "Generated CI workflow. Remember to fix any expression errors if they exist." + @echo "Run 'just lint:actions' to validate the generated workflow." + install: @cargo install --path . +# ============================================================================= +# DOCUMENTATION +# ============================================================================= + +# Build complete documentation (mdBook + rustdoc) +[unix] +docs-build: + #!/usr/bin/env bash + set -euo pipefail + # Build rustdoc + cargo doc --no-deps --document-private-items --target-dir docs/book/api-temp + # Move rustdoc output to final location + mkdir -p docs/book/api + cp -r docs/book/api-temp/doc/* docs/book/api/ + rm -rf docs/book/api-temp + # Build mdBook + cd docs && mdbook build + +# Serve documentation locally with live reload +[unix] +docs-serve: + cd docs && mdbook serve --open + +# Clean documentation artifacts +[unix] +docs-clean: + rm -rf docs/book target/doc + +# Check documentation (build + link validation + formatting) +[unix] +docs-check: + cd docs && mdbook build + @just fmt-check + +# Generate and serve documentation +[unix] +docs: docs-build docs-serve + +[windows] +docs: + @echo "mdbook requires a Unix-like environment to serve" + # ============================================================================= # GORELEASER TESTING # ============================================================================= diff --git a/src/container/macho.rs b/src/container/macho.rs index e2839de..b7fe03b 100644 --- a/src/container/macho.rs +++ b/src/container/macho.rs @@ -15,15 +15,15 @@ use goblin::mach::{Mach, MachO}; /// # Examples /// /// ```rust -/// use stringy::container::{ContainerParser, MachoParser}; +/// use stringy::container::{ContainerParser, macho::MachoParser}; /// /// let parser = MachoParser::new(); -/// let data = std::fs::read("example.dylib")?; -/// if MachoParser::detect(&data) { -/// let container_info = parser.parse(&data)?; -/// println!("Found {} sections", container_info.sections.len()); -/// } -/// # Ok::<(), Box>(()) +/// // Example usage (would require actual Mach-O binary data): +/// // let data = std::fs::read("example.dylib")?; +/// // if MachoParser::detect(&data) { +/// // let container_info = parser.parse(&data)?; +/// // println!("Found {} sections", container_info.sections.len()); +/// // } /// ``` pub struct MachoParser;