使用Python请求dtek-kem.com.ua遭Imperva拦截,请求失败排查
问题:使用aiohttp请求带Imperva防护的站点返回Incapsula拦截响应
我尝试获取dtek-kem.com.ua/ua/shutdowns页面的停机列表,但用Python的aiohttp发送GET请求时,收到「请求失败,Incapsula incident ID: ...」的拦截响应,已知该站点采用Imperva安全防护。
发送的请求头
method='GET' Host: www.dtek-kem.com.ua 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.9 accept-encoding: gzip, deflate, br accept-language: en,ru;q=0.9,uk;q=0.8,en-US;q=0.7 user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 cache-control: max-age=0 sec-ch-ua: "Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "Windows" sec-fetch-dest: document sec-fetch-mode: navigate sec-fetch-site: same-origin sec-fetch-user: ?1 upgrade-insecure-requests: 1
收到的拦截响应
响应头
https://www.dtek-kem.com.ua/ua/shutdowns [200 OK] Content-Type: text/html Cache-Control: no-cache, no-store Connection: close Content-Length: 899 X-Iinfo: 4-43048402-0 0NNN RT(1670585645218 54) q(0 -1 -1 -1) r(0 -1) B12(4,316,0) U2 Strict-Transport-Security: max-age=31536000; includeSubDomains Set-Cookie: incap_ses_287_2224657=4b9AWuO2/2fTOuVPWqH7Ay0dk2MAAAAAtnXLv3+84L80QP1nTKP8Fg==; Domain=dtek-kem.com.ua; Path=/; SameSite=None; Secure Set-Cookie: visid_incap_2224657=OOVTSrqKRCeH0QB7kzrgIC0dk2MAAAAAQUIPAAAAAAB47Nowjvq7LxL76cUkJG0a; Domain=dtek-kem.com.ua; expires=Fri, 08 Dec 2023 22:17:56 GMT; HttpOnly; Path=/; SameSite=None; Secure
返回的HTML内容
<html style="height:100%"> <head> <meta content="NOINDEX, NOFOLLOW" name="ROBOTS"/> <meta content="telephone=no" name="format-detection"/> <meta content="initial-scale=1.0" name="viewport"/> <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"/> <script async="" src="/Physicken-Like-my-Hath-I-haue-ster-Banq-All-bids"> </script> </head> <body style="margin:0px;height:100%"> <iframe frameborder="0" height="100%" id="main-iframe" marginheight="0px" marginwidth="0px" src="/_Incapsula_Resource?SWUDNSAI=31&xinfo=4-43048402-0%200NNN%20RT%281670585645218%2054%29%20q%280%20-1%20-1%20-1%29%20r%280%20-1%29%20B12%284%2c316%2c0%29%20U2&incident_id=287000410527500428-206407667178998340&edet=12&cinfo=04000000&rpinfo=0&cts=swfgpEczXy9hSsxHaaLf43gsGYhnGBhKA1jABnA0Ljuov3FUOG0mGjfE6li1tAg6&mth=GET" width="100%"> Request unsuccessful. Incapsula incident ID: 287000410527500428-206407667178998340 </iframe> </body> </html>
浏览器正常请求的响应
access-control-allow-credentials: true access-control-allow-credentials: true access-control-allow-headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type access-control-allow-headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type access-control-allow-methods: GET, POST, OPTIONS access-control-allow-methods: GET, POST, OPTIONS access-control-allow-origin: https://admin.dtek-kem.com.ua cache-control: no-store, no-cache, must-revalidate cache-control: max-age=900 cache-control: public, max-age=900 cache-control: no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0 content-encoding: gzip content-type: text/html; charset=UTF-8 date: Fri, 09 Dec 2022 12:02:38 GMT expect-ct: enforce; max-age=3600 expect-ct: enforce; max-age=3600 expires: Thu, 19 Nov 1981 08:52:00 GMT pragma: no-cache referrer-policy: strict-origin-when-cross-origin server: nginx path=/; secure; secure; HttpOnly status: 200 httpVersion: http/2.0 cookies: [{'name': 'dtek-kem', 'value': '0mspqled433d6pq7t9q9ttcjos'}, {'name': '_csrf-dtek-kem', 'value': '0957f055f621ade8b7c6a5136201e0081a1579972aa33443a65646c44afeb161a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-dtek-kem%22%3Bi%3A1%3Bs%3A32%3A%22aJodoGWonH3u7fdI7jVzex4n6yBPZ9qX%22%3B%7D'}, {'name': 'Domain', 'value': 'dtek-kem.com.ua'}, {'name': 'incap_wrt_356', 'value': '3iOTYwAAAAA3Gkt0FwAI5AIQxJuq1AEYicrMnAYgAijdx8ycBknxuwb65PIpngUwOmGF+xE='}] content: {'size': 635168, 'mimeType': 'text/html'}
疑问
我完全从浏览器网络面板复制了发送给服务器的首个请求头,但服务器返回的响应和浏览器请求的响应完全不同。难道服务器没收到完全相同的请求?我是需要深入研究Imperva防火墙的绕过方法,还是遗漏了什么细节?
内容的提问来源于stack exchange,提问作者f211
相关产品推荐
相关产品推荐

