Carregar ficheiros para "/"

This commit is contained in:
2024-12-06 09:37:01 -08:00
parent 3506aa344e
commit 4324377987
5 changed files with 1548 additions and 0 deletions

297
README.md Normal file
View File

@ -0,0 +1,297 @@
# HexaWork - Byte Inspector
## Overview
HexaWork is a Python Tkinter application for binary file inspection and analysis. It provides a hexadecimal viewer and advanced byte analysis capabilities.
## Features
### 1. Hexadecimal View
- Three-column display: offset, hexadecimal values, and ASCII representation
- Uppercase hexadecimal values for better readability
- Monospace font for perfect alignment
- Horizontal and vertical scrollbars
### 2. Byte Analysis
#### Normal Order
- HEX: Hexadecimal representation of selected bytes
- DEC: Corresponding decimal value
- !HEX: Bitwise complement in hexadecimal
- !DEC: Bitwise complement in decimal
#### Reverse Order
- HEX: Hexadecimal representation of bytes in reverse order
- DEC: Decimal value of reverse order
- !HEX: Bitwise complement in hexadecimal
- !DEC: Bitwise complement in decimal
### 3. Flexible Selection
- Direct selection of hexadecimal values
- Full line selection including offset and ASCII
- Automatic analysis update on selection
### 4. ASCII Pattern Analysis
- Comprehensive file-wide ASCII text scanning
- Detects various patterns:
* Phone numbers
* Short letter sequences
* Alphanumeric codes
* Potential 3-letter abbreviations
- Interactive results popup
- Supports multiple pattern types
### 5. Advanced ASCII Pattern Recognition
- Comprehensive file-wide text scanning
- Multiple pattern detection:
* Possible Software Numbers (10-11 digits)
* Vehicle Identification Numbers (VIN)
* Potential Code Sequences
* Possible PIN Codes
- Unique pattern occurrence counting
- Interactive results display
- Supports complex alphanumeric pattern matching
### 6. Pattern Analysis Features
- Detailed pattern identification:
* Detects 3+ letter codes
* Finds long numeric sequences
* Highlights repeated patterns
- Occurrence frequency tracking
- User-friendly results popup
- Flexible pattern recognition
## Recent Updates and Enhancements
### Logging System
- Created centralized logging mechanism in `logger.py`
- Logs saved in timestamped files in `logs/` directory
- Provides detailed error tracking and information logging
- Supports both console and file logging
### Binary Graph Visualization
- Replaced Matplotlib with Plotly for interactive graphing
- Added `tkinterweb` support for rendering interactive graphs
- Enhanced scrolling capabilities for large binary files
- Improved error handling and data validation
### Error Handling
- Comprehensive error management across all modules
- User-friendly error messages
- Detailed logging for debugging purposes
### Performance Improvements
- More robust data type handling
- Optimized graph rendering
- Improved scrolling mechanisms
### New Dependencies
- Added `plotly` for interactive graphing
- Added `tkinterweb` for HTML-based graph rendering
### Installation
```bash
pip install -r requirements.txt
```
### Known Limitations
- Initial graph view limited to 512 data points
- Requires Python 3.12+
- Windows platform recommended
## Updates (December 6, 2023)
### EDC15 Info Window Enhancements
- **Hardware Number Detection**
- Automatically detects and displays 9-digit hardware numbers starting with prefixes (0281, 0265, 0255, 0275, 0235, 0285)
- Additional hardware numbers found are displayed in the comments section
- **Software Number Detection**
- Automatically finds and displays 9-digit software numbers starting with "103"
- Additional software numbers found are shown in the comments section
- Duplicate numbers are filtered out to avoid redundancy
- **Interface Improvements**
- Reorganized car information layout:
- Left side: Vertical alignment of all fields (Brand, Model, Engine, HP, KW, Year, VIN, Transmission)
- Right side: Comments section with scrollbar
- Replaced Save/Cancel buttons with:
- Create Project button (left-aligned)
- Cancel button (right-aligned)
- Improved field organization and spacing for better user experience
- Comments now show only unique additional hardware/software numbers
### New Features
- **Project Creation**
- Added new "Create Project" functionality
- Integrated with existing ECU information system
- Improved data validation and error handling
### Technical Updates
- Enhanced error logging for better debugging
- Improved memory management for binary file handling
- Updated UI components for better responsiveness
## Updates (December 20, 2023)
### Project Creation Workflow Enhancement
- Implemented strict project creation workflow
- Users must create a project before opening a binary file
- Added validation to ensure all required fields are filled
- Improved user experience by guiding project creation process
#### New Project Creation Rules
- "New Project" button in Flash Window initiates file selection
- EDC15 Info Window appears with mandatory fields
- Project can only be created after filling all required information
- Closing the info window without creating a project returns to the main screen
- Prevents accidental file opening without proper project context
#### Validation Improvements
- Comprehensive field validation in project creation
- Prevents project creation with incomplete information
- User-friendly warning messages for missing fields
- Enhanced data integrity and workflow control
### Technical Implementation Details
- Added `project_created` flag in `EDC15InfoWindow`
- Implemented `window_closed` flag to track user interactions
- Updated `open_file()` method in `FlashWindow`
- Modified main application flow to enforce project creation
### Benefits
- Improved data tracking and project management
- Prevents incomplete or accidental file processing
- Provides clear guidance for users during project creation
- Enhances overall application reliability
## Troubleshooting
- If you encounter any import errors, ensure all dependencies are installed
- Check log files in the `logs/` directory for detailed error information
## Installation
1. Requirements:
- Python 3.7 or higher
- Tkinter (usually included with Python)
2. Install dependencies:
```bash
pip install -r requirements.txt
```
## Usage
1. Run the program:
```bash
python main.py
```
2. Features:
- Click "Select File" to choose a binary file
- Select bytes in the hex viewer (using mouse or keyboard)
- View automatic analysis in Normal Order and Reverse Order panels
- Use scrollbars to navigate large files
## Examples
### Byte Analysis
If you select bytes "4E 31":
- Normal Order:
* HEX: 4E31
* DEC: 20017
* !HEX: [complement]
* !DEC: [decimal complement]
- Reverse Order:
* HEX: 314E
* DEC: 12622
* !HEX: [complement]
* !DEC: [decimal complement]
## Detailed Update History
### Version 0.2.0 - Advanced Editing Capabilities
#### Hexadecimal Editing Enhancements
- Implemented sophisticated in-place hexadecimal editing
- Developed smart cursor positioning algorithm
* Maintains cursor location during edits
* Handles edits at any file location
- Preserved line formatting during byte modifications
- Added real-time hex value validation
#### File Modification Safety
- Introduced file size change warning mechanism
- Implemented confirmation dialog for file size alterations
- Ensured user awareness of potential file structure changes
#### Checksum Refinements
- Enhanced checksum calculation methods
- Supported variable-length byte sequences
- Implemented three distinct checksum types:
* 1-byte Sum Checksum
* 1-byte XOR Checksum
* 16-bit Checksum
- Provided hexadecimal representation of checksums
#### Technical Improvements
- Added comprehensive error logging
- Improved input validation
- Enhanced user interaction during file editing
### Version 0.3.0 - Binary Graph Enhancements
#### Graph Display Improvements
- Implemented custom Tkinter-based graph visualization
- Added support for 8-bit, 16-bit, and 32-bit data display
- Enhanced scrolling mechanism for viewing large datasets
- Dynamic point display control (5-1500 points)
#### Axis Customization
- X-axis:
* Hexadecimal value display
* Special 16-bit mode with doubled values
* Automatic scaling based on visible points
- Y-axis:
* Fixed maximum values based on bit mode (255, 65535, 4294967295)
* Decimal value display
* Proper scaling for all data ranges
#### Interactive Features
- Smooth scrolling with scrollbar and mouse wheel
- Dynamic graph updates when changing bit modes
- Automatic rescaling when changing number of visible points
- Default 512-point display for optimal performance
#### Technical Improvements
- Implemented efficient canvas-based plotting
- Enhanced error handling and logging
- Improved memory management for large datasets
- Better user experience with responsive controls
### Version 0.3.1 - Interactive Graph Hover
#### Enhanced Graph Interaction
- Implemented interactive hover functionality in binary graph
- Added dynamic vertical line tracking mouse position
- Hover label displays:
* X-axis position in hexadecimal
* Y-axis value in decimal and hexadecimal
- Seamless integration with existing 8-bit, 16-bit, and 32-bit modes
- Improved data visualization with real-time coordinate tracking
### Upcoming Features
- Large file performance optimization
- Advanced search functionality
- More configurable display options
- Comprehensive unit testing
## Logging
- Log file: hexawork.log
- Records operations and errors for debugging
- Format: timestamp, module, level, message
## Contributing
Feel free to:
- Report bugs
- Suggest improvements
- Submit pull requests
## License
This project is under the MIT license.

