Skip to content

Instantly share code, notes, and snippets.

@pgaskin
Created September 2, 2018 14:12
Show Gist options
  • Save pgaskin/0eea7f7236f61735198cb40e62f2eeb6 to your computer and use it in GitHub Desktop.
Save pgaskin/0eea7f7236f61735198cb40e62f2eeb6 to your computer and use it in GitHub Desktop.
Backs up all SMS messages using Termux.
#!/bin/bash
echo "Termux SMS Backup"
echo "Copyright 2018 Patrick Gaskin"
hash termux-sms-list ||
pkg install termux-api &&
hash jq ||
pkg install jq &&
termux-setup-storage &&
termux-sms-list -l 999999 -t all |
jq 'group_by(.threadid) |
map({
"threadid": .[0].threadid,
"number": .[0].number,
"date": .[0].received,
"all_read": all(.read),
"num_messages": length,
"messages": map({
"type": .type,
"read": .read,
"received": .received,
"body": .body
})
}) |
sort_by(.threadid)
' |
tee /sdcard/sms.json |
jq . &&
echo "Saved messages to sms.json in Internal Storage"
@abdulazizalmass
Copy link

abdulazizalmass commented May 13, 2020

I have a huawei that is not rootable and for it to be rooted I need a code that is received from huawei just to unlock the bootloader.

Huawei backup can save the sms db file but it is locked by a password and I don't know the encryption type to decrypt the DB. What a journey 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment