Tuesday, July 30, 2013

Automated SMS Messaging From Windows Command Line

Problem:
I saw a contest that requested that people text or call in as many times as they can within a short period of time. As the contest rules didn't state anything about automation, I decided to write a script to do my bidding.

Solution:
The final script was simple enough. By connecting my phone in debug mode to the computer, running android service, and using the following batch script, I was able to begin my bombardment in hopes of winning the contest. This simple code uses an infinite loop and within that calls instructions telling the phone to create a text message, then sends the commands to send the text message by simulating key presses, and then generates a random amount of time between 1 and 30 seconds before doing repeating the process (as an attempt to be at least somewhat reasonable and not fill up my carriers pipes).

:loop
adb shell am start -a android.intent.action.SENDTO -d sms:"+15015551234" --es sms_body "I want to win" --ez exit_on_sent true
adb shell input keyevent 22
adb shell input keyevent 66
SET /A die=30*%random%/32768+1
timeout %die%
goto loop

Now cross my fingers, that my carrier wont care too much... is unlimited texting really unlimited or is that within reasonable usage... btw, what is reasonable usage?

No comments: