Advertisement
Guest User

asdfasdlfjasdlfkjasdf

a guest
Jul 8th, 2016
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. #https://github.com/saippuakauppias/temp-mail/blob/master/tempmail.py
  4. import tempmail
  5. import mechanize, time, re
  6. import random, string
  7. import cookielib
  8.  
  9.  
  10. def genname():
  11. length = random.randint(3, 12)
  12. s = ''
  13. while len(s) < length:
  14. s += random.choice(string.lowercase)
  15. return s
  16.  
  17. def sendmail():
  18. print 'Generating TempMail...'
  19. tm = tempmail.TempMail()
  20. email = tm.get_email_address()
  21. url = 'https://petitions.whitehouse.gov/petition/formally-recognize-black-lives-matter-terrorist-organization'
  22.  
  23. name = genname()
  24. name2 = genname()
  25. postcode = 'SW1A 0AA'
  26.  
  27. print 'Signing as %s %s / %s (%s)' % (name, name2, email, postcode)
  28.  
  29. br=mechanize.Browser()
  30.  
  31. br.addheaders=[('User-Agent','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'),('Accept', '*/*'),('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'),('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.3'),('Accept-Encoding', 'none'),('Accept-Language', 'en-US,en;q=0.8'),('Connection', 'keep-alive')]
  32. br.set_handle_robots(False)
  33. br.open(url)
  34. br.form = list(br.forms())[0]
  35.  
  36. c = br.form.find_control(type="checkbox")
  37. c.value = ['1']
  38. br.form['first_name'] = name
  39. br.form['last_name'] = name2
  40. br.form['email'] = email
  41.  
  42. response = br.submit()
  43. html = response.read()
  44. #with open('temp.html', 'w') as f: f.write(html)
  45.  
  46. badness = [
  47. "Postcode not recognised",
  48. "disposable email address"
  49. ]
  50.  
  51. for x in badness:
  52. if x in html:
  53. print x
  54. print 'Fuck.'
  55. exit()
  56.  
  57. br.form = list(br.forms())[0]
  58. print 'Confirming...'
  59. response = br.submit()
  60. html = response.read()
  61.  
  62. while True:
  63. print 'Checking mail...'
  64. mb = tm.get_mailbox(email)
  65. if not 'error' in mb:
  66. html = mb[0]['mail_html']
  67. url = re.search('<p><a href="(.*?)">', html).group(1)
  68. break
  69. time.sleep(1)
  70.  
  71. print 'Validating %s' % url
  72. response = mechanize.urlopen(url)
  73. html = response.read()
  74. #with open('temp2.html', 'w') as f: f.write(html)
  75. sigs = re.search('<h1 class="visuallyhidden">(.*?) signatures</h1>', html).group(1)
  76. print '%s total signatures' % sigs
  77.  
  78. while True:
  79. sendmail()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement