How 0xcgz/exifxtract works
ExifXtract is a terminal-native, single-node Python CLI tool for image forensics + metadata intelligence. It runs locally, reads image files, extracts/normalizes EXIF (including GPS), optionally calls reverse-geocoding, generates hashes, performs a simple steganography “anomaly” heuristic, can strip metadata, and exports TXT/JSON reports plus appends to a session log.
From the file tree + README, this is not a distributed system; the “architecture” is primarily a local runtime pipeline with optional external API calls.
Key evidence from repo:
• ExifXtract.py = the whole application entrypoint and (likely) all logic.
• requirements.txt includes Pillow, rich, optional geopy.
• assets/ contains demo/branding artifacts (not runtime-critical unless referenced by UI).
• Mentions PyInstaller-built .exe in README (packaging/distribution concern).
Entry & Control Plane
• CLI Argument Parser (headless mode)
Handles: --path, --dir, --strip, --preview, --version.
• Interactive TUI Menu (default)
Main menu routing: Deep Analysis / Bulk Scan / Metadata Remover / Thumbnail Preview.
Core Forensic Pipeline (Data Plane)
• File Enumerator
• Single file selection OR directory traversal (bulk scan).
• Filters by supported formats: JPG/PNG/TIFF/WEBP.
• Image Loader / Decoder (Pillow)
• Opens image, reads dimensions, maybe extracts embedded thumbnail.
• Metadata Extractor (EXIF/IFD/Sub-IFD/GPS-IFD)
• Parses camera tags, timestamps, software fields, GPS fields.
• GPS Normalizer
• Converts raw EXIF GPS to decimal lat/lon.
• Builds Google Maps URL.
• Reverse Geocoder (Optional: geopy)
• External call to geocoding provider (often Nominatim/OSM via geopy).
• Produces human-readable address.
• Hashing Engine
• MD5, SHA1, SHA256 over the file bytes.
• Stego “Anomaly” Detector (Heuristic)
• Compares file size vs resolution to flag suspiciously large payloads.
• Metadata Sanitizer / Stripper
• Outputs a “clean” copy without EXIF metadata.
Output & Audit
• Report Generator
• Writes timestamped .txt and .json.
• Consolidates results for bulk mode.
• Console Renderer (rich)
• Session Logger
• Appends operations to exifxtract.log.
Packaging / Distribution (non-runtime, but important context)
• PyInstaller Build Artifact (mentioned)
• Not in the tree, but README implies a packaged .exe.
If GPS exists: GPS Normalizer → lat/lon + maps link
7. If reverse geocoding enabled: Reverse Geocoder → External Geocoding Service → address
Bulk scan
• “File Enumerator” loops over N files and feeds the same pipeline; “Report Generator” consolidates.
Architectural patterns & principles to highlight
Even in a small tool, call out the real patterns:
• Pipeline / staged processing: enumerate → load → extract → enrich → report.
• Strategy-like optional enrichment: reverse geocoding is a feature flag / optional dependency.
• Separation of concerns (logical, even if not physically separated): UI vs core analysis vs output.
• Deterministic artifacts: reports + hashes used for integrity and reproducibility.
• Side-effect boundaries: filesystem writes (reports, stripped image, logs) and network calls (geocoding).
“Don’t overthink it”: maximize component separation (even within one file)
• where to refactor (future modularization),
• what can fail (I/O vs decode vs network),
• what’s optional vs required,
• and where evidence/logging is produced for forensics.