Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Cloudflare issue #6

Closed
BooBooKittyFck opened this issue Dec 11, 2022 · 10 comments
Closed

Cloudflare issue #6

BooBooKittyFck opened this issue Dec 11, 2022 · 10 comments

Comments

@BooBooKittyFck
Copy link

Hello Terry
Thanks for your work - it seemed like they now using Cloudflare any chance you could do a bypass or something?
Or is it just me ran into the Cloudflare issue?

</div>
            <div class="text-center">Performance &amp; security by <a rel="noopener noreferrer" href="https://www.cloudflare.com?utm_source=challenge&utm_campaign=m" target="_blank">Cloudflare</a></div>
        </div>
    </div>
</body>
</html>
@magicmars35
Copy link

magicmars35 commented Dec 11, 2022

They just added a challenge at the main page :
I believe all unofficial APIs are now down ...

`

<title>Just a moment...</title>

chat.openai.com

Checking if the site connection is secure

Enable JavaScript and cookies to continue
chat.openai.com needs to review the security of your connection before proceeding.
<script> (function(){ window._cf_chl_opt={ cvId: '2', cType: 'managed', cNounce: '35957', cRay: '77816379cc6722a3', cHash: '96ffa234eb3a409', cUPMDTk: "\/api\/auth\/session?__cf_chl_tk=mgs1BQ5KlKESXXXXXXXXXXXXXXXXXXXXXX794930-0-gaNycGzNEpE", cFPWv: 'b', cTTimeMs: '1000', cTplV: 4, cTplB: 'cf', cRq: { ru: 'aHR0cHM6Ly9jaGF0Lm9wZW5haS5jb2XXXXXXXXXXXXXXXXXXXXVzc2lvbg==', ra: 'TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXwNy4wLjAuMCBTYWZhcmkvNTM3LjM2IEVkZy8xMDcuMC4xNDE4LjYy', rm: 'R0VU', d: 'KufDIwHzPls+2diuK5QVcaCCerde9UWH7IgMBN3lwfsd4oaT0WhDZXXXXXXXXXXXXXXXXXXXXXXXXXXXeh4JDltOmIZAYn0hX2pJ2BYI4oM7MeEF7jCPkkJs+Y5qrXT0DJaXRxkPhUhkY5rAK7G6L8I613PwZ1T6ym5YF47zHtGV6mMJbwm2gL5TST9BcPTkhz5htm7TGMpAGTCiX3FBPjUDGDIJxM2QK80woSDLxfvTIGVRBSz9mnp97vY6dzUvSXv0Yz4w8g1qDsF7x8Z6bnCDdfRJCgGLKfZPd9IYr9xcga1/wcx5ZzbDcynC4NVym6h7P3dMrtXF+BzNSM3Cz69bxpixkd49MmhoKvix3O1T2WSeNPdg7y9+UR3zJtyDHv7J4LRIV9IqNfRVqpCrovM4nCLOm4uHVCaTa/cWsP2xaX0ieRA8ZvgVzrG+Kq5FoNeSSO1+vZmtmIDkewKUDtHhToQyh6wnaPZtYEJV5APKm4L5S3WATqV/JXLw3WMfewrxbGQt0ahaZdNEQCLJc3JtgQgih0gsirYXMWuGDW7Affr1d7NyEgtjEcCGUmenB+4f006I6Tu83jm9eus3CDssKiRW5h', t: 'MTY3MDcXXXXXXXXXXDgwMDA=', m: '6HExaW7cS4o262fnzyVoXXXXXXXXXXXXXXX8cNCgDbAsaoY=', i1: 'r0WsKCon3RXXXXXXXXXXZ15Q==', i2: 'gB0guPr9JXXXXXXXXXXX5Mw==', zh: 'iuyN59AGNgeBFFXXXXXXXXCyd1dJnIVFAc=', uh: 'r8ReuYYD4T8V2FXXXXXXXXXXLL7XD565cQk=', hh: 'foaWmAUHGGlVCZaNUJIHhxzxFNzSPNnVe6rJjiQw728=', } }; var trkjs = document.createElement('img'); trkjs.setAttribute('src', '/cdn-cgi/images/trace/managed/js/transparent.gif?ray=77816379cc6722a3'); trkjs.setAttribute('style', 'display: none'); document.body.appendChild(trkjs); var cpo = document.createElement('script'); cpo.src = '/cdn-cgi/challenge-platform/h/b/orchestrate/managed/v1?ray=77816379cc6722a3'; window._cf_chl_opt.cOgUHash = location.hash === '' && location.href.indexOf('#') !== -1 ? '#' : location.hash; window._cf_chl_opt.cOgUQuery = location.search === '' && location.href.slice(0, -window._cf_chl_opt.cOgUHash.length).indexOf('?') !== -1 ? '?' : location.search; if (window.history && window.history.replaceState) { var ogU = location.pathname + window._cf_chl_opt.cOgUQuery + window._cf_chl_opt.cOgUHash; history.replaceState(null, null, "\/api\/auth\/session?__cf_chl_rt_tk=mgs1BQ5KlKESJXiyWb4j0yLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXycGzNEpE" + window._cf_chl_opt.cOgUHash); cpo.onload = function() { history.replaceState(null, null, ogU); }; } document.getElementsByTagName('head')[0].appendChild(cpo); }()); </script>
<div class="footer" role="contentinfo">
    <div class="footer-inner">
        <div class="clearfix diagnostic-wrapper">
            <div class="ray-id">Ray ID: <code>77816379cc6722a3</code></div>
        </div>
        <div class="text-center">Performance &amp; security by <a rel="noopener noreferrer" href="https://www.cloudflare.com?utm_source=challenge&utm_campaign=m" target="_blank">Cloudflare</a></div>
    </div>
</div>
`

