Created
September 2, 2018 14:12
-
-
Save pgaskin/0eea7f7236f61735198cb40e62f2eeb6 to your computer and use it in GitHub Desktop.
Backs up all SMS messages using Termux.
This file contains 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 characters
#!/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" |
Try running termux-sms-list
by itself first.
I tried 😥
"error": "Reading SMS is no longer permitted by Google".
Now I have to find another way to push sms to python. Thank you for your response. 😄
That's unfortunate. I'll guess I'll have to extract them manually for myself (I have a rooted device).
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
Greetings
As I have attempted backup the sms over termux, I ge the following error when running at the $HOME:
error (at :3): Cannot index string with string "threadid"