17
list_EDC15.txt Normal file
View File

@ -0,0 +1,17 @@
EDC15C0
EDC15C2
EDC15C3
EDC15C4
EDC15C5
EDC15C6
EDC15C7
EDC15C9
EDC15C11
EDC15C13
EDC15M1
EDC15P+
EDC15P
EDC15P6
EDC15V
EDC15V+
EDC15VM

11
liste type.csv Normal file
View File

@ -0,0 +1,11 @@
ECU Type
EDC15C13
EDC15C2
EDC15C3
EDC15C4
EDC15C5
EDC15C6
EDC15C7
EDC15C9
EDC15P
EDC15V
1 ECU Type
2 EDC15C13
3 EDC15C2
4 EDC15C3
5 EDC15C4
6 EDC15C5
7 EDC15C6
8 EDC15C7
9 EDC15C9
10 EDC15P
11 EDC15V

44
logger.py Normal file
View File

@ -0,0 +1,44 @@
import logging
import os
from datetime import datetime
def setup_logger(name='hexaw_logger', log_dir='logs'):
"""
Set up a logger with file and console output.
:param name: Name of the logger
:param log_dir: Directory to store log files
:return: Configured logger
"""
# Create logs directory if it doesn't exist
os.makedirs(log_dir, exist_ok=True)
# Generate a log filename with timestamp
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
log_file = os.path.join(log_dir, f'{name}_{timestamp}.log')
# Create logger
logger = logging.getLogger(name)
logger.setLevel(logging.DEBUG)
# Create file handler
file_handler = logging.FileHandler(log_file, encoding='utf-8')
file_handler.setLevel(logging.DEBUG)
# Create console handler
console_handler = logging.StreamHandler()
console_handler.setLevel(logging.INFO)
# Create formatter
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
file_handler.setFormatter(formatter)
console_handler.setFormatter(formatter)
# Add handlers to logger
logger.addHandler(file_handler)
logger.addHandler(console_handler)
return logger
# Create a global logger instance
logger = setup_logger()

1179
main.py Normal file

File diff suppressed because it is too large Load Diff