Created
June 21, 2013 09:12
-
-
Save angelworm/5829952 to your computer and use it in GitHub Desktop.
creates many many dmm accounts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from selenium import webdriver | |
from selenium.webdriver.support.ui import Select | |
from selenium.webdriver.common.alert import Alert | |
import os | |
import sys | |
import mechanize | |
import random | |
import re | |
import time | |
import imaplib, email | |
def dmmregister(driver, mailaddress, password): | |
driver.get("https://www.dmm.com/my/-/register/") | |
driver.find_element_by_id("mailaddress").send_keys(mailaddress) | |
driver.find_element_by_id("password").send_keys(password) | |
driver.find_element_by_id("mailmagazine").click() | |
driver.find_element_by_id("mailmagazine").submit() | |
def confirm(driver, url): | |
driver.get(url) | |
def dmmlogin(driver, mail, password): | |
driver.get("https://www.dmm.com/my/-/login/") | |
driver.find_element_by_id("login_id").send_keys(mail) | |
driver.find_element_by_id("password").send_keys(password) | |
driver.find_element_by_id("login_id").submit() | |
def socialize(driver): | |
driver.get("https://www.dmm.com/netgame/social/-/regist/") | |
driver.find_element_by_name("nickname").send_keys(u"ねんどきX") | |
driver.find_element_by_id("s1").click() | |
try: | |
driver.find_element_by_id("s1").submit() | |
except: | |
print 1 | |
pass | |
try: | |
driver.find_element_by_id("commit_submit").click() | |
except: | |
print 2 | |
try: | |
driver.find_element_by_id("commit_submit").click() | |
except: | |
print 3 | |
pass | |
driver.switch_to_alert().accept() | |
def get_my_id(driver): | |
driver.get("http://www.dmm.com/netgame/social/profile/") | |
return driver.find_element_by_xpath('//table[@class="mg-b12"]//td[1]').text | |
def friend_request(driver, your_id): | |
driver.get("http://www.dmm.com/netgame/social/profile/=/id=%s/" % your_id) | |
driver.find_elements_by_tag_name("input")[0].click() | |
time.sleep(5) | |
driver.find_element_by_id("body").send_keys(u"ニンジャ死すべし") | |
driver.find_element_by_id("body").submit() | |
time.sleep(5) | |
driver.find_elements_by_tag_name("input")[1].click() | |
def _getMailConfirmUrl(mailaddr, mailpass, sendto): | |
def getMails(mail): | |
key, res = mail.search(None, "(TO '%s')" % sendto) | |
return res | |
mail = imaplib.IMAP4_SSL(host='imap.gmail.com') | |
mail.login(mailaddr, mailpass) | |
mail.select('INBOX') | |
mails = [] | |
while True: | |
try: | |
mails = getMails(mail) | |
break | |
except KeyboardInterrupt, e: | |
raise e | |
except: | |
print "re-getting mail" | |
key, data = mail.fetch(mails[0], "(BODY[TEXT])") | |
url = re.findall("https://www\.dmm\.com/my/-/register/complete/=/cert=\w+__/",email.message_from_string(data[0][1]).as_string().replace('=\r\n','')) | |
return url[0] | |
def create(mail, mail_password, account_password, n): | |
driver = webdriver.Firefox() | |
accmail = mail.replace('@', "+dmm%s@" % n) | |
dmmregister(driver, accmail, account_password) | |
time.sleep(10) | |
print "create new account:", accmail | |
url = _getMailConfirmUrl(mail, mail_password, accmail) | |
print "FetchURL:", url | |
confirm(driver, url) | |
print "confirmed" | |
driver.close() | |
return (accmail, account_password) | |
def run_all(mail, mail_password, account_password, your_id, n): | |
# try: | |
acc, pss = create(mail, mail_password, account_password, n) | |
# except: | |
# print "error" | |
# acc, pss= mail.replace('@', "+dmm%s@" % n), account_password | |
driver = webdriver.Firefox() | |
dmmlogin(driver, acc, pss) | |
socialize(driver) | |
print "user has been socialized." | |
friend_request(driver, your_id) | |
driver.close() | |
if len(sys.argv) == 0: | |
pass | |
else: | |
if len(sys.argv) != 6: | |
print sys.argv | |
print "mail, mail_password, account_password, your_id, n" | |
else: | |
run_all(*sys.argv[1:]) | |
# "10510694" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment