Skip to content

Instantly share code, notes, and snippets.

@BrandonSmith
Created January 30, 2017 19:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BrandonSmith/caa87d3a72b679947221ab161239867d to your computer and use it in GitHub Desktop.
Save BrandonSmith/caa87d3a72b679947221ab161239867d to your computer and use it in GitHub Desktop.
SMS Blaster
#!/bin/bash
if [ $# -lt 5 ]; then
echo -e "./send_sms.sh <device> <to_number> <big|small> <number_of_texts> [sleep_time]"
exit 0
fi
if [ $5 -ge 500 ]; then
while true; do
read -p "Are you sure you want to send >500 texts? y/n`echo $'\n> '`" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit 0;;
* ) echo "Please answer yes or no."
esac
done
fi
i=1
big="Two roads diverged in a yellow wood,And sorry I could not travel both And be one traveler, long I stood And looked down one as far as I couldTo where it bent in the undergrowth Then took the other, as just as fair, And having perhaps the better claim,Because it was grassy and wanted wear Though as for that the passing there Had worn them really about the same, And both that morning equally lay In leaves no step had trodden black. Oh, I kept the first for another day! Yet knowing how way leads on to way, I doubted if I should ever come back."
small="SMS fun!"
tn_number=$3
if [ $# -gt 5 ]; then
sleep_time=$6
else
sleep_time=5
fi
if [ $4 == "big" ]; then
message=$big
else
message=$small
fi
echo "Starting SMS message script.."
echo "Sleep time is: $sleep_time"
while [ $i -le $5 ]
do
adb $1 $2 wait-for-device;
adb $1 $2 shell am start -a android.intent.action.SENDTO -d sms:$tn_number --es sms_body \""Message #$i: $message\"" --ez exit_on_sent true
adb $1 $2 shell input keyevent 22
adb $1 $2 shell input keyevent 66
adb $1 $2 shell input tap 1356.0 2281.0
adb $1 $2 shell input keyevent KEYCODE_BACK
echo "Sending message #$i"
((i++))
sleep $sleep_time
done
echo "Script Execution Complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment