Skip to content

Instantly share code, notes, and snippets.

@drov0
Created November 13, 2017 13:38
Show Gist options
  • Save drov0/69600a83c5686798f21a4790274a3f42 to your computer and use it in GitHub Desktop.
Save drov0/69600a83c5686798f21a4790274a3f42 to your computer and use it in GitHub Desktop.
from selenium import webdriver
import names
import random
import time
import os
import string
import base64
import requests
import json
class EasyMail:
apikey = "none"
mail = ""
password = ""
def __init__(self, apikey, mail=None, password=None):
self.apikey = apikey
if (mail and password):
self.mail = mail
self.password = password
def gen_pwd(self, length):
chars = string.ascii_letters + string.digits + '!@#$%^&*()'
random.seed = (os.urandom(1024))
return ''.join(random.choice(chars) for i in range(length))
def create_account(self, save_file="account.csv"):
driver = webdriver.Firefox()
driver.get("https://easy.com/free-email")
first_name = names.get_first_name()
last_name = names.get_last_name()
driver.find_element_by_id("firstname").send_keys(first_name)
driver.find_element_by_id("lastname").send_keys(last_name)
username = first_name + ''.join(random.choice(string.ascii_lowercase + string.digits) for i in range(10))
driver.find_element_by_id("user").send_keys(username)
self.mail = username + "@easy.com"
self.password = self.gen_pwd(10)
driver.find_element_by_id("pwd").send_keys(self.password)
driver.find_element_by_id("repwd").send_keys(self.password)
capcha_url = driver.find_element_by_id("siimage").get_attribute("src")
b64_capcha = base64.b64encode(requests.get(capcha_url).content)
result = requests.post("http://2captcha.com/in.php",
data={'method': "base64", 'key': self.apikey, 'body': b64_capcha, 'json' : 1}).text
result_parsed = json.loads(result)
while result_parsed['status'] == 0:
if result_parsed['request'] == "ERROR_NO_SLOT_AVAILABLE" :
time.sleep(1)
result = requests.post("http://2captcha.com/in.php",
data={'method': "base64", 'key': self.apikey, 'body': b64_capcha,
'json': 1}).text
result_parsed = json.loads(result)
else:
print("unhandled error : " + result_parsed['request'])
exit(1)
id = result_parsed['request']
capcha_text = requests.get("http://2captcha.com/res.php?action=get&id="+id).text
driver.find_element_by_id("captcha_code").send_keys(capcha_text)
driver.find_element_by_class_name("checkbox").click()
driver.find_element_by_name("register_now").click()
with open(save_file, 'a') as file:
file.write(self.mail + ";" + self.password + "\n")
driver.close()
mail = EasyMail("apikey")
mail.create_account()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment