Category Archives: Uncategorized

Exporting text messages on Sailfish

I had to export text messages (SMS) from a Jolla phone running Sailfish (not sure the version is relevant, SailfishOS 1.1.6.27 (Aaslakkajärvi) (armv7hl)).

Here is the best solution I found, using a groovy script (the bash scripts all had issues).

All scripts tested came from this question on together.jolla.com.

Here are the steps:

  • activate dev mode on the Jolla phone (I’ll let you follow guides for this)
    • you’ll be asked to create a user, it’s actually not the user you’ll use to connect over SSH, it seems to be a local user. For simplicity and consistency’s sake, I suggest you name it nemo.
  • create a working directory on your computer and enter it:
    • mkdir -P ~/Jolla/workdir & cd ~/Jolla/workdir/
  • extract the communications database, over SSH
    • scp nemo@192.168.0.xxx:/home/nemo/Documents/sms_export_multiline.xml ~/Jolla/workdir/
      The username is nemo (no matter what you picked in the previous step), the password is whatever you picked in the previous step.
  • Install groovy on your computer:
    • dnf install groovy or apt install groovy
  • create the script, using your favourite text editor. We’ll use gedit here, for simplicity:
    • gedit ~/Jolla/workdir/sms-export-groovy
      and paste the following:

      #!/usr/bin/env groovy@GrabConfig(systemClassLoader=true)
      @Grab('org.xerial:sqlite-jdbc:3.8.11.2')
      import groovy.sql.Sqlimport groovy.xml.MarkupBuilderif (args.size() != 1) {
      println "Usage: dump.groovy "
      return
      }
      def (dbFile) = args

      def sql = Sql.newInstance(“jdbc:sqlite:$dbFile”)
      def messages = sql.rows(‘SELECT remoteUid, direction, startTime, isRead, freeText FROM Events WHERE type = 2’)

      System.out.withWriter(‘UTF-8’) {w ->
      def xml = new MarkupBuilder(w)

      xml.mkp.xmlDeclaration(version: ‘1.0’, encoding: ‘UTF-8’)
      xml.mkp.yieldUnescaped(“\n”)
      xml.smses(count: messages.size()) {
      messages.each {
      sms(
      protocol: 0,
      address: it.remoteUid,
      date: “${it.startTime}000”,
      type: it.direction,
      subject: ‘null’,
      body: it.freeText,
      toa: ‘null’,
      sc_toa: ‘null’,
      service_center: ‘null’,
      read: it.isRead,
      status: -1,
      locked: 0,
      )
      }
      }
      }

      (Thanks Sami Bourkott for the script)

    • make the script executable:
      • chmod +x ~/Jolla/workdir/sms-export-groovy
    • run the script on the SMS database and tell the shell to output the results in a given file, which we’ll call sms_export_$DATE.xml:
      • ./sms_export_multiline.groovy commhistory.db > sms_export-`date -I`.xml

That’s it, you now have an xml file with all your text messages, in a format compatible with Android’s SMS Backup & Restore.

If you want to restore the text messages, you’d want to send the commhistory.db file back to the phone. I suggest you copy the commhistory.db file to include the date, so you can have several in parallel and still have a clue which one contains what: cp -a commhistory.db commhistory.db.`date -I`

How email is still failing, a good read on security

Why are we still blindly (for most of us, to say the least) trusting a messaging protocol that lacks so many basic security protections?

The fact is that if someone owns our email account, they own us. To make things worse, so many of us hand the keys to our lives over to the custody of third parties such as Google, Microsoft, and Yahoo!

I think Mark Burnett is spot on.

http://xato.net/cryptography/email-security-industrys-biggest-failure/