Android 台灣中文網

標題: PTC帳號生產器 [打印本頁]

作者: fredwindsvoice    時間: 2016-9-9 23:25
標題: PTC帳號生產器



github 連結 請安心服用


需要一些前置作業

但是可以自動產生PTC帳號  並且完成電子郵件認證

有需要的版友可以使用看看

作者: alvin315    時間: 2016-9-9 23:48
好像很不錯耶 下載來試試看
作者: gn00692464    時間: 2016-9-10 00:04
可以教學嗎 有點難用@@
作者: phil041    時間: 2016-9-10 00:14
怎麼用呀有教學嗎?怎麼用呀有教學嗎?
作者: jsingley    時間: 2016-9-10 00:18
還沒打包,沒法使用
持續觀察中,這東東不錯!
作者: *~牛奶~*    時間: 2016-9-10 00:25
喔喔
看不懂
希望有說明黨這樣才能掛翻天

作者: silky    時間: 2016-9-10 00:51
這有點猛@@
先推~~
作者: rickni    時間: 2016-9-10 07:18
看起來很厲害耶~
這樣不用煩惱帳號問題了
謝謝分享
作者: tracykidd    時間: 2016-9-10 20:09
感謝你的分享,還是先觀望中~~
作者: 寶妮小妞    時間: 2016-9-10 21:06
import time
import string
import random
import datetime
import urllib2

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import StaleElementReferenceException, TimeoutException
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from pikaptcha.jibber import *
from pikaptcha.ptcexceptions import *
from pikaptcha.url import *

user_agent = ("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) " + "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36")

BASE_URL = "https://club.pokemon.com/us/pokemon-trainer-club"

# endpoints taken from PTCAccount
SUCCESS_URLS = (
    "https://club.pokemon.com/us/pokemon-trainer-club/parents/email",  # This initially seemed to be the proper success redirect
    "https://club.pokemon.com/us/pokemon-trainer-club/sign-up/",  # but experimentally it now seems to return to the sign-up, but still registers
)

# As both seem to work, we"ll check against both success destinations until I have I better idea for how to check success
DUPE_EMAIL_URL = "https://club.pokemon.com/us/pokemon-trainer-club/forgot-password?msg=users.email.exists"
BAD_DATA_URL = "https://club.pokemon.com/us/pokemon-trainer-club/parents/sign-up"


def _random_string(length=15):
    return generate_words(3)

def _random_email(local_length=10, sub_domain_length=5, top_domain=".com"):
    return "{local}@{sub_domain}{top_domain}".format(
        local=_random_string(local_length),
        sub_domain=_random_string(sub_domain_length),
        top_domain=top_domain
    )


def _random_birthday():
    start = datetime.datetime(1980, 1, 1)
    end = datetime.datetime(1990, 12, 31)
    diff = end - start
    random_duration = random.randint(0, diff.total_seconds())
    birthday = start + datetime.timedelta(seconds=random_duration)
    return "{year}-{month:0>2}-{day:0>2}".format(year=birthday.year, month=birthday.month, day=birthday.day)


def _validate_birthday(birthday):
    # raises PTCInvalidBirthdayException if invalid
    # split by -
    # has to be at least 2002 and after 1910
    # char length 10
    try:
        assert len(birthday) == 10

        # Ensure birthday is delimited by -
        # Ensure birthday is zero-padded
        year, month, day = birthday.split("-")
        assert year is not None and month is not None and day is not None
        assert len(year) == 4 and year.isdigit()
        assert len(month) == 2 and month.isdigit()
        assert len(day) == 2 and day.isdigit()

        # Check year is between 1910 and 2002, and also that it"s a valid date
        assert datetime.datetime(year=1910, month=1, day=1) <= datetime.datetime(year=int(year), month=int(month), day=int(day)) <= datetime.datetime(year=2002, month=12, day=31)

    except (AssertionError, ValueError):
        raise PTCInvalidBirthdayException("Invalid birthday!")
    else:
        return True


def _validate_password(password):
    # Check that password length is between 6 and 15 characters long
    if len(password) < 6 or len(password) > 15:
        raise PTCInvalidPasswordException("Password must be between 6 and 15 characters.")
    return True


