
⚙️ Prerequisites
- Proxy
- Python installed
- Capsolver API key
🤖 Step 1: Install Necessary Packages
Execute the following commands to install the required packages:
pip install capsolver
pip install requests
👨💻 Python Code for bypass imperva / incapsula / reese84 with your proxy
Here's a Python sample script to accomplish the task:
PROXY = "http://username:password@host:port"
capsolver.api_key = "Your_API_KEY"
PAGE_URL = "PAGE_URL"
REESE84_SCRIPT_URL = "reese84ScriptURL"
def solve_imperva():
solution = capsolver.solve({
"type": "AntiImpervaTask",
"websiteURL": PAGE_URL,
"proxy": PROXY,
"utmvc":True,
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
"reese84":True,
"reeseScriptUrl":REESE84_SCRIPT_URL,
})
return solution
def set_session_headers(session, user_agent=None):
headers = {
"cache-control": "max-age=0",
"sec-ch-ua": '"Not/A)Brand";v="99", "Google Chrome";v="107", "Chromium";v="107"',
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "Windows",
"upgrade-insecure-requests": "1",
"user-agent": user_agent if user_agent else "'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"sec-fetch-site": "same-origin",
"sec-fetch-mode": "navigate",
"sec-fetch-user": "?1",
"sec-fetch-dest": "document",
"accept-encoding": "gzip, deflate",
"accept-language": "en,fr-FR;q=0.9,fr;q=0.8,en-US;q=0.7"
}
session.headers.update(headers)
def main():
s = requests.Session()
set_session_headers(s)
print("Going to the page...")
response = s.get(url=PAGE_URL, proxies={"http": PROXY, "https": PROXY})
strings_to_check = ['Pardon Our Interruption', 'window.reeseSkipExpirationCheck']
any_exist = any(string in response.text for string in strings_to_check)
if(any_exist):
print("Imperva / Incapsula detected")
print("Solving Imperva / Incapsula (reese84 cookie)")
solution = solve_imperva()
print("Solution: ", solution)
parsed_url = urlparse(PAGE_URL)
domain = parsed_url.netloc
formatted_domain = f".{domain}"
new_token = solution.get("token").replace("reese84=", "")
s.cookies.set("reese84", new_token, domain=formatted_domain)
print(s.cookies.get_dict())
set_session_headers(s, user_agent=solution.get('userAgent'))
time.sleep(1)
response = s.get(url=PAGE_URL, cookies=s.cookies, proxies={"http": PROXY, "https": PROXY})
print("Status Code:")
print(response.status_code)
print(response.text)
if __name__ == "__main__":
main()
⚠️ Change these variables
- PROXY: Update with your proxy details. The format should be http://username:password@ip:port.
- capsolver.api_key: Obtain your API key from the Capsolver Dashboard.
- PAGE_URL: Replace with the URL of the website for which you wish to bypass imperva / incapsula / reese84 / utmvc.
- REESE84_SCRIPT_URL: This URL contains the js script of imperva for generate the reese84. It's obfuscated.