A modern Python tool for decoding NSKeyedArchiver plist files with beautiful colored output and multiple display formats.
- 🎨 Colored output with rich syntax highlighting
- 🌳 Tree view for hierarchical data visualization
- 📄 JSON output with syntax highlighting
- 🚀 Modern CLI with comprehensive argument parsing
- 🔧 Flexible formatting options
- 📦 Easy installation with pip
- 🔄 Dual format support - handles both NSKeyedArchiver and standard plist files
- 🛡️ Robust error handling with fallback options
- 🔄 Improved NSKeyedUnarchiver - built-in implementation with recursion protection
- 🕵️ Cycle detection - prevents infinite loops from circular references
- 🎛️ Debug mode - detailed logging and error diagnostics
- ⚡ Configurable limits - adjustable recursion depth and safety controls
- Install the required dependencies:
pip install -r requirements.txtOr install individually:
pip install NSKeyedUnArchiver richNote: This tool includes an improved NSKeyedUnarchiver implementation that handles complex files with circular references and deep nesting. It falls back to the external investorzilla module if needed, but the built-in version is recommended for better reliability.
- Make the script executable (optional):
chmod +x main.pyDecode a plist file and display it as a colored tree:
python main.py file.plistDisplay as JSON with syntax highlighting:
python main.py file.plist --format jsonDisplay as tree structure (default):
python main.py file.plist --format tree--format, -f: Choose output format (treeorjson)--no-color: Disable colored output--indent: Set JSON indentation level (default: 2)--debug: Enable debug output and verbose error messages--max-depth: Set maximum recursion depth for NSKeyedArchiver (default: 2000)
# Basic tree view with colors
python main.py data.plist
# JSON output with custom indentation
python main.py data.plist --format json --indent 4
# Plain output without colors
python main.py data.plist --no-color
# Works with both NSKeyedArchiver and standard plist files
python main.py regular_plist.plist
python main.py nskeyed_archive.plist
# Enable debug mode for troubleshooting
python main.py complex_file.plist --debug
# Increase recursion limit for very deep structures
python main.py deep_nested.plist --max-depth 5000
# Get help
python main.py --help📄 data.plist
├── 🔹 $version (dict)
│ ├── $archiver: "NSKeyedArchiver"
│ ├── $objects: (list, 15 items)
│ └── $top: (dict)
└── 🔹 rootObject (dict)
├── name: "Example"
├── count: 42
└── enabled: True
{
"$version": {
"$archiver": "NSKeyedArchiver",
"$objects": [...],
"$top": {...}
},
"rootObject": {
"name": "Example",
"count": 42,
"enabled": true
}
}The tool provides clear error messages for common issues:
- Missing files
- Invalid plist format
- Decoding errors
- Missing dependencies
- Smart fallback: If NSKeyedArchiver decoding fails, automatically tries standard plist format
- Recursion protection: Prevents infinite loops from circular references
- Cycle detection: Identifies and handles circular object references gracefully
- Debug mode: Provides detailed error diagnostics and stack traces
- NSKeyedArchiver files - Primary target format with improved handling
- Complex nested structures
- Circular references and cycles
- Deep object hierarchies
- Core Data model files (.mom)
- Standard plist files - Automatic fallback support
- Both binary and XML plist formats are supported
- Python 3.7+
- NSKeyedUnArchiver library (installs as
investorzillamodule) - Rich library for colored output
- Ensure NSKeyedUnArchiver is properly installed:
pip install NSKeyedUnArchiver - The package installs as
investorzillabut this is handled automatically - For standard plist files, the tool will automatically fall back to built-in plist support
- Use the built-in improved NSKeyedUnarchiver (automatically used when available)
- Increase recursion limit with
--max-depthif needed - Enable debug mode with
--debugto see detailed error information - Look for circular reference indicators in the output
- Enable debug mode:
--debug - Increase recursion limit:
--max-depth 3000 - Check for circular references in the tree output
- Use JSON format for easier analysis of structure
- Large files may take time to process due to safety checks
- Debug mode adds overhead but provides valuable diagnostics
- Circular reference detection prevents infinite loops but adds processing time
Feel free to submit issues and enhancement requests!
This project is open source. Feel free to use and modify as needed.