def create_account(username, password, email, birthday, captchakey2, captchatimeout):
    if password is not None:
        _validate_password(password)

    print("Attempting to create user {user}:{pw}. Opening browser...".format(user=username, pw=password))
    if captchakey2 != None:
        dcap = dict(DesiredCapabilities.PHANTOMJS)
        dcap["phantomjs.page.settings.userAgent"] = user_agent
        driver = webdriver.PhantomJS(desired_capabilities=dcap)
    else:
        driver = webdriver.Chrome()
        driver.set_window_size(600, 600)

    # Input age: 1992-01-08
    print("Step 1: Verifying age using birthday: {}".format(birthday))
    driver.get("{}/sign-up/".format(BASE_URL))
    assert driver.current_url == "{}/sign-up/".format(BASE_URL)
    elem = driver.find_element_by_name("dob")

    # Workaround for different region not having the same input type
    driver.execute_script("var input = document.createElement("input"); input.type="text"; input.setAttribute("name", "dob"); arguments[0].parentNode.replaceChild(input, arguments[0])", elem)

    elem = driver.find_element_by_name("dob")
    elem.send_keys(birthday)
    elem.submit()
    # Todo: ensure valid birthday

    # Create account page
    print("Step 2: Entering account details")
    assert driver.current_url == "{}/parents/sign-up".format(BASE_URL)

    user = driver.find_element_by_name("username")
    user.clear()
    user.send_keys(username)

    elem = driver.find_element_by_name("password")
    elem.clear()
    elem.send_keys(password)

    elem = driver.find_element_by_name("confirm_password")
    elem.clear()
    elem.send_keys(password)

    elem = driver.find_element_by_name("email")
    elem.clear()
    elem.send_keys(email)

    elem = driver.find_element_by_name("confirm_email")
    elem.clear()
    elem.send_keys(email)

    driver.find_element_by_id("id_public_profile_opt_in_1").click()
    driver.find_element_by_name("terms").click()

    if captchakey2 == None:
        #Do manual captcha entry
        print("You did not pass a 2captcha key. Please solve the captcha manually.")
        elem = driver.find_element_by_class_name("g-recaptcha")
        driver.execute_script("arguments[0].scrollIntoView(true);", elem)
        # Waits 1 minute for you to input captcha
        try:
            WebDriverWait(driver, 60).until(EC.text_to_be_present_in_element_value((By.NAME, "g-recaptcha-response"), ""))
            print("Captcha successful. Sleeping for 1 second...")
            time.sleep(1)
        except TimeoutException, err:
            print("Timed out while manually solving captcha")
    else:
        # Now to automatically handle captcha
        print("Starting autosolve recaptcha")
        html_source = driver.page_source
        gkey_index = html_source.find("https://www.google.com/recaptcha/api2/anchor?k=") + 47
        gkey = html_source[gkey_index:gkey_index+40]
        recaptcharesponse = "Failed"
        while(recaptcharesponse == "Failed"):
            recaptcharesponse = openurl("http://2captcha.com/in.php?key=" + captchakey2 + "&method=userrecaptcha&googlekey=" + gkey)
        captchaid = recaptcharesponse[3:]
        recaptcharesponse = "CAPCHA_NOT_READY"
        elem = driver.find_element_by_class_name("g-recaptcha")
        print"We will wait 10 seconds for captcha to be solved by 2captcha"
        start_time = int(time.time())
        timedout = False
        while recaptcharesponse == "CAPCHA_NOT_READY":
            time.sleep(10)            
            elapsedtime = int(time.time()) - start_time
            if elapsedtime > captchatimeout:
                print("Captcha timeout reached. Exiting.")
                timedout = True
                break
            print "Captcha still not solved, waiting another 10 seconds."
            recaptcharesponse = "Failed"
            while(recaptcharesponse == "Failed"):
                recaptcharesponse = openurl("http://2captcha.com/res.php?key=" + captchakey2 + "&action=get&id=" + captchaid)
        if timedout == False:      
            solvedcaptcha = recaptcharesponse[3:]
            captchalen = len(solvedcaptcha)
            elem = driver.find_element_by_name("g-recaptcha-response")
            elem = driver.execute_script("arguments[0].style.display = "block"; return arguments[0];", elem)
            elem.send_keys(solvedcaptcha)      
            print "Solved captcha"
    try:
        user.submit()
    except StaleElementReferenceException:
        print("Error StaleElementReferenceException!")

    try:
        _validate_response(driver)
    except:
        print("Failed to create user: {}".format(username))
        driver.close()
        raise

    print("Account successfully created.")
    driver.close()
    return True


