Skip to content

Instantly share code, notes, and snippets.

@ewalk153
Created May 30, 2024 23:07
Show Gist options
  • Save ewalk153/80d0a4a2cc4f96d487dee84142362452 to your computer and use it in GitHub Desktop.
Save ewalk153/80d0a4a2cc4f96d487dee84142362452 to your computer and use it in GitHub Desktop.
Small script to extract apple notes files from the source sqlite3 file. Files extracted to their compressed files. Output is a protobuf doc. For simple notes the text is typically usable.
import sqlite3
import zipfile
con = sqlite3.connect("NoteStore.sqlite")
res = con.execute("select Z_PK, ZDATA from ZICNOTEDATA")
for row in res.fetchall():
print(f"ID: {row[0]}")
# this is a protobuf doc but the text is usually readable
temp_file_name = f"doc{row[0]}.txt.zip"
f = open(temp_file_name, "wb")
f.write(row[1])
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment