Free worldwide SMS sending script


SUBMITTED BY: Guest

DATE: Oct. 11, 2012, 6:31 a.m.

FORMAT: Python

SIZE: 2.0 kB

HITS: 2301

  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # Free worldwide SMS sending script using Solinked API.
  4. import sys
  5. import requests
  6. forge_user_agent = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5'
  7. script_url = 'http://solinked.com/solinked/sendsms.php'
  8. forge_headers = {
  9. 'Origin' : 'http://solinked.com',
  10. 'Connection' : 'keep-alive',
  11. 'User-Agent' : forge_user_agent,
  12. 'Content-Type' : 'application/x-www-form-urlencoded',
  13. 'Referer' : 'http://solinked.com/',
  14. }
  15. def sendsms(destphone, smsbody):
  16. resp = requests.get('http://solinked.com/')
  17. forge_headers['Cookie'] = resp.headers['Cookie']
  18. html = resp.text
  19. numberfield_key_pattern = r"' id='no' class='no'"
  20. checkfield1_key_pattern = r"' id='on' class='n0'"
  21. checkfield2_key_pattern = r'" class="formsend"'
  22. numberfield_end_pos = html.find(numberfield_key_pattern)
  23. checkfield1_end_pos = html.find(checkfield1_key_pattern)
  24. checkfield2_end_pos = html.find(checkfield2_key_pattern) - 41
  25. checkfield2_val_end_pos = html.find(checkfield2_key_pattern)
  26. numberfield = html[numberfield_end_pos-32:numberfield_end_pos]
  27. checkfield1 = html[checkfield1_end_pos-32:checkfield1_end_pos]
  28. checkfield2 = html[checkfield2_end_pos-32:checkfield2_end_pos]
  29. checkfield2_val = html[checkfield2_val_end_pos-32:checkfield2_val_end_pos]
  30. reqfields = {numberfield : destphone, checkfield1 : '', checkfield2 : checkfield2_val, 'mymessage' : smsbody}
  31. print repr(reqfields)
  32. resp = requests.post(script_url, reqfields , headers=forge_headers)
  33. if __name__ == "__main__":
  34. if len(sys.argv) < 3:
  35. print "Usage: solinked [num in international format with 00 instead of +] [message]"
  36. else:
  37. sendsms(sys.argv[1], sys.argv[2])
  38. print "Message sent"

comments powered by Disqus