logician

[Python 3.3/Android Debug Bridge] SMS spam script

Jul 16th, 2013
755
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.42 KB | None | 0 0
  1. import telnetlib
  2. from time import sleep
  3.  
  4. # Host and port number for emulator
  5. # Emulators only listen on localhost
  6. # PORT can be found in the window title bar
  7. # for the emulator you want to spam, default is 5554.
  8. HOST = "localhost"
  9. PORT = 5554
  10.  
  11. # Phone number criteria
  12. COUNTRY_CODE = 1
  13. AREA_CODE = 123
  14. PREFIX = 555
  15.  
  16. LEADING = str(COUNTRY_CODE) + str(AREA_CODE) + str(PREFIX)
  17. SUFFIX_START = 1111
  18.  
  19. # SUFFIX, initalized as SUFFIX_START, will be incremented for each COUNT
  20. # and concatenated with LEADING to form a phone number.
  21.  
  22. '''
  23. For example:
  24.    11235551111
  25.    11235551112
  26.    11235551113
  27.  
  28. '''
  29.  
  30. # MESSAGES will be looped through, sending each COUNT times
  31. MESSAGES = ["Subscribe", "Unsubscribe"]
  32. COUNT = 30
  33.  
  34. # Number of seconds to wait between messages
  35. # Floating point values are allowed; e.g. 0.5 = 500 ms
  36. DELAY = 1
  37.  
  38. def send_sms(number, message):
  39.     tn.write(bytes("sms send {} {}\n".format(number, message), "ascii"))
  40.  
  41. def loop_send(message):  
  42.    
  43.     for i in range(COUNT):
  44.  
  45.         suffix = SUFFIX_START + i
  46.        
  47.         number = LEADING + str(suffix)
  48.        
  49.         print("Sending message \"{}\" to {}".format(message, number))
  50.  
  51.         send_sms(number, message)
  52.  
  53.         sleep(DELAY)
  54.        
  55.  
  56. print("Initiating connection...")
  57.  
  58. tn = telnetlib.Telnet(HOST, PORT)
  59.  
  60. tn.read_until(b"OK")
  61.  
  62. print("Connection established.")
  63.  
  64. for message in MESSAGES:
  65.     loop_send(tn, message)
Advertisement
Add Comment
Please, Sign In to add comment