Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- #https://github.com/saippuakauppias/temp-mail/blob/master/tempmail.py
- import tempmail
- import mechanize, time, re
- import random, string
- import cookielib
- def genname():
- length = random.randint(3, 12)
- s = ''
- while len(s) < length:
- s += random.choice(string.lowercase)
- return s
- def sendmail():
- print 'Generating TempMail...'
- tm = tempmail.TempMail()
- email = tm.get_email_address()
- url = 'https://petitions.whitehouse.gov/petition/formally-recognize-black-lives-matter-terrorist-organization'
- name = genname()
- name2 = genname()
- postcode = 'SW1A 0AA'
- print 'Signing as %s %s / %s (%s)' % (name, name2, email, postcode)
- br=mechanize.Browser()
- 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')]
- br.set_handle_robots(False)
- br.open(url)
- br.form = list(br.forms())[0]
- c = br.form.find_control(type="checkbox")
- c.value = ['1']
- br.form['first_name'] = name
- br.form['last_name'] = name2
- br.form['email'] = email
- response = br.submit()
- html = response.read()
- #with open('temp.html', 'w') as f: f.write(html)
- badness = [
- "Postcode not recognised",
- "disposable email address"
- ]
- for x in badness:
- if x in html:
- print x
- print 'Fuck.'
- exit()
- br.form = list(br.forms())[0]
- print 'Confirming...'
- response = br.submit()
- html = response.read()
- while True:
- print 'Checking mail...'
- mb = tm.get_mailbox(email)
- if not 'error' in mb:
- html = mb[0]['mail_html']
- url = re.search('<p><a href="(.*?)">', html).group(1)
- break
- time.sleep(1)
- print 'Validating %s' % url
- response = mechanize.urlopen(url)
- html = response.read()
- #with open('temp2.html', 'w') as f: f.write(html)
- sigs = re.search('<h1 class="visuallyhidden">(.*?) signatures</h1>', html).group(1)
- print '%s total signatures' % sigs
- while True:
- sendmail()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement