예제 #1
0
def optimizeByCsv(csvPath, resDir, cdnDir):
    log.good("处理 %s ..."%csvPath)
    csvObj = csv.reader(file(csvPath, 'rb'))

    absResPath = os.path.abspath(resDir)
    curDir = os.path.abspath(".")
    for line in csvObj:
        if len(line) > 0:
            os.chdir(cdnDir)
            pathname = line[0]
            if not os.path.exists(pathname):
                # log.error("文件 %s/%s 不存在"%(cdnDir, pathname))
                os.chdir(curDir)
                continue

            targetPath = os.path.join(absResPath, pathname)
            log.trace("from:"+pathname+"  to:"+targetPath)
            try:
                os.unlink(targetPath)
            except:
                pass

            try:
                os.renames(pathname, targetPath)
                os.chdir(curDir)
            except Exception as e:
                log.error("exception:%s file:%s"%(e, pathname))

    log.good("处理 %s 结束"%csvPath)
예제 #2
0
 def remind_later():
     # Remind to verify later
     remind_later = browser.find_element_by_xpath(
         '/html/body/div[3]/div/div/div/div/div/div[1]/div/div/div/div/div[3]/div[2]/div/button'
     )
     remind_later.click()
     log.good('Skipped email verification...')
     log.log_account(username, email, password)
     log.good("Logged account...")
def gen_credentials():
    username = f'{dictionary[random.randint(0, 447856)]}{random.randint(100, 999)}'
    password = f'{dictionary[random.randint(0, 447856)]}{random.randint(100000, 999999)}'
    date_of_birth = (random.randint(1, 12), random.randint(1, 28),
                     random.randint(1940, 2002))
    email = f'{username}@gmail.com'
    log.good(
        f"Generated username ({username}), password ({password}), email ({email}), and date of birth ({str(date_of_birth)})"
    )
    return (username, password, date_of_birth, email)
예제 #4
0
def recognize_audio(audio_file_url: str):
    r = sr.Recognizer()
    # audio_file = wget.download(audio_file_url)
    # captcha = sr.AudioFile(audio_file)
    captcha = sr.AudioFile(audio_file_url)
    with captcha as source:
        audio = r.record(source)
    code = r.recognize_google(audio)
    log.good(f'Captcha code: {code}')
    return code
예제 #5
0
def optimizeActorAni(resDir, cdnDir):
    """优化微客户端动画播放"""
    log.good("回滚角色动画资源 ...")
    dirList = [
        "Player_M_ck", "Player_M_ck_gz", "Player_W_ck", "Player_W_ck_gz",
        "Player_M_ds", "Player_M_ds_gz", "Player_W_ds", "Player_W_ds_gz",
        "Player_M_fs", "Player_M_fs_gz", "Player_W_fs", "Player_W_fs_gz",
        "Player_M_zj", "Player_M_zj_gz", "Player_W_zj", "Player_W_zj_gz",
    ]

    curDir = os.path.abspath(".")
    tarDir = os.path.abspath(resDir)
    os.chdir(cdnDir)
    for name in dirList:
        dirName = "./Models/" + name
        if os.path.exists(dirName):
            util.mvRes(dirName, tarDir, "(fb)")
        else:
            log.error("目录 %s%s 不存在"%(cdnDir, dirName))
    os.chdir(curDir)
    log.good("回滚角色动画资源 结束")
import log
import random

# 447,856 words

log.info("Loading dictionary...")
dictionary_file = open('dictionary.txt', 'r')
dictionary = dictionary_file.read().split('\n')
log.good("Loaded!")


def gen_credentials():
    username = f'{dictionary[random.randint(0, 447856)]}{random.randint(100, 999)}'
    password = f'{dictionary[random.randint(0, 447856)]}{random.randint(100000, 999999)}'
    date_of_birth = (random.randint(1, 12), random.randint(1, 28),
                     random.randint(1940, 2002))
    email = f'{username}@gmail.com'
    log.good(
        f"Generated username ({username}), password ({password}), email ({email}), and date of birth ({str(date_of_birth)})"
    )
    return (username, password, date_of_birth, email)
예제 #7
0
import log
import os
import mysql.connector
import hashlib

db = mysql.connector.connect(
    user=os.getenv("MYSQL_USER"),
    password=os.getenv("MYSQL_PASS"),
    host=os.getenv("MYSQL_HOST"),
    database="openpass",
)
log.good("Connected to MySQL.")

cursor = db.cursor()


def get_users():
    cursor.execute("select * from users")
    users_raw = cursor.fetchall()
    users = []
    for user in users_raw:
        users.append({
            "id": user[0],
            "username": user[1],
            "created_at": user[3]
        })
    return users


def auth_check(username, password):
    cursor.execute(f"select * from users where name = {username}")
예제 #8
0
async def on_ready():
    log.good("Bot is ready")
    await bot.change_presence(
        activity=discord.Game("!votekick | votekick.ismaeelakram.com")
    )
    log.good("Presence changed")
예제 #9
0
def add_cog(cog):
    bot.add_cog(cog)
    cogs.append(cog)
    log.good("Loaded cog: " + str(cog))
