/ColorNote-backup-decryptor

Decrypt a ColorNote backup file to export your notes (https://www.colornote.com)

Primary LanguageJavaMIT LicenseMIT

ColorNote backup decryptor

ColorNote doesn’t support any kind of export (!?) and the backup format is both proprietary and encrypted using an undocumented method.

NB: If you have the app installed or have access to an android phone the alternative methods listed at the end might be simpler.

I’ve included a prebuild jar for convenience.

There is at least two versions of the backup format. I haven’t invested in figuring out a detection mechanism so trial and error is the game :)

Usage

java -jar colornote-decrypt.jar PASSWORD OFFSET < INPUT_FILE > OUTPUT_FILE

If you use oracle’s JRE (likely the case if you’re on windows) you’ll need to run the class file directly instead (send your thanks to the US for their silly encryption export restrictions… and to java for making it unbelivable hard to make a properly bundled program):

Unix:

java -cp lib/bcprov-jdk15on-154.jar:lib/bcpkix-jdk15on-154.jar:bin ColorNoteBackupDecrypt PASSWORD OFFSET < INPUT_FILE > OUTPUT_FILE

Windows: (note the different class path separators : -> ;

java -cp lib/bcprov-jdk15on-154.jar;lib/bcpkix-jdk15on-154.jar;bin ColorNoteBackupDecrypt PASSWORD OFFSET < INPUT_FILE > OUTPUT_FILE

Note: the cleanup scripts are written for linux, but this user ran them successfully using cygwin [#9].

The script reads from standard input and writes to standard output.

The decrypted output is json with some weird prefix and note separators (probably encoding the length of the file and individual notes). A small script attempts to clean the json.

Try both versions below. The following error message indicates that the input file uses another format version:

Exception in thread "main" java.io.IOException: javax.crypto.IllegalBlockSizeException: last block incomplete in decryption

Note: the file-extension of the backup files is sometimes .dat and sometimes .doc (might indicate the version?)

V1:

# 0000 is the default password
java -jar colornote-decrypt.jar 0000 < the-backup-file.doc | fixup-v1 > notes.json

V2:

# 0000 is the default password and 28 is a magic offset
java -jar colornote-decrypt.jar 0000 28 < the-backup-file.doc | fixup-v2 > notes.json

If the json still contains garbage, try tailing the n last lines (one note takes one line): tail -n 100 notes.json (Source)

Each fixup script is only based on a single backup file so they could be incomplete. Let me know if you have problems.

When you have the json file the next step is up to you.

Use format-notes to get a quick view of the notes or the following to get a csv format:

jq --raw-output '[.created_date, .modified_date, .title, .note] | @csv' < notes.json > notes.cvs

Alternative methods

Rooted phone

If you have root access you can get hold of the sqlite db directly: http://danyilbohdan.com/blog/colornote/

I haven’t tried it myself, but someone suggested that you could restore the backup in an emulator if you don’t have a rooted phone.

Using android’s built-in backup system to access the app-private data

Restore your encrypted backup onto a color note installation and do a full app backup using adb: (tested on v4.0.6)

adb backup -noapk com.socialnmobile.dictapps.notepad.color.note

Unpack the resulting backup.ab and you’ll have access to the colornote.db sqlite database.

(Source)