您当前的位置:首页 > IT编程 > python
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:python实现腾讯滑块验证码识别

51自学网 2021-10-30 22:43:16
  python
这篇教程python实现腾讯滑块验证码识别写得很实用,希望能帮到您。

腾讯滑块验证码识别,识别凹槽的x轴位置,mock滑块的加速度。该项目公开API,提供识别和加速度模拟部分,第二部分模拟滑动进行识别返回数据请求

项目地址:https://github.com/zhaojunlike/python-tecent-slider-crack

安装python环境

参考:https://janikarhunen.fi/how-to-install-python-3-6-1-on-centos-7

sudo yum install https://centos7.iuscommunity.org/ius-release.rpmsudo yum install python36upython3.6 -Vsudo yum install python36u-pipsudo yum install python36u-devel

创建环境 Creating a virtualenv

python3.6 -m venv venv. venv/bin/activatepip install [package_name]# 安装依赖pip install -r requirements.txt 

daemonize 运行

# 参考 https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uswgi-and-nginx-on-ubuntu-18-04# Install the latest stable release:pip install uwsgi# ... or if you want to install the latest LTS (long term support) release,pip install https://projects.unbit.it/downloads/uwsgi-lts.tar.gz# 创建ln cp captcha.service /etc/systemd/system/captcha.servicesystemctl enable captcha.servicesystemctl start captcha.service
uwsgi --ini /usr/local/nginx/html/myblog/uwsgiconfig.ini#后台运行uwsgi --ini /usr/local/nginx/html/myblog/uwsgiconfig.ini --daemonize /usr/local/nginx/html/myblog/myblog.out

nginx做代理

        location /tx/ {            add_header Access-Control-Allow-Origin *;            include        uwsgi_params;            uwsgi_pass     127.0.0.1:8008;        }

访问api

请求图片识别和加速度模拟

http://127.0.0.1:5000/tx/imagePOST /tx/image HTTP/1.1Host:hostContent-Type: application/jsonAccept: */*Cache-Control: no-cacheAccept-Encoding: gzip, deflateContent-Length: 1055Connection: keep-alivecache-control: no-cache{    "url": "图片的地址"}返回数据{    "data": {        "list": [],//模拟的点        "url": "",//图片地址        "x": 515,// x轴的偏移量    },    "message": "解析成功"}

模拟浏览器移动

            const slider = {width: 680, point: 0, move: 0, steps: 0, posX: 0};//原本的高度            //开始计算移动的距离            slider.point = bgSize.width / slider.width * x;            slider.move = handle.x + slider.point - 5;            slider.steps = Math.random() * 100 / 30 + 100;            slider.posX = handle.x + handle.width / 2;            logger.info(`开始识别和移动滑块`, slider);            //滑块的位置            await page.mouse.move(slider.posX, handle.y + handle.height / 3, {steps: slider.steps});            await page.mouse.down();            let val = handle.x;            for (let i = 0; i < traces.length; i++) {                val += bgSize.width / slider.width * (traces[i]);//缩放距离                slider.move = val;                if (val <= slider.posX) continue;                await page.mouse.move(slider.move, handle.y + handle.height / 2 + 5);            }            await page.waitFor(100);            await page.mouse.up();

验证码识别成功后悔返回验证识别结果的Ticket

协议

授权协议:只允许研究、学习目的的分享、使用、修改,不允许任何商业用途。

原文地址:https://segmentfault.com/a/1190000020618430

以上就是python实现腾讯滑块验证码识别的详细内容,更多关于python 滑块验证码识别的资料请关注51zixue.net其它相关文章!


python实现调用摄像头并拍照发邮箱
Python爬虫框架-scrapy的使用
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。