예제 #10
0
def run():
    if tor:
        log.info('Getting Tor binary...')
        binary = '/Applications/Tor Browser.app/Contents/MacOS/firefox'
        if os.path.exists(binary) is False:
            raise ValueError("The binary path to Tor firefox does not exist.")
        firefox_binary = FirefoxBinary(binary)
        firefox_binary.add_command_line_options()

        log.info('Starting Tor...')
        browser = webdriver.Firefox(firefox_binary=firefox_binary)
        log.good('Tor started!')
    else:
        log.info('Starting Chrome...')
        chrome_options = ChromeOptions()
        chrome_options.add_argument(
            '--disable-blink-features=AutomationControlled')
        # chrome_options.add_argument("disable-infobars")
        # chrome_options.add_argument("--disable-extensions")
        # chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
        # chrome_options.add_experimental_option('useAutomationExtension', False)
        browser = webdriver.Chrome(options=chrome_options)
        log.good("Chrome started!")

    # Start

    # Gen credentials
    credentials = credential_gen.gen_credentials()
    username = credentials[0]
    password = credentials[1]
    date_of_birth = credentials[2]
    email = credentials[3]

    # Start browser
    log.info('Getting twitch.tv...')
    browser.get("https://twitch.tv")

    sign_up_button = browser.find_element_by_xpath(
        '/html/body/div[1]/div/div[2]/nav/div/div[3]/div[3]/div/div[1]/div[2]/button'
    )
    sign_up_button.click()
    log.good("Clicked signup button...")

    log.info("Waiting to load signup form...")
    time.sleep(3)

    # Sign up

    # Username
    username_field = browser.find_element_by_xpath(
        '//*[@id="signup-username"]')
    username_field.send_keys(username)
    log.good(f'Filled in username: {username}')

    # Password
    password_field = browser.find_element_by_xpath('//*[@id="password-input"]')
    password_field.send_keys(password)
    log.good(f'Filled in password: {password}')

    # Confirm password
    confirm_password_field = browser.find_element_by_xpath(
        '//*[@id="password-input-confirmation"]')
    confirm_password_field.send_keys(password)
    log.good(f'Filled in confirmed password: {password}')

    # Date of birth
    month = browser.find_element_by_xpath(
        f'/html/body/div[3]/div/div/div/div/div/div[1]/div/div/div[3]/form/div/div[3]/div/div[2]/div[1]/select/option[{date_of_birth[0]+1}]'
    ).click()
    day = browser.find_element_by_xpath(
        '/html/body/div[3]/div/div/div/div/div/div[1]/div/div/div[3]/form/div/div[3]/div/div[2]/div[2]/div/input'
    ).send_keys(date_of_birth[1])
    year = browser.find_element_by_xpath(
        '/html/body/div[3]/div/div/div/div/div/div[1]/div/div/div[3]/form/div/div[3]/div/div[2]/div[3]/div/input'
    ).send_keys(date_of_birth[2])

    # Email
    email_field = browser.find_element_by_xpath('//*[@id="email-input"]')
    email_field.send_keys(email)
    log.good(f'Filled in email: {email}')

    log.info('Waiting for submission verification...')
    time.sleep(5)

    # Submit form
    submit_button = browser.find_element_by_xpath(
        '/html/body/div[3]/div/div/div/div/div/div[1]/div/div/div[3]/form/div/div[5]/button'
    )
    submit_button.click()
    log.good('Submitted sign up form.')

    log.info("Waiting 5 seconds...")
    time.sleep(5)

    def remind_later():
        # Remind to verify later
        remind_later = browser.find_element_by_xpath(
            '/html/body/div[3]/div/div/div/div/div/div[1]/div/div/div/div/div[3]/div[2]/div/button'
        )
        remind_later.click()
        log.good('Skipped email verification...')
        log.log_account(username, email, password)
        log.good("Logged account...")

    def complete_captcha():
        browser.switch_to.frame(
            browser.find_element_by_xpath(
                '/html/body/div[1]/div[2]/div[1]/iframe'))
        audio_captcha_button = browser.find_element_by_xpath(
            '//*[@id="fc_meta_audio_btn"]')
        audio_captcha_button.click()
        time.sleep(.5)
        audio_download = browser.find_element_by_xpath(
            '//*[@id="audio_download"]')
        audio_download.click()
        time.sleep(1.5)
        # audio_url = 'https://client-api.arkoselabs.com' + browser.find_element_by_xpath('//*[@id="audio_download"]').href
        list_of_files = glob.glob('/Users/ismaeel/Downloads/*.wav')
        latest_file = max(list_of_files, key=os.path.getctime)
        audio_url = '/Users/ismaeel/Downloads/' + latest_file
        log.info(f'Captcha audio url: ${audio_url}')
        code = arkose_labs.recognize_audio(audio_url)
        browser.switch_to.default_content()

    try:
        remind_later()
    except:
        input("captcha: ")
        # time.sleep(2)
        # complete_captcha()
        # time.sleep(3)
        # remind_later()

    # log.info("Waiting 3 seconds...")
    # time.sleep(3)
    browser.get(f'https://twitch.tv/{user_to_follow}')

    time.sleep(1)

    # Follow
    follow_button = browser.find_element_by_xpath(
        '//*[@id="root"]/div/div[2]/div/main/div[2]/div[3]/div/div/div[2]/div[1]/div[2]/div/div[2]/div[1]/div[2]/div[1]/div/div/div/div/div[1]/div/div/div/div/button'
    )
    follow_button.click()
    log.good(f"Followed {user_to_follow}!")
    browser.quit()