Esempio n. 1
0
 def __init__(self):
     config = {
         "apiKey": TWOCAPTCHA_API_KEY,
         "recaptchaTimeout": 120,
         "pollingInterval": 10,
     }
     self.solver = TwoCaptcha(**config)
Esempio n. 2
0
def solve(file_path):
    """Solves an image-based captcha.

    Args:
        file_path (str): Path to the captcha that will be solved.

    Returns:
        The string from the solved captcha or an exception if any error has occured.

    """

    # Instantiates the 2Captcha's solver
    solver = TwoCaptcha(CAPTCHA_KEY)

    # Tries to perform the following block
    try:
        # Solves the captcha
        result = solver.normal(file_path)

        # Returns the solved captcha
        return result['code']

    # If an exception has been raised
    except Exception as e:
        # Returns the exception
        return e
Esempio n. 3
0
    def harverstor(self, apikey, sitekey, url):

        try:

            twoCaptcha = TwoCaptcha(apikey)
            recaptcha_token = twoCaptcha.solve_captcha(site_key=sitekey,
                                                       page_url=url)

            token = {
                "time": datetime.now().strftime('%y %m %d %I:%M%p'),
                "token": recaptcha_token,
                "claimed": False
            }

            self.tokens.append(token)

            with open('tokens.json', 'w') as outfile:
                json.dump(self.tokens, outfile)

            print(self.tokens)

        except Exception:

            traceback.print_exc()

            print("Unable to fetch tokens, restarting...")

            self.harverstor(url, apikey, sitekey)
Esempio n. 4
0
def solve(site_key, url):
    """Solves a re-captcha v2.

    Args:
        site_key (str): Site's captcha key.
        url (str): Site's URL.

    Returns:
        The string from the solved captcha or an exception if any error has occured.

    """

    # Instantiates the 2Captcha's solver
    solver = TwoCaptcha(CAPTCHA_KEY)

    # Tries to perform the following block
    try:
        # Solves the captcha
        result = solver.recaptcha(sitekey=site_key, url=url)

        # Returns the solved captcha
        return result['code']

    # If an exception has been raised
    except Exception as e:
        # Returns the exception
        return e
    def incorrect_captcha_report(self, captcha_service, captcha_id):
        """Function to send report to specific captcha solving service
        Used in case of captcha was incorrectly solved.
        """

        try:
            if captcha_service == "DBC":
                dbc_token = config['DBC_TOKEN']
                client = deathbycaptcha.HttpClient(None, None, dbc_token)
                client.report(captcha_id)
            elif captcha_service == "2Captcha":
                api_key = config['2CAPTCHA']
                solver = TwoCaptcha(api_key)
                solver.report(captcha_id, False)
            is_reported = True
        except:
            is_reported = False
        finally:
            self.incorrect_captcha_retries -= 1
            print(self.incorrect_captcha_retries)
            error_msg = {
                "error_type": "CAPTCHA_INCORRECTLY_SOLVED",
                "captcha_service": captcha_service,
                "is_reported": is_reported
            }

            if self.incorrect_captcha_retries == 0:
                self.errors.append(error_msg)
                self.logger.error(error_msg)
            else:
                self.logger.warning(error_msg)
def add_captcha(sitekey, apikey):
    file = open(get_local_directory() + "/resources/captcha_tokens.txt", "a")
    site_url = 'http://www.supremenewyork.com'
    twoCaptcha = TwoCaptcha(apikey)
    file.write(
        twoCaptcha.solve_recaptcha(site_url=site_url, site_key=sitekey) + "|" +
        str(time.time()) + "\n")
    file.close()
Esempio n. 7
0
 def _get_client(api_token):
     solver = TwoCaptcha(api_token)
     try:
         balance = solver.balance()
         if not balance:
             raise InvalidOrNoBalanceApiToken('No balance left on the token.')
     except ApiException as msg:
         raise InvalidOrNoBalanceApiToken(msg) from None
     return solver
Esempio n. 8
0
def captcha_response(img_name, captcha_api_key):
    api_key = os.getenv('APIKEY_2CAPTCHA', f'{captcha_api_key}')
    solver = TwoCaptcha(api_key)
    try:
        result = solver.normal(f'{img_name}')
        #os.remove(os.getcwd() + f'./{img_name}')
        return result['code']
    except:
        #os.remove(os.getcwd() + f'./{img_name}')
        return False
