Bypassing Gains Security in Gainbot: A technical breakdown

Written byCapria Value-Add
March 4, 2025

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /home/u876752588/domains/capria.vc/public_html/wp-content/plugins/jet-engine/includes/components/blocks-views/dynamic-content/manager.php on line 113

Capria Ventures - pngtree online data security system and network cyber security technology picture image 15469959

While building Gainbot to scrape the Gains website (protected by a password and Cloudflare), we tried multiple approaches:

  1. Direct Logins via requests:
    • We sent form data and credentials directly.
    • Gains still blocked these requests with 403 errors and login prompts.
  2. WordPress/Custom Form Attempts:
    • Submitting WordPress login endpoints or hidden form fields.
    • Cloudflare anti‐bot layers continued to reject the requests.
  3. Selenium (Headless Browser):
    • We attempted to replicate a real browser login flow.
    • Cloudflare’s JavaScript checks still flagged the headless session, returning “enable JavaScript and cookies” messages.
  4. The Working Solution: Session Cookies
    • Export Browser Cookies: We logged in manually via a normal browser, then used the browser’s Developer Tools to export the authenticated session cookies into a JSON file.
    • Attach Cookies to Requests: Gainbot reads these JSON cookies and adds them to every requests.get(…). The server recognizes this as a valid session, bypassing both password prompts and Cloudflare’s checks.

Outcome:

With valid cookies, Gains treats Gainbot as an authenticated user, allowing seamless scraping. This method reliably fetches articles without repeated logins or script blockers, keeping Gainbot’s daily refresh tasks and user queries fully operational.

Subscribe to GAIN Newsletter

Be the first to hear the latest investment updates, AI tech trends, and partner insights from Capria Ventures by subscribing to our monthly newsletter. 

Report a Grievance

Capria Ventures and its related entities are committed to the highest standards of ethics and strictly enforce a zero-tolerance anti-corruption policy. Please report any suspicious activity to grievance@capria.vc. All reports will be treated with utmost urgency and resolved appropriately.

Unitus Ventures is now Capria India

Unitus Ventures, a leading venture capital firm in India, is joining forces with its US affiliate Capria Ventures, a Global South specialist, to operate with a unified global strategy under a single brand, Capria Ventures. 

Chat with Capria GainBot
Hello! I'm GAINBOT, here to share interesting insights from Capria's webpages. Feel free to search for anything you'd like to learn about.