threeplanetssoftware / apple_cloud_notes_parser

Parser for Apple Notes data stored on the Cloud as seen on Apple handsets
MIT License
412 stars 26 forks source link

no such column: ZICCLOUDSYNCINGOBJECT.ZUNAPPLIEDENCRYPTEDRECORD #114

Closed rosshardy closed 1 week ago

rosshardy commented 1 week ago

I'm prying to parse my notes DB from MacOS to back up my notes. I'm on Mac OS 15.1 (Sequoia 15.1) and the v0.18 release of parser after getting the same off of master branch.

Console error output:

Using Docker to run ruby notes_cloud_parser.rb -m /data/apple-notes-dir-11-23-24/ --one-output-folder
/usr/local/bundle/gems/sqlite3-1.6.3/lib/sqlite3/database.rb:152:in `initialize': no such column: ZICCLOUDSYNCINGOBJECT.ZUNAPPLIEDENCRYPTEDRECORD (SQLite3::SQLException)
        from /usr/local/bundle/gems/sqlite3-1.6.3/lib/sqlite3/database.rb:152:in `new'
        from /usr/local/bundle/gems/sqlite3-1.6.3/lib/sqlite3/database.rb:152:in `prepare'
        from /usr/local/bundle/gems/sqlite3-1.6.3/lib/sqlite3/database.rb:198:in `execute'
        from /app/lib/AppleNoteStore.rb:750:in `rip_note'
        from /app/lib/AppleNoteStore.rb:644:in `block in rip_notes'
        from /usr/local/bundle/gems/sqlite3-1.6.3/lib/sqlite3/database.rb:204:in `block (2 levels) in execute'
        from /usr/local/bundle/gems/sqlite3-1.6.3/lib/sqlite3/resultset.rb:134:in `each'
        from /usr/local/bundle/gems/sqlite3-1.6.3/lib/sqlite3/database.rb:203:in `block in execute'
        from /usr/local/bundle/gems/sqlite3-1.6.3/lib/sqlite3/database.rb:156:in `prepare'
        from /usr/local/bundle/gems/sqlite3-1.6.3/lib/sqlite3/database.rb:198:in `execute'
        from /app/lib/AppleNoteStore.rb:643:in `rip_notes'
        from /app/lib/AppleNoteStore.rb:210:in `rip_all_objects'
        from /app/lib/AppleBackup.rb:203:in `block in rip_notes'
        from /app/lib/AppleBackup.rb:200:in `each'
        from /app/lib/AppleBackup.rb:200:in `rip_notes'
        from notes_cloud_ripper.rb:194:in `<main>'

From debug_log.txt:

# Logfile created on 2024-11-23 15:55:29 +0000 by logger.rb/v1.5.3
D, [2024-11-23T15:55:29.389176 #1] DEBUG -- : User asserted this is a MAC_BACKUP
D, [2024-11-23T15:55:29.640075 #1] DEBUG -- : Guessed Notes Version: 16
D, [2024-11-23T15:55:29.640157 #1] DEBUG -- : Backup is valid, ripping notes
D, [2024-11-23T15:55:29.640177 #1] DEBUG -- : Apple Backup: Ripping notes from Note Store version 16
D, [2024-11-23T15:55:29.640512 #1] DEBUG -- : Rip Account: Calling rip_account on Account ID 4416
D, [2024-11-23T15:55:29.640531 #1] DEBUG -- : Rip Account: Using server_record_column of ZSERVERRECORDDATA
D, [2024-11-23T15:55:29.640544 #1] DEBUG -- : Rip Account: Query is SELECT ZICCLOUDSYNCINGOBJECT.ZNAME, ZICCLOUDSYNCINGOBJECT.Z_PK, ZICCLOUDSYNCINGOBJECT.ZSERVERRECORDDATA, ZICCLOUDSYNCINGOBJECT.ZCRYPTOITERATIONCOUNT, ZICCLOUDSYNCINGOBJECT.ZCRYPTOVERIFIER, ZICCLOUDSYNCINGOBJECT.ZCRYPTOSALT, ZICCLOUDSYNCINGOBJECT.ZIDENTIFIER, ZICCLOUDSYNCINGOBJECT.ZSERVERSHAREDATA, ZICCLOUDSYNCINGOBJECT.ZUSERRECORDNAME, ZICCLOUDSYNCINGOBJECT.ZACCOUNTDATA, ZICCLOUDSYNCINGOBJECT.ZACCOUNTNAMEFORACCOUNTLISTSORTING FROM ZICCLOUDSYNCINGOBJECT WHERE ZICCLOUDSYNCINGOBJECT.Z_PK=?
D, [2024-11-23T15:55:29.642338 #1] DEBUG -- : Rip Account: Created account iCloud
D, [2024-11-23T15:55:29.645451 #1] DEBUG -- : Rip Accounts final array: 4416 corresponds to iCloud
D, [2024-11-23T15:55:29.645507 #1] DEBUG -- : Rip Folder: Calling rip_folder on Folder ID 4415
D, [2024-11-23T15:55:29.647287 #1] DEBUG -- : Rip Folder: Created folder Recently Deleted
(bunch of folder creation ommitted)
D, [2024-11-23T15:55:29.694932 #1] DEBUG -- : Rip Folder: Added folder Family -> Wedding 1 as child to Family
D, [2024-11-23T15:55:29.694938 #1] DEBUG -- : Rip Folders final array: 8866 corresponds to Wedding 1
D, [2024-11-23T15:55:29.694955 #1] DEBUG -- : Rip Notes: Ripping notes between 1970-01-01 00:00:00 +0000 and 2024-11-23 15:55:29 +0000
D, [2024-11-23T15:55:29.695015 #1] DEBUG -- : Rip Note: Ripping note from Note ID 4477

I opened the SQLite DB in DB Browser. Looking at the ZICCLOUDSYNCINGOBJECT table, I do in fact not see the referenced column from the query, however there is one called ZUNAPPLIEDENCRYPTEDRECORDDATA.

threeplanetssoftware commented 1 week ago

Thanks for reporting this! The issue must be related to version detection, because the script is identifying it as version 16, whereas that column was added in 18. I've changed the column I was hooking on in case that was one that may have been removed. I now look for ZUNAPPLIEDENCRYPTEDRECORDDATA.

Can you pull the latest version from master and see if it works for you?

rosshardy commented 1 week ago

Ah so actually I neglected to mention a key point: I'm using Docker. I deleted the local image and re-ran. Docker pulled latest version of the container, parser proceeded to work. Apologies.

threeplanetssoftware commented 1 week ago

Ah, that will do it! Glad it is working for you now.