Esempio n. 9
0
    def generateToken(self):
        print("Generating Token.....")
        captcha = TwoCaptcha('a464e17395843472cfcf29502f14be1f')
        token = captcha.solve_captcha(
            site_key="6Lc_ilIUAAAAANld5QNB-AiX_HdommM2dxwxku3Q",
            page_url=self.URL)

        print("Token Generated !!")

        return token
Esempio n. 10
0
 def twocaptcha(self, sitekey, url):
     sys.path.append(
         os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
     api_key = os.getenv('APIKEY_2CAPTCHA', 'xxxxx')
     solver = TwoCaptcha(api_key)
     try:
         result = solver.recaptcha(sitekey=sitekey, url=url)
     except Exception as e:
         sys.exit(e)
     else:
         return str(result['code'])
Esempio n. 11
0
def captcha_text(captcha_image):
    """
    return free number from sms-activate
    :return: str(ExAmPlE)"""
    api_key = os.getenv('YOUR_API_KEY')
    solver = TwoCaptcha(api_key)
    try:
        result = solver.normal(captcha_image)
    except Exception as e:
        result = ''
        print(e)
    return result
Esempio n. 12
0
def get_captcha(img):
    api_key = "483852b189a89e09da6919178ae88526"
    solver = TwoCaptcha(api_key, defaultTimeout=100, pollingInterval=5)
    try:
        result = solver.normal(img, caseSensitive=1)

    except Exception as e:
        print(e)

    else:
        print(result)
        return result['code']
Esempio n. 13
0
def get_g_token(api_key, url) -> str:
    solver = TwoCaptcha(api_key)
    try:
        result = solver.solve_captcha(
            site_key='6LeCeskbAAAAAE-5ns6vBXkLrcly-kgyq6uAriBR', page_url=url)

    except Exception as e:
        print(e)
        exit(-1)
        return ""
    else:
        print('solved: ' + str(result))
        return result
Esempio n. 14
0
 def bypass_captcha(self, captcha_tag):
     # Bypassing ReCaptcha
     sitekey = captcha_tag['data-sitekey']
     url = self.driver.current_url
     solver = TwoCaptcha(self.CAPTCHA_KEY)
     result = solver.recaptcha(sitekey=sitekey, url=url, version=2)
     print(result['code'])
     self.driver.execute_script(
         'document.getElementById("g-recaptcha-response").innerHTML="{}";'.
         format(result['code']))
     sleep(3)
     self.driver.execute_script('submitForm()')
     sleep(10)
Esempio n. 15
0
def captcha_solver(captcha):
    try:
        if not captcha_type:  # Ручной ввод
            print(captcha.get_url())
            captcha.try_again(input("Код с картинки => "))
            logging.info("Каптча решена успешно")
        else:
            solver = TwoCaptcha(rucaptcha_token)
            code = solver.normal(
                b64encode(captcha.get_image()).decode("utf-8"))
            captcha.try_again(code['code'])
            logging.info("Каптча решена успешно")
    except:
        logging.warning("Каптча не решена")
Esempio n. 16
0
def get_recaptcha_response(api_key: str) -> str:
    """
    Solve the recaptcha  and return the response. This takes a minute or two.

    NOTE: This is configured to use 2Captcha as the captcha solving service. If
    you want to use a different service you'll have to modify this function.
    """
    solver = TwoCaptcha(apiKey=api_key)
    balance = solver.balance()
    print(f"2Captcha current balance: ${balance}...")
    if balance < 0.1:
        warnings.warn(f"2Captcha balance is running low")
    r = solver.recaptcha(sitekey=config.RECAPTCHA_SITE_KEY, url=config.WEBSITE_URL)
    return r["code"]
 def twocaptcha(self, sitekey):
     sys.path.append(
         os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
     api_key = os.getenv('APIKEY_2CAPTCHA',
                         ' 791a83d1333d48429227d52e1a153ea3')
     solver = TwoCaptcha(api_key)
     try:
         result = solver.recaptcha(
             sitekey=sitekey,
             url=
             'https://www.nakedcph.com/xx/904/nike-dunk-hi-retro-prm-fcfs-raffle'
         )
     except Exception as e:
         sys.exit(e)
     return str(result['code'])
Esempio n. 18
0
def get_and_solve(driver, two_captcha_api_key, url):
    """Get and solve captcha element."""
    recaptcha_element = driver.find_element(By.CLASS_NAME, "g-recaptcha")
    sitekey = recaptcha_element.get_attribute("data-sitekey")

    solver = TwoCaptcha(two_captcha_api_key)
    try:
        result = solver.recaptcha(sitekey=sitekey, url=url)

    except Exception as e:
        print(e)
    else:
        driver.execute_script(
            "document.getElementById('g-recaptcha-response').innerHTML='" +
            result["code"] + "';")
        time.sleep(3)
Esempio n. 19
0
    async def resolve(self, site_key, url):
        solver = TwoCaptcha(self._credential)
        logger.info(
            'Resolving captcha.'
        )
        try:
            solvedcaptcha = solver.recaptcha(site_key, url)
        except ApiException as error:
            raise CaptchaResolverException(
                f'Erro ao tentar resolver captcha: {error}'
            )

        logger.info(
            'Captcha resolved.'
        )

        return solvedcaptcha['code']
Esempio n. 20
0
def click_i_m_not_robot(driver):
    url = driver.current_url
    data_sitekey = None
    page_source = driver.page_source
    print("Done page source")
    data_sitekeys = findall('data-sitekey="(.*?)"', page_source)
    if data_sitekeys:
        data_sitekey = data_sitekeys[0]
        print("Multiple data sitekey selected the first one")
    else:
        elments = driver.find_elements_by_xpath(
            '//iframe[contains(@role,"presentation")]')
        print("in ifrmae")
        if elments:
            for elm in elments:
                if elm.is_displayed():
                    src = elm.get_attribute('src')
                    data_sitekey = findall('k=(.*?)&', src)[0]
                    print(f"Data_stirekey is {data_sitekey}")
                    break
        else:
            print("Did not find iframe")

    if data_sitekey is not None:
        print("Datakey is not none")
        print(f"Datakey {data_sitekey}")
        solver = TwoCaptcha(API_KEY)
        print("Solving captcha...")
        success_id = solver.recaptcha(data_sitekey, url)
        print("Solved...\nSending Captcha")
        driver.execute_script(
            'document.querySelector(".g-recaptcha-response").style.display="block";'
        )
        sleep(5)
        driver.execute_script(
            'document.querySelector(".g-recaptcha-response").innerText="%s";' %
            success_id["code"])
        print("Sent!")
        sleep(3)
        if driver.find_elements_by_xpath('//div[@data-callback]'):
            data_callback = driver.find_element_by_xpath(
                '//div[@data-callback]').get_attribute('data-callback')
            driver.execute_script(data_callback + "();")
    else:
        print("Data_sitekey is none")
Esempio n. 21
0
def solve(count) -> str:
    catpchakey = config['2capthcaKey']; solver = TwoCaptcha(catpchakey)
    print(f"{color.YELLOW}[{count}] Waiting for captcha to be resolved. {color.RESET_ALL}")

    try:
        result = solver.funcaptcha(sitekey="E5554D43-23CC-1982-971D-6A2262A2CA24", url=f"https://www.twitch.tv/", version="v3", score=0.1)

    except Exception as err:
        if "ERROR_ZERO_BALANCE" in str(err):
            print(f"{color.RED}[-]{color.RESET_ALL} Error: [2CAPTCHA] api balance is {color.RED}ZERO{color.RESET_ALL}")
            quit()
        print(f"{color.RED}[-]{color.RESET_ALL} CAPTCHA API ERROR: {err}")
        return False

    else:
        print(f"{color.GREEN}[{count}] Captcha resolved successfully. {color.RESET_ALL}")
        #print(f"{str(result['code'])}")
        return str(result["code"])
Esempio n. 22
0
    async def make_login(self):
        log.info(msg="Spider captcha detected")
        two_captcha = TwoCaptcha(
            **{
                'apiKey': CAPTCHA['2CAPTCHA_API_KEY'],
                'defaultTimeout': 60,
                'recaptchaTimeout': 200,
                'pollingInterval': 7
            })
        captcha_handler = CaptchaHandler(captcha_resolver=two_captcha)
        log.info(
            msg=f"Solving captcha - {self.login_data['site_key_captcha']}")

        captcha_result = await captcha_handler.broker_captcha(
            site_key=self.login_data["site_key_captcha"],
            site_url=self.login_data['captcha_url'])
        log.info(msg=f"Captcha solved: {captcha_result}")
        self.login_params["captcha"] = captcha_result

        await self.login_password(self.login_data['init_url'])
        await self.authorize()
        await self.auth_login()
        # Password recovery pick
        wait.until(
            EC.element_to_be_clickable((
                By.XPATH,
                '/html/body/div/div/div[2]/div/main/div/div/div/form/div[3]/div/div[2]/div/div[1]/span'
            ))).click()

        recovery = wait.until(
            EC.element_to_be_clickable((
                By.XPATH,
                '/html/body/div/div/div[2]/div/main/div/div/div/form/div[3]/div/div[1]/div[2]/span/input'
            )))
        type_me(recovery, recoveryname)

        solver = TwoCaptcha(captcha_config.key)

        img = wait.until(
            EC.visibility_of_element_located(
                (By.CLASS_NAME, 'captcha__image')))
        src = img.get_attribute('src')
        img = requests.get(src)
        with open('captcha.jpg', 'wb') as f:
            f.write(img.content)

        try:
            result = solver.normal('captcha.jpg')  # change to your image path

            finalResult = str(result['code'])
            os.remove('captcha.jpg')
            sleep(1)
Esempio n. 24
0
from selenium import webdriver
from twocaptcha import TwoCaptcha
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.keys import Keys

opts = Options()
opts.headless = True  # True or False - Decide if you want a GUI for the browser
opts.add_argument(
    "user-agent=Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
)  # This user-agent makes sure you do not get banned from the website
browser = webdriver.Chrome(ChromeDriverManager().install(),
                           chrome_options=opts)
browser.minimize_window()
solver = TwoCaptcha('PUT API')  # 2captcha.com API key needs to be put here
TEXT = 'Put your text message over here'  # Message you want to send people
name = "dajkatal"  # Put the name you want on the site


def register():
    try:
        browser.get('http://www.chatiw.com?old=interface')
        time.sleep(5)
        browser.find_element_by_id('input1').send_keys(name)  # Set name
        browser.find_element_by_xpath(
            '//*[@id="age_list"]/option[2]').click()  # Set age to 18
        browser.find_element_by_xpath(
            '//*[@id="start_form"]/div[5]/div/input[2]').click()  # Set female
        browser.find_element_by_id('submit_btn').click()  # Submit
        time.sleep(5)
Esempio n. 25
0
import sys
import os

sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))

