Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save VityaSchel/0d4dcf2ada60c3e1b05bd7ef15f0cfd1 to your computer and use it in GitHub Desktop.
Save VityaSchel/0d4dcf2ada60c3e1b05bd7ef15f0cfd1 to your computer and use it in GitHub Desktop.
How to export your data from Session (Session database decryption)

Important

I'm looking for a job! Interested in hiring me? Visit cv.hloth.dev to review my resume & CV.

How to export data from Session?

  1. Find your Session app data location. On macOS it's usually ~/Library/Application Support/Session, unless you specified --user-data-dir option during launch which will change the app's data directory to whatever you specified.
  2. You need to copy two directories: sql and attachments.noindex — just copy them somewhere on your computer
  1. Now you need to decrypt and re-export data. The sql database itself is encrypted which is why you need to have a decryption key. If you have an app password set (the one you enter when you launch Session), you can just use it for the database. If you haven't set an app password, the decryption key is stored in config.json file — you can open it with TextEdit or anything else, you are looking for the 64-character hex string
  1. Now you're ready to load the database into any SQLite database manager! I recommend using SQLiteBrowser — it's completely free and opensource. sqlite3 cli works too. Whatever you choose, load the database file into the program and input the key IN RAW format!
  • The cipher is most likely sqlcipher 4 unless you're using Session for a very long time.

  • For sqlitebrowser users:

    • if you're using the decryption key from the config.json, make sure you first type "0x" in the corresponding field and that you've selected "raw key" on the right. If you don't type 0x you won't be able to paste the secret key afterwards.

    • If you use your app's password, leave the field on "Password" and just paste it there

  1. Now that you have opened the database you can take a look around using "Browse Data" tab. If you just want to have an encrypted backup of your data, you already have one! just make sure to store the key somewhere safe.
  • But if you don't care about privacy, you can remove encryption from this database copy. In order to do that, go to Tools -> Set Encryption...

  • Do not change anything here. Leave password fields empty which will instruct SQLite browser to disable/remove encryption. Now you can close and open this file without having to remember the database key!

  1. Finally if you're not familiar with sql you might want to export this database to a readable format. You can export your tables to CSV to open in spreadsheet program like Microsoft Excel or you can export it to JSON to automatically process, in case you want to write a script that processes this data. In any case, go to File -> Export -> Export to CSV/JSON
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment