#!/usr/bin/env bash
FIRMWARE="$1"
[[ -z "$FIRMWARE" ]] && echo "Usage: $0 <firmware.bin>" && exit 1

echo "=== ESP32 Firmware Analysis ==="
echo "File: $FIRMWARE"
echo ""
echo "[1] File Info:"; file "$FIRMWARE"
echo ""; echo "[2] Strings:"; strings "$FIRMWARE" | head -50
echo ""; echo "[3] Binwalk:"; binwalk "$FIRMWARE"
echo ""; echo "[4] ESP32 Image Info:"; esptool.py image_info "$FIRMWARE" 2>/dev/null || echo "Not ESP32 image"
