Skip to content

Instantly share code, notes, and snippets.

@iKlsR
Last active August 29, 2015 14:09
Show Gist options
  • Save iKlsR/06fc9030816923ce5f99 to your computer and use it in GitHub Desktop.
Save iKlsR/06fc9030816923ce5f99 to your computer and use it in GitHub Desktop.
Use your 30 free digicel texts from the comfort of your term
import mechanize, sys
class DigiWebTextDT(object):
def __init__(self):
self.br = mechanize.Browser()
# might want to change the locale for your region
self.br.open("https://webtext.digicelgroup.com/loginForm.do?country_code=JAM&language_code=en")
def get_credentials(self):
pass
def login(self, number, passw):
self.login_number = number
self.login_passw = passw
self.br.select_form(name="loginForm")
self.br.form["msisdn"] = self.login_number
self.br.form["password"] = self.login_passw
response = self.br.submit()
stripped_m = response.read().strip()
if stripped_m == "Invalid Phone Number/Password":
print "There was an error logging in, check credentials."
sys.exit(0x00)
print "Successfully logged in.\n"
def send_message(self, number, message):
self.br.select_form(name="smsform")
self.br.form["msisdn"] = number
self.br.form["sms"] = message
response = self.br.submit()
print "Recipient: " + number
print "Message: " + message
print "\nSession lost."
if __name__ == '__main__':
dwt = DigiWebTextDT()
# dwt.get_credentials()
# enter credentials here, username, pass, ie: '18769876543', 'password1'
# to use run python webtext_automated.py recipient message, ie: webtextautomated 18761234567 "test"
# intentionally doesn't create a persistent session
dwt.login("", "")
dwt.send_message(sys.argv[0x01], sys.argv[0x02])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment