Advertisement
Guest User

Untitled

a guest
Jun 25th, 2016
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. - install python 2.X
  2. - donwload dependencies
  3. https://github.com/kennethreitz/requests
  4. https://github.com/saippuakauppias/temp-mail
  5. https://pypi.python.org/pypi/fake-factory#downloads
  6. - unzip the 3 folders
  7. - run these commands:
  8. python {folder}\kennethreitz-request\setup.py install
  9. python {folder}\temp-mail\setup.py install
  10. python {folder}\fake-factory\setup.py install
  11. - copy the script into a file boy.py
  12. - run python bot.py
  13.  
  14. (THIS IS NOT THE POPE VERSION)
  15.  
  16.  
  17. #!/usr/bin/env python
  18.  
  19. import tempmail
  20.  
  21. import mechanize, time, re
  22.  
  23. import random, string
  24.  
  25. from faker import Factory
  26.  
  27. def doit():
  28. print 'Generating TempMail...'
  29. tm = tempmail.TempMail()
  30. email = tm.get_email_address()
  31.  
  32. url = 'https://petition.parliament.uk/petitions/131215/signatures/new'
  33.  
  34. fake = Factory.create('en_GB')
  35.  
  36. name = fake.name()
  37. postcode = fake.postcode()
  38.  
  39. print 'Signing as %s / %s (%s)' % (name, email, postcode)
  40.  
  41. br = mechanize.Browser()
  42. br.set_handle_robots(False)
  43. br.open(url)
  44. br.form = list(br.forms())[0]
  45.  
  46. c = br.form.find_control(type="checkbox")
  47. c.value = ['1']
  48. br.form['signature[name]'] = name
  49. br.form['signature[email]'] = email
  50. br.form['signature[location_code]'] = ['VA']
  51. br.form['signature[postcode]'] = postcode
  52.  
  53. response = br.submit()
  54. html = response.read()
  55. #with open('temp.html', 'w') as f: f.write(html)
  56.  
  57. badness = [
  58. "Postcode not recognised",
  59. "disposable email address"
  60. ]
  61.  
  62. for x in badness:
  63. if x in html:
  64. print x
  65. print 'Fuck.'
  66. exit()
  67.  
  68. br.form = list(br.forms())[0]
  69. print 'Confirming...'
  70. response = br.submit()
  71. html = response.read()
  72.  
  73. while True:
  74. print 'Checking mail...'
  75. mb = tm.get_mailbox(email)
  76. if not 'error' in mb:
  77. html = mb[0]['mail_html']
  78. url = re.search('<p><a href="(.*?)">', html).group(1)
  79. break
  80. time.sleep(1)
  81.  
  82. print 'Validating %s' % url
  83. response = mechanize.urlopen(url)
  84. html = response.read()
  85. #with open('temp2.html', 'w') as f: f.write(html)
  86. sigs = re.search('<h1 class="visuallyhidden">(.*?) signatures</h1>', html).group(1)
  87. print '%s total signatures' % sigs
  88.  
  89. while True:
  90. doit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement