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 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 and what is reasonable usage?

Tuesday, July 23, 2013

Linux mail text as body shows up as attachment: rkhunter cron

Problem:
I have several servers that run different security automations and email me on set intervals via cron. One of those processes is rkhunter which I run via a shell script using the --cronjob argument. Since I had set these up, the reports would come through but they would also show up as an attachment.

Solution:
After playing with the shell script today, I finally found the problem. rkhunter uses cli colors ( as supported ) when displaying output of certain processes. These colors would get sent in the email and automatically handled by gmail to be an attachment (security procedure I'm guessing). By adding the additional argument
--nocolors, I am now able to send the output as plain text.

#!/bin/sh

( /usr/bin/rkhunter --versioncheck --nocolors
/usr/bin/rkhunter --update --nocolors
/usr/bin/rkhunter --cronjob --report-warnings-only --nocolors
) | mail -s "rkhunter report" me@email.com

Thursday, July 11, 2013

Solution - Installed LAMP, PHP works, but website shows a blank page!

Problem:
Recently I've been setting up some servers for web hosting and while install the LAMP stack, ran into a funny issue where the server would return a blank page when I tried to access the PHP website.

Solution:
After checking logs, and playing with settings, I realized I had made a bad assumption. The server hosted PHP version 5.3.3, but the libraries in use required PHP 5.3.7. After installing a newer version of PHP, everything went worked great.