undetected-chromedriver icon indicating copy to clipboard operation
undetected-chromedriver copied to clipboard

Detected by PerimeterX

Open tkjonesy opened this issue 2 years ago • 6 comments

I feel like I've tried everything but I keep getting detected on the psa cert website https://www.psacard.com/cert/ when I try to verify a psa certification number. I tried to randomly navigate around the page before using the search bar, using the search bar on different pages, typing the search content one character at a time, and so much more. I'm using rotating proxies and it worked for a little but it now detects me every time. Here's the Code:

import undetected_chromedriver as uc

class ProxyExtension:                   # Proxy setup
    manifest_json = """
    {
        "version": "1.0.0",
        "manifest_version": 2,
        "name": "Chrome Proxy",
        "permissions": [
            "proxy",
            "tabs",
            "unlimitedStorage",
            "storage",
            "<all_urls>",
            "webRequest",
            "webRequestBlocking"
        ],
        "background": {"scripts": ["background.js"]},
        "minimum_chrome_version": "76.0.0"
    }
    """

    background_js = """
    var config = {
        mode: "fixed_servers",
        rules: {
            singleProxy: {
                scheme: "http",
                host: "%s",
                port: %d
            },
            bypassList: ["localhost"]
        }
    };

    chrome.proxy.settings.set({value: config, scope: "regular"}, function() {});

    function callbackFn(details) {
        return {
            authCredentials: {
                username: "%s",
                password: "%s"
            }
        };
    }

    chrome.webRequest.onAuthRequired.addListener(
        callbackFn,
        { urls: ["<all_urls>"] },
        ['blocking']
    );
    """

    def __init__(self, host, port, user, password):
        self._dir = os.path.normpath(tempfile.mkdtemp())

        manifest_file = os.path.join(self._dir, "manifest.json")
        with open(manifest_file, mode="w") as f:
            f.write(self.manifest_json)

        background_js = self.background_js % (host, port, user, password)
        background_file = os.path.join(self._dir, "background.js")
        with open(background_file, mode="w") as f:
            f.write(background_js)

    @property
    def directory(self):
        return self._dir

    def __del__(self):
        shutil.rmtree(self._dir)


def browser_open():
    proxy = ("p.webshare.io", 80, user, pass)  # Auth for proxy
    proxy_extension = ProxyExtension(*proxy)

    options = uc.ChromeOptions()
    options.add_argument(f"--load-extension={proxy_extension.directory}")
    options.add_argument('--start-maximized')
    driver = uc.Chrome(options=options)
    return driver

browser_open()
driver.get('https://www.psacard.com/')
main = driver.find_element(By.ID, 'mainContent')
searchbar = main.find_element(By.TAG_NAME, 'input')
time.sleep(random.uniform(1, 2))
searchbar.send_keys(psanum)
searchbar.send_keys(Keys.ENTER)

tkjonesy avatar Jul 10 '22 00:07 tkjonesy

Same happend to me after a few clicks i got this. image

JvB94 avatar Sep 01 '22 12:09 JvB94

Yeah I'm lost at what to do, I feel like I've tried everything. I even mimicked human mouse movement... still nothing :(

tkjonesy avatar Sep 01 '22 13:09 tkjonesy

I guess it's not the mouse movement... Is for you the captcha also unsolvable?

JvB94 avatar Sep 01 '22 13:09 JvB94

when I first started, even with me solving it personally it never made it past that page. Once I added all the human mimicking stuff, I could solve the captcha myself

tkjonesy avatar Sep 01 '22 13:09 tkjonesy

can you show me which kind of mouse movement you add?

JvB94 avatar Sep 01 '22 13:09 JvB94

I used a library called HLISA: https://github.com/droefs/HLISA

tkjonesy avatar Sep 01 '22 14:09 tkjonesy