Skip to content

Instantly share code, notes, and snippets.

@theevilbit
Created August 27, 2024 09:42
Show Gist options
  • Save theevilbit/985d4f1f21737c68e4c123817c3aabe8 to your computer and use it in GitHub Desktop.
Save theevilbit/985d4f1f21737c68e4c123817c3aabe8 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Check if the database path is provided as an argument
if [ -z "$1" ]; then
echo "Usage: $0 /path/to/your/database.sqlite"
exit 1
fi
# Use the first argument as the database file path
DB_PATH="$1"
# Query to select the data column as hex from the record table
SQL_QUERY="SELECT hex(data) FROM record;"
# Execute the query and process each row
sqlite3 "$DB_PATH" "$SQL_QUERY" | while read -r HEXDATA; do
# Convert hex to binary and then to plist format
echo "$HEXDATA" | xxd -r -p - | plutil -p -
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment