Friday, December 15, 2006

Suntel wOw ( Lanka ) sms script

an alternative way to sms through www.wow.lk, If you ever used that website to sms, you will know why I made this script.

Your_User_Name = your login and Your_Password = password





#!/bin/bash

function buildrcpnts
{
if [ ! -f wowcontacts ]
then
return 0
fi
varstring=""
numbers=(`cat wowcontacts|grep -A40 -E ' name="Submit"'|grep -oE 'name=[0-9]{4,}'|cut -d\= -f2`)
names=(`cat wowcontacts|grep -A40 -E ' name="Submit"'|grep -oE '<td>[a-zA-Z]+</td>'|grep -oE '[a-zA-Z]{3,}'`)

i=0
while (( $i<${#numbers[*]} ))
do
varstring="$varstring ${numbers[$i]} ${names[$i]}"
(( i+=1 ))
done
echo "$varstring"
dialog --menu "Select Recepient" 20 20 15 $varstring 2> /tmp/wowrcpnts
}

buildrcpnts

dialog --title "WoW Message" --ok-label "Send" --max-input 160 --inputbox "Enter Message" 10 60 2> /tmp/wowmsg
retval=$?
case "$retval" in

0)
echo "Sending..."
varmsg=`cat /tmp/wowmsg`
wget --save-cookies=cookie --keep-session-cookies --post-data="Username=Your_User_Name&Password=Your_Password&amp;amp;amp;Action=login" http://sms.wow.lk/user/login.php
wget --load-cookies=cookie --keep-session-cookies http://sms.wow.lk/user/sendmessages.php
if [ ! -f wowcontacts ]
then
cp sendmessages.php wowcontacts
buildrcpnts
fi
varwowrcpnts=`cat /tmp/wowrcpnts`
wget --load-cookies=cookie --keep-session-cookies --post-data="message=${varmsg}&action=send&${varwowrcpnts}=${varwowrcpnts}" http://sms.wow.lk/user/sendmessages.php

varrest=`cat sendmessages.php | grep -oE '([0-9]/5)'`
dialog --title "Information" --infobox "Messages Remaining and Sent ${varrest}" 10 20

cat sendmessages.php > wowcontacts
rm main.php*
rm sendmessages.php*
;;

1)
clear
echo "Cancelled"
exit 1;;
255)
clear
echo "Cancelled"
exit 1;;

esac








1 comment:

chanux said...

Nice Work Dude. Not that I'm gonna use wow thing but, this is really good work. :D . keep it p.