What you will build. A small script that finds Imperva’s sensor script on a page, fetches it, asks Roolink for the complete submission, posts it to the site, and stores the token the site hands back as a cookie. From then on the site treats your session like a browser that ran the script.
What you need. A Roolink account with an API key, a residential proxy that keeps the same IP for a session, powhttp installed, and Python, Go or Node. Imperva is plain JSON over HTTPS, so no Roolink SDK is involved; the examples call the API with your language’s standard HTTP client.
Words used on this page
Words used on this page
- Imperva (also called Incapsula, its earlier name) is the protection in front of the site. It runs a sensor script in the browser and issues a token to browsers whose results look real.
- Reese84 is the name of that sensor. The token it produces is stored in a cookie called
reese84. - The submission is the JSON body the browser posts after running the script. Roolink builds the whole thing for you.
- GPC is a small proof-of-work puzzle some sites add on top. When a site uses it, you fetch the puzzle and pass it to Roolink, which solves it while building the submission.
- UTMVC is Imperva’s other cookie challenge, older and simpler. It has its own page.
Put your API key and proxy URL in environment variables and install a TLS client for your language. Imperva fingerprints the connection like the others, so an ordinary HTTP library fails before the token matters.
Open powhttp, start recording, and load your target page in Chrome. You will copy the headers for the page load, the script load and the submission post from that recording.
Request the page with the document headers from your recording. The response may be the real page or an interstitial that says “Pardon Our Interruption”; either way it contains the sensor script’s URL, in one of two shapes. On most sites it is a plain <script src="/…"> tag with a random-looking path. On sites that show the interstitial, a small loader assigns it in JavaScript as scriptElement.src = "…". Resolve whichever you find against the page URL.
You should see one script URL on the page’s own host. Its path is fixed per site but looks like noise.
Download the script through the same session with the script headers from your recording, and keep the body exactly as received.
Then ask the site whether it wants a proof of work. Post the four characters {"f":"gpc"} to the script URL with ?d=<page host> appended, as text/plain;charset=UTF-8. The reply is a JSON string. If it is empty, the site does not use GPC. If it is not, it is the puzzle, base64-encoded; keep it as is. You will hand it to Roolink, which solves it for you.
You should see a script body of some tens of kilobytes, and either "" or a long base64 string from the GPC request.
Send Roolink the script body, the script URL, the page URL and, if you got one, the puzzle as pow. Roolink returns the complete submission body: a JSON object with solution, old_token, error, errors and performance. You do not need to look inside it.
Roolink emulates a real Chrome on macOS for this product, so the headers you send the site should describe the same browser. This call is the one that counts against your plan, whether or not it solved a puzzle.
You should see a JSON object whose solution.interrogation.p is a long encoded string.
Post the submission, unchanged, to the script URL with ?d=<script host> appended, as text/plain;charset=utf-8, with the page as referer and the site as origin, using the submission headers from your recording. The site answers with JSON containing a token, a renewInSec count and a cookieDomain.
Store the token as a cookie named reese84 on that domain and send it with every request from now on. The site will accept the session until renewInSec seconds have passed; run steps 3 to 5 again before then to get a fresh one. Some sites’ API calls also want the same token in an x-d-token header; your recording will show it if they do.
You should see a 200 with a token starting with a digit and a colon, and the page loading normally afterwards.
The complete file
Four header sets are left for you to fill from your powhttp recording: the page load, the script load, the GPC probe and the submission post. The last two are both posts to the script URL; copy each from the matching request in the recording. Their content types aretext/plain;charset=UTF-8.
If something goes wrong
No script URL in the page
No script URL in the page
?d=…; the same URL without the query string is the script.Roolink answers 422
Roolink answers 422
error message names the cause. pageUrl must be an absolute HTTPS URL; script must be the untouched body; pow must be the raw string from the GPC reply, not something you decoded. An unsupported script build also returns 422; bring the script URL to Discord.The submission comes back without a token
The submission comes back without a token
?d= set to the script’s host, as text/plain;charset=utf-8, with the headers from your recording, through the same session that loaded the page. If the site uses GPC, confirm you passed the puzzle to Roolink rather than posting without it.The page loads once, then blocks again after a while
The page loads once, then blocks again after a while
renewInSec elapses by repeating steps 3 to 5 in the same session.Next steps
x-d-token header.___utmvc from the Incapsula script and activate it.