def _validate_response(driver):
    url = driver.current_url
    if url in SUCCESS_URLS:
        return True
    elif url == DUPE_EMAIL_URL:
        raise PTCInvalidEmailException("Email already in use.")
    elif url == BAD_DATA_URL:
        if "Enter a valid email address." in driver.page_source:
            raise PTCInvalidEmailException("Invalid email.")
        else:
            raise PTCInvalidNameException("Username already in use.")
    else:
        raise PTCException("Generic failure. User was not created.")


def random_account(username=None, password=None, email=None, birthday=None, plusmail=None, recaptcha=None, captchatimeout=1000):
    try_username = _random_string() if username is None else str(username)
    password = _random_string() if password is None else str(password)
    try_email = _random_email() if email is None else str(email)
    captchakey2 = None if recaptcha is None else str(recaptcha)
    if plusmail is not None:
        pm = plusmail.split("@")
        try_email = pm[0] + "+" + try_username + "@" + pm[1]
    try_birthday = _random_birthday() if birthday is None else str(birthday)

    if birthday is not None:
        _validate_birthday(try_birthday)

    account_created = False
    while not account_created:
        try:
            account_created = create_account(try_username, password, try_email, try_birthday, captchakey2, captchatimeout)
        except PTCInvalidNameException:
            if username is None:
                try_username = _random_string()
            else:
                raise
        except PTCInvalidEmailException:
            if email is None:
                try_email = _random_email()
            else:
                raise

    return {
        "username": try_username,
        "password": password,
        "email": try_email
    }

作者: 123nno    時間: 2016-9-10 21:13
有教程吗- -完全看不懂啊。。。。好多东西
作者: pipu    時間: 2016-9-10 21:18
怎麼使用...有教學嗎...
作者: zxc552020    時間: 2016-9-10 21:33
居然還有這種東西阿 .... 安不安全阿
作者: bluesliver    時間: 2016-9-10 22:05
煩請樓主撥空弄個說明

拜託您了
作者: poke18girl    時間: 2016-9-10 22:09
太好用了,除了recaptcha我沒有賣改為手動之外,真心值得大讚,又快又方便
作者: isheau520    時間: 2016-9-10 22:26
怎麼用呀有教學嗎?怎麼用呀有教學嗎?
作者: poke18girl    時間: 2016-9-10 22:51
其實個網頁都已經解釋得好清楚,你要逐步跟著做去試就得了,又快又正
作者: kuopuki    時間: 2016-9-10 23:02
感謝大大的分享~馬上下載來用~感謝拉
作者: tong8786    時間: 2016-9-10 23:58
感謝大大的分享,馬上試試  
作者: poke18girl    時間: 2016-9-11 22:54
我拍了段片示範怎麼運作,但不知怎放上來
作者: pingmau    時間: 2016-9-11 23:01
完全看不懂,連下載哪個都不知道
作者: arctic115    時間: 2016-9-11 23:17
poke18girl 發表於 2016-9-11 22:54
我拍了段片示範怎麼運作,但不知怎放上來

上傳YOUTUBE在PO連結應該可以?
作者: littlemiko    時間: 2016-9-12 00:00
有必要弄這種東西嗎= =....
我等一下寫一篇快速創帳號的SOP
作者: cooljismeisly    時間: 2016-9-12 00:48
看不懂怎麼用
希望有說明
作者: poke18girl    時間: 2016-9-12 09:06
那就等待你的快速創號吧




歡迎光臨 Android 台灣中文網 (https://apk.tw/) Powered by Discuz! X3.1