from twocaptcha import TwoCaptcha

api_key = os.getenv('APIKEY_2CAPTCHA', 'YOUR_API_KEY')

solver = TwoCaptcha(api_key)

try:
    result = solver.text('If tomorrow is Saturday, what day is today?')

except Exception as e:
    sys.exit(e)

else:
    print(result)
    sys.exit('solved: ' + str(result))
Esempio n. 26
0
    ["Aranea", "Serket"],
    ["Horuss", "Zahhak"],
    ["Kurloz", "Makara"],
    ["Cronos", "Ampora"],
    ["Meenah", "Peixes"],
    ["Callie", "Ohpeee"],
    ["Lord", "English"],
    ["Doc", "Scratch"],
    ["Harryanderson", "Egbert"],
    ["Vriska", "Maryamlalonde"],
    ["Vrissy", "Maryamlalonde"],
    ["Tavros", "Crocker"],
    ["Yiffanylongstocking", "Lalondeharley"],
]

solver = TwoCaptcha(apiKey=apikey)

fake = Faker()
Faker.seed()

html2text = HTML2Text()
html2text.ignore_links = True


def contact(fake, solver, sitekey, url, story, html2text, testing=True):
    print("Getting key...")

    key = "[KEY]"
    if not testing:
        key_req = requests.post(
            "https://www.doitwithoutdues.com/api/form/FormSubmissionKey", data={}
Esempio n. 27
0
# with open(r'D:\RTW\python\ScrapyUtils\val.txt') as f:
#     content = f.read()

content = """
Qualcomm teased the Snapdragon 888, its latest 5G-equipped flagship smartphone processor, on the first day of its Snapdragon Tech Summit. But at the day two keynote, the company provided all of the details on the new chipset, which will be the brains powering almost every major 2021 Android flagship.

First off, the basic specs: the new processor will feature Qualcomm’s new Kryo 680 CPU, which will be one of the first devices to feature Arm’s latest customized Cortex-X1 core and promises up to 25 percent higher performance than last year’s chip with a maximum clock speed of 2.84GHz. And the company’s new Adreno 660 GPU promises a 35 percent jump on graphics rendering, in what it says is the biggest performance leap for its GPUs yet. The new CPU and GPU are also more power-efficient compared to those on the Snapdragon 875, with a 25 percent improvement for the Kyro 680 and a 20 percent improvement on the Adreno 660.

Another key difference between the Snapdragon 888 and last year’s 865 is that Qualcomm has finally integrated its 5G modem directly into the SoC. That means manufacturers won’t have to deal with finding the space (and power) for a second external modem. Specifically, the Snapdragon 888 will feature Qualcomm’s 5nm X60 modem, which the company announced back in February, and it will enable better carrier aggregation and download speeds up to 7.5 Gbps on new devices. The Snapdragon 888 will also support Wi-Fi 6 as well as the new 6GHz Wi-Fi 6E standard, which should boost that rollout by making it the default on most Android flagships.

As is tradition for a Snapdragon update, Qualcomm is also putting a big emphasis on its camera improvements. The new Spectra 580 ISP is the first from Qualcomm to feature a triple ISP, allowing it to do things like capture three simultaneous 4K HDR video streams or three 28-megapixel photos at once at up to 2.7 gigapixels per second (35 percent faster than last year).

It also offers improved burst capabilities and is capable of capturing up to 120 photos in a single second at a 10-megapixel resolution. Lastly, the upgraded ISP adds computational HDR to 4K videos, an improved low-light capture architecture, and the option to shoot photos in 10-bit color in HEIF. That said, it’ll be up to phone manufacturers to build cameras that can take advantage of the new features.

The final major changes come in AI performance, thanks to Qualcomm’s new Hexagon 780 AI processor. The Snapdragon 888 features Qualcomm’s sixth-generation AI Engine, which it promises will help improve everything from computational photography to gaming to voice assistant performance. The Snapdragon 888 can perform 26 trillion operations per second (TOPS), compared to 15 TOPS on the Snapdragon 865, while delivering three times better power efficiency. Additionally, Qualcomm is promising big improvements in both scalar and tensor AI tasks as part of those upgrades.

The Snapdragon 888 also features the second-generation Qualcomm Sensing Hub, a dedicated low-power AI processor for smaller hardware-based tasks, like identifying when you raise your phone to light up the display. The new second-gen Sensing Hub is dramatically improved, which means the phone will be able to rely less on the main Hexagon processor for those tasks.

All of this adds up to a substantial boost in Qualcomm’s — and therefore, nearly every Android flagship’s — capabilities for what our smartphones will be able to do. The first Snapdragon 888 smartphones are expected to show up in early 2021, which means it won’t be long before we’ll be able to try out the next generation of Android flagships for ourselves.

"""

# jieba.analyse.set_stop_words(r'D:\RTW\python\ScrapyUtils\val.txt')
# text_tags = jieba.analyse.extract_tags(content, topK=30)
#
# print(text_tags)

from twocaptcha import TwoCaptcha

solver = TwoCaptcha('b7e7611a72e9c3362a1f95c1371e45a8')
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))

