Skip to content

Instantly share code, notes, and snippets.

@Cloudef
Last active December 10, 2015 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cloudef/4458571 to your computer and use it in GitHub Desktop.
Save Cloudef/4458571 to your computer and use it in GitHub Desktop.
# sms through android
# $1 = phone number
# $@ = message
function sms() {
[[ -n "$1" ]] || { echo "no number given"; return; }
local num="$1"; shift 1;
[[ -n "$@" ]] || { echo "no message given"; return; }
ssh -q root@hack-ANDROID "am start -a android.intent.action.VIEW -d sms:$num --es sms_body \"$@\" --ez exit_on_sent true"
}
# call through android
# $1 = phone number
function call() {
ssh -q root@hack-ANDROID "am start -a android.intent.action.CALL tel:$1"
}
# sms db parser
# $@ = file
function _parsesmsdb() {
sqlite3 "$@" '.dump "sms"'| grep "^INSERT" | sed 's/.*VALUES(\(.*\));/\1/' | awk -F"," '{ print "SMS from "$3": "$13 }'
}
# cat sms from android
function catsms() {
ssh -q root@hack-ANDROID "cat /data/data/com.android.providers.telephony/databases/mmssms.db" > /tmp/android-sms.db
_parsesmsdb /tmp/android-sms.db
rm /tmp/android-sms.db &> /dev/null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment