Sms For Two
Sms For Two
/usr/bin/python
import cookielib
import urllib2
from getpass import getpass
import sys
url = 'http://www.mycantos.com/'
#Credentials taken here
#username = raw_input("Enter USERNAME: ")
username = "ENTER UR USERNAME"
#passwd = getpass()
passwd = "PASS PLS"
number = "FIRST FRNDS NUMBER"
number1 = "SECOND FRNDS NUMMNBER"
flg = 5
while (flg > 1):
message = raw_input("Enter your message: ")
if message == '011': break
data = 'username='+username+'&password='+passwd+'&checklogin=1'
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
try:
usock = opener.open(url, data)
except IOError:
print "Error fetching page www.mycantos.com\nExiting now.."
sys.exit()
print "Logged into the page....."
send_page = opener.open('http://www.mycantos.com/sendSMS.php')
print "Now, Into the SendSMS page..."
#Headers added to avoid the Missing data, try again!! error
opener.addheaders = [('Referer','http://www.mycantos.com/sendSMS.php'),('User-A
gent','Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.3) Gecko/20091020 Ubun
tu/9.10 (karmic) Firefox/3.5.3 GTB7.0')]
data_to_send = 'checkSMS=1&SMSnumber='+number+'&SMSmessage='+message
url_send = "http://www.mycantos.com/sendSMStoanyone.php"
#SMS send POST
try:
send = opener.open(url_send,data_to_send)
# f = open("log.html","w")
#f.write(send.read)
#f.close()
except IOError:
print "Error sending SMS\nExiting now.."
# sys.exit()
print "SMS SENT!!!"
#
print "---------------------------------------------"
data = 'username='+username+'&password='+passwd+'&checklogin=1'
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
try:
usock = opener.open(url, data)
except IOError:
print "Error fetching page www.mycantos.com\nExiting now.."
sys.exit()
print "Logged into the page.....2"
send_page = opener.open('http://www.mycantos.com/sendSMS.php')
print "Now, Into the SendSMS page...2"
#Headers added to avoid the Missing data, try again!! error
opener.addheaders = [('Referer','http://www.mycantos.com/sendSMS.php'),('User-A
gent','Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.3) Gecko/20091020 Ubun
tu/10.10 (karmic) Firefox/3.5.3 GTB7.0')]
data_to_send = 'checkSMS=1&SMSnumber='+number1+'&SMSmessage='+message
url_send = "http://www.mycantos.com/sendSMStoanyone.php"
#SMS send POST
try:
send = opener.open(url_send,data_to_send)
# f = open("log.html","w")
#f.write(send.read)
#f.close()
except IOError:
print "Error sending SMS\nExiting now.."
sys.exit()
print "SMS 2 SENT!!!"
print "########################################################################
#################"
#flg = raw_input("wanna continue :")
print "bye"