from twocaptcha import TwoCaptcha

api_key = os.getenv('APIKEY_2CAPTCHA', 'YOUR_API_KEY')

solver = TwoCaptcha(api_key, defaultTimeout=120, pollingInterval=5)

try:
    result = solver.canvas(
        './images/canvas.jpg',
        previousId=0,
        canSkip=0,
        lang='en',
        hintImg='./images/canvas_hint.jpg',
        hintText='Draw around apple',
        #    callback='http://127.0.0.1/test/'
    )

except Exception as e:
    sys.exit(e)

else:
    sys.exit('sent: ' + str(result))
from selenium import webdriver
from twocaptcha import TwoCaptcha
import time
from fake_useragent import UserAgent
from threading import Thread
import random
import requests
import string

solver = TwoCaptcha('f668b604d0954938b5c223f22ca1f90c')
apiKey = 'b2UOnh0HVAAljzfOLLdNvQ7uzu5gkiiMqn7h7sKcdeQv'


def tool(thread):
    invite_code_list = []
    with open('invite_code.txt', 'r') as f:
        Lines = f.readlines()
        for line in Lines:
            invite_code_list.append(line[:-1])

    for job in range(1, 100):
        try:
            ua = UserAgent()
            userAgent = ua.random

            PROXY = randomIP(API_KEY_LIST[thread])
            print("CONNECT {}".format(PROXY))

            chrome_options = webdriver.ChromeOptions()

            chrome_options.add_argument(f'user-agent={userAgent}')
Esempio n. 30
0
def get_captcha():
    solver = TwoCaptcha(CAPTCHA_API_KEY)
    params_captcha = {'lang': 'en'}
    result = solver.normal('captcha.png', **params_captcha)
    code = result['code']
    return code