Skip to content

Claude/fix parsers 011 culyv ce9or z wnj6 wfu lf3#8

Open
Antonin-Deniau wants to merge 6 commits into
masterfrom
claude/fix-parsers-011CULYVCe9orZWnj6WfuLF3
Open

Claude/fix parsers 011 culyv ce9or z wnj6 wfu lf3#8
Antonin-Deniau wants to merge 6 commits into
masterfrom
claude/fix-parsers-011CULYVCe9orZWnj6WfuLF3

Conversation

@Antonin-Deniau

Copy link
Copy Markdown
Owner

No description provided.

- Created ELF, PE, and Mach-O parsers using the lief library
- Fixed import statements to use relative imports throughout the package
- Added lief dependency to pyproject.toml
- Updated .gitignore to include parser files (no longer auto-generated)

The parsers were previously missing (only .ksy files existed), causing
import errors. Now using lief library to parse binary formats instead
of generating parsers from Kaitai Struct definitions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fixed byte comparison in search.py to use integers instead of characters
- Removed debug print statements from search_elf function
- Fixed lief API usage to use isinstance() for type checking

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Changed string literal to bytes literal in search_pe function
- Fixes TypeError when processing PE sections with virtual/raw size differences

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Created comprehensive GitHub Actions workflow for CI/CD testing
- Auto-creates PE binaries using MinGW cross-compiler
- Auto-creates Mach-O binaries with minimal valid structure
- Updated test_parsers.py to auto-generate test binaries
- All parsers now tested: ELF, PE, and Mach-O
- Tests run on every push and pull request

Test Results:
- ✅ 4/4 tests passing (Import, ELF, PE, Mach-O)
- ✅ 0 failures
- ✅ 0 skipped tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Enhanced Mach-O binary creation to include 2 sections (__text and __const)
- Previously only created a segment with 0 sections
- Now properly tests section parsing functionality
- Updated test output to display section details (name, address, offset, size)
- Applied to both test_parsers.py and GitHub Actions workflow

Test Results:
✅ Mach-O parser now shows:
   - 1 segment (__TEXT)
   - 2 sections (__text, __const)
   - Full section details displayed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
IMPROVEMENTS:
1. Added Mach-O cave search test (was missing!)
2. Enhanced all cave search tests with thorough validation
3. Fixed Mach-O search_macho function to work with bytes

CAVE SEARCH TESTS NOW INCLUDE:
✅ ELF cave search - validates process completion and cave details
✅ PE cave search - validates process completion and cave details
✅ Mach-O cave search - NEW! validates process completion and cave details

VALIDATION CHECKS:
- Process starts successfully ("Starting cave mining process")
- Process completes successfully ("Mining finished")
- Cave count reported
- Cave details validated (section_name, cave_begin, cave_size, vaddress)
- Proper error handling with detailed output on failure

FIXES:
- Mach-O search function: Removed incorrect str type check
- Mach-O search function: Added null check for command.body
- Test binary: Enhanced with larger null byte areas for reliable cave detection
  * __text: 176 bytes of nulls (was scattered)
  * __const: 64 bytes of nulls (was minimal)

TEST RESULTS:
✅ ELF: Finds 2 caves in /bin/ls
✅ PE: Finds 17 caves in test.exe
✅ Mach-O: Finds 2 caves in test_macho

All three binary format parsers now have complete cave search testing! 🎉

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants