Created
April 29, 2025 12:42
-
-
Save VityaSchel/0d4dcf2ada60c3e1b05bd7ef15f0cfd1 to your computer and use it in GitHub Desktop.
Revisions
-
VityaSchel created this gist
Apr 29, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ > [!IMPORTANT] > I'm looking for a job! Interested in hiring me? Visit [cv.hloth.dev](https://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 - <img src="https://gist.github.com/user-attachments/assets/bb65ca12-9acb-4d68-9c77-d35cc66c6b90" width="300" /> 3. 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 - <img src="https://gist.github.com/user-attachments/assets/f6a382d4-fef9-4446-acdf-4e6bec822541" width="300" /> 4. Now you're ready to load the database into any SQLite database manager! I recommend using [SQLiteBrowser](https://sqlitebrowser.org/dl/) — 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! - <img src="https://gist.github.com/user-attachments/assets/a1e62405-1adc-4b4a-b308-cb4fa27bd53f" width="500" /> <img src="https://gist.github.com/user-attachments/assets/a9477a16-b426-432b-923a-ebd2c9468a9c" width="300" /> - 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. - <img src="https://gist.github.com/user-attachments/assets/674a7158-ea39-49be-9997-9ecc3ec7977e" width="300" /> - If you use **your app's password**, leave the field on "Password" and just paste it there 5. 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. - <img src="https://gist.github.com/user-attachments/assets/d2fe78d3-7665-44d2-b725-83be8c328a33" width="300" /> - 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... - <img src="https://gist.github.com/user-attachments/assets/acec6079-2aca-468e-b0bc-02403b2a3edd" width="300" /> - 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! 6. 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 - <img src="https://gist.github.com/user-attachments/assets/1346f281-3911-44ab-a267-d37cc53290e2" width="700" />