@fffiloni
Copy link

as reported here

It's to do with and their (new) cloudflare hCaptcha implementation. Once you pass the security check, the browser stores a cf_clearance cookie which has a 1-year expiration. If this cookie is missing, even if you have a valid session/access token you will need to pass the security check again before accessing the website.

@fffiloni
Copy link

see also this issue to follow the ongoing discussions on solutions

@terry3041
Copy link
Owner

Hi. A temporary bypass using undetected_chromedriver is added to the new release v0.2.0.
This library now requires a Chrome installation. Please check and let me know if you have any questions.

@BooBooKittyFck
Copy link
Author

Hi. A temporary bypass using undetected_chromedriver is added to the new release v0.2.0. This library now requires a Chrome installation. Please check and let me know if you have any questions.

Works fine - only thing that would be lovely is when it would close the browser afterwards.
When i call it via my bot it let the browser stay open.

@terry3041
Copy link
Owner

Hi. A temporary bypass using undetected_chromedriver is added to the new release v0.2.0. This library now requires a Chrome installation. Please check and let me know if you have any questions.

Works fine - only thing that would be lovely is when it would close the browser afterwards. When i call it via my bot it let the browser stay open.

Unfortunately, the browser window is required as Cloudflare will detect headless browser and the bypass will not work.

@BooBooKittyFck
Copy link
Author

Hi. A temporary bypass using undetected_chromedriver is added to the new release v0.2.0. This library now requires a Chrome installation. Please check and let me know if you have any questions.

Works fine - only thing that would be lovely is when it would close the browser afterwards. When i call it via my bot it let the browser stay open.

Unfortunately, the browser window is required as Cloudflare will detect headless browser and the bypass will not work.

I mean after the whole process is finished - the browser still stays open i mean something like self.driver.quit() after everything is done

@terry3041
Copy link
Owner

terry3041 commented Dec 12, 2022

I mean after the whole process is finished - the browser still stays open i mean something like self.driver.quit() after everything is done

That is achievable. But as we are ensuring auth when using send_message(), it means that we are going to init a new browser instance every time. That may be a little bit time consuming.
But if you dont mind, I can change that in the code.

self.refresh_auth()

@BooBooKittyFck
Copy link
Author

I mean after the whole process is finished - the browser still stays open i mean something like self.driver.quit() after everything is done

That is achievable. But as we are ensuring auth every time when sending message, it means that we are going to init a new browser instance when using send_message(). That may be a little bit time consuming. But if you dont mind, I can change that in the code.

self.refresh_auth()

I just added self.driver.quit() in line 150 before it returns the msg - that will close the browser everytime and reopen a new session when i ask a new question ( actual use it in a discord bot )
Thanks alot for supporting terry!

@terry3041
Copy link
Owner

terry3041 commented Dec 12, 2022

I just added self.driver.quit() in line 150 before it returns the msg - that will close the browser everytime and reopen a new session when i ask a new question ( actual use it in a discord bot ) Thanks alot for supporting terry!

I have pushed version v0.2.3 to reduce the browser pop-up frequency. Please have a look and let me know if you have any questions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants