Discord/Mattermost/Slack end-to-end encryption in different variations (Mostly proof of concept, you have been warned)

patch_mattermost_linux_client.sh 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/sh
  2. # This script patches a Mattermost desktop client (tested on ubuntu 16.04, default install)
  3. # The process is pretty simple and it can be run repeatedly as it backups the original files,
  4. # always downloads the newest version, restores vanilla state and then applies the patch.
  5. # It will need sudo twice, first for creating app backup, second for copying the app
  6. # back into the correct directory. If you want to manage this yourself,
  7. # it might be a good idea to remove the rm -rf at the end ;) (to actually have an app)
  8. # workdir
  9. mkdir -p /tmp/mm-aes/app
  10. cd /tmp/mm-aes
  11. # download newest plugin version
  12. wget -q "https://git.estate/scitor/webchat-end2end/raw/branch/master/dist/mm-aes.min.js"
  13. # install (un)packer
  14. npm install asar
  15. # extract mattermost app
  16. ASAR="node node_modules/asar/bin/asar.js"
  17. $ASAR extract /opt/Mattermost/resources/app.asar app
  18. # SUDO backup original app
  19. if [ ! -f /opt/Mattermost/resources/app.asar.orig ]; then
  20. sudo mv /opt/Mattermost/resources/app.asar /opt/Mattermost/resources/app.asar.orig
  21. fi
  22. # make or use backup of main js
  23. if [ -f app/browser/webview/mattermost_bundle.js.orig ]; then
  24. cp app/browser/webview/mattermost_bundle.js.orig app/browser/webview/mattermost_bundle.js
  25. else
  26. cp app/browser/webview/mattermost_bundle.js app/browser/webview/mattermost_bundle.js.orig
  27. fi
  28. # add script to main js
  29. cat mm-aes.min.js >> app/browser/webview/mattermost_bundle.js
  30. # pack it back together
  31. $ASAR pack app app.asar
  32. # SUDO move app to its place
  33. sudo mv app.asar /opt/Mattermost/resources/app.asar
  34. # clean up
  35. cd /tmp
  36. rm -rf /tmp/mm-aes