8

一日一技:【最新】再次突破CloudFlare五秒盾付费版

 1 year ago
source link: https://www.kingname.info/2023/02/25/crack-cf-2/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

一日一技:【最新】再次突破CloudFlare五秒盾付费版

2023-02-25

18

370

1 分钟

去年我写了一篇文章:一日一技:如何捅穿Cloud Flare的5秒盾 ,这篇文章使用的第三方库『cloudscraper』可以绕过免费版的五秒盾。但遇到付费版就无能为力了。

最近在爬币圈的网站,其中有一个网站叫做:Codebase使用的就是付费版的CloudFlare五秒盾。当我们使用CloudScraper去爬时,报错如下:

20230225100842.png

那么现阶段,付费版的CloudFlare五秒盾,有没有什么办法绕过呢?其实方法非常简单。只需要使用Docker运行一个容器就可以了。启动命令为:

docker run -d \
--name=flaresolverr \
-p 8191:8191 \
-e LOG_LEVEL=info \
--restart unless-stopped \
ghcr.io/flaresolverr/flaresolverr:latest

这个容器启动以后,会开启8191端口。我们通过往这个端口发送http请求,让他转发请求给目标网站,就可以绕过五秒盾。

具体使用示例:

import requests
import json

url = "http://localhost:8191/v1"

payload = json.dumps({
"cmd": "request.get",
"url": "https://www.coinbase.com/ventures/content",
"maxTimeout": 60000
})
headers = {
'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, data=payload)

# 这个Docker镜像启动的接口,返回的数据是JOSN,网页源代码在其中的.solution.response中
print(response.json()['solution']['response'])

访问效果如下图所示:

20230225101520.png

我们再写几行代码来提取一下标题:

20230225104136.png

我们启动的这个容器,为什么可以绕过CloudFlare的五秒盾呢,关键原因就在这个项目中:FlareSolverr。大家可以阅读他的源代码,看看他是怎么绕过的。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK