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.rpm sudo yum install python36u python3.6 -V sudo yum install python36u-pip sudo yum install python36u-devel
創建環境 Creating a virtualenv
python3.6 -m venv venv . venv/bin/activate pip 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.service systemctl enable captcha.service systemctl 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/image POST /tx/image HTTP/1.1 Host:host Content-Type: application/json Accept: */* Cache-Control: no-cache Accept-Encoding: gzip, deflate Content-Length: 1055 Connection: keep-alive cache-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 滑塊驗證碼識別的資料請關註WalkonNet其它相關文章!
推薦閱讀:
- 部署django項目安裝uwsgi出錯的解決方法總結
- 一文教會你用nginx+uwsgi部署自己的django項目
- centos+nginx+uwsgi部署django項目上線
- 教你如何快速在CentOS7中安裝Nginx
- Centos環境部署django項目的全過程(永久復用)