当前位置: 首页 > news >正文

怎样安全做黑色彩票网站武昌网站建设的公司

怎样安全做黑色彩票网站,武昌网站建设的公司,沈阳seo排名优化软件,怎么删除一个wordpress验证码处理 学习目标 了解 验证码的相关知识掌握 图片识别引擎的使用了解 常见的打码平台掌握 通过打码平台处理验证码的方法 1.图片验证码 1.1 什么是图片验证码 验证码#xff08;CAPTCHA#xff09;是“Completely Automated Public Turing test to tell Computers an…验证码处理 学习目标 了解 验证码的相关知识掌握 图片识别引擎的使用了解 常见的打码平台掌握 通过打码平台处理验证码的方法 1.图片验证码 1.1 什么是图片验证码 验证码CAPTCHA是“Completely Automated Public Turing test to tell Computers and Humans Apart”全自动区分计算机和人类的图灵测试的缩写是一种区分用户是计算机还是人的公共全自动程序。 1.2 验证码的作用 防止恶意破解密码、刷票、论坛灌水、刷页。有效防止某个黑客对某一个特定注册用户用特定程序暴力破解方式进行不断的登录尝试实际上使用验证码是现在很多网站通行的方式比如招商银行的网上个人银行百度社区我们利用比较简易的方式实现了这个功能。虽然登录麻烦一点但是对网友的密码安全来说这个功能还是很有必要也很重要。 1.3 图片验证码在爬虫中的使用场景 注册登录频繁发送请求时服务器弹出验证码进行验证 1.4 图片验证码的处理方案 手动输入(input) 这种方法仅限于登录一次就可持续使用的情况图像识别引擎解析 使用光学识别引擎处理图片中的数据目前常用于图片数据提取较少用于验证码处理打码平台 爬虫常用的验证码解决方案 2.图片识别引擎 OCROptical Character Recognition是指使用扫描仪或数码相机对文本资料进行扫描成图像文件然后对图像文件进行分析处理自动识别获取文字信息及版面信息的软件。 2.1 什么是tesseract Tesseract一款由HP实验室开发由Google维护的开源OCR引擎特点是开源免费支持多语言多平台。项目地址https://github.com/tesseract-ocr/tesseract下载地址https://digi.bib.uni-mannheim.de/tesseract/参考博文https://blog.csdn.net/jacke121/article/details/76038663 2.2 图片识别引擎环境的安装 1 引擎的安装 mac环境下直接执行命令 brew install --with-training-tools tesseractwindows环境下的安装 可以通过exe安装包安装下载地址可以从GitHub项目中的wiki找到。安装完成后记得将Tesseract 执行文件的目录加入到PATH中方便后续调用。 linux环境下的安装 sudo apt-get install tesseract-ocr2 Python库的安装 # PIL用于打开图片文件 pip/pip3 install pillow# pytesseract模块用于从图片中解析数据 pip/pip3 install pytesseract2.3 图片识别引擎的使用 通过pytesseract模块的 image_to_string 方法就能将打开的图片文件中的数据提取成字符串数据具体方法如下 from PIL import Image import pytesseract# 打开一个图片文件 im Image.open(test2.png)result2 pytesseract.image_to_string(im)print(result2)2.4 图片识别引擎的使用扩展 tesseract简单使用与训练其他ocr平台 微软Azure 图像识别[https://azure.microsoft.com/zh-cn/services/cognitive-services/computer-vision/](https://azure.microsoft.com/zh-cn/services/cognitive-services/computer-vision/)有道智云文字识别[http://aidemo.youdao.com/ocrdemo](http://aidemo.youdao.com/ocrdemo)阿里云图文识别[https://www.aliyun.com/product/cdi/](https://www.aliyun.com/product/cdi/)腾讯OCR文字识别[https://cloud.tencent.com/product/ocr](https://cloud.tencent.com/product/ocr)3 打码平台 1.为什么需要了解打码平台的使用 现在很多网站都会使用验证码来进行反爬所以为了能够更好的获取数据需要了解如何使用打码平台爬虫中的验证码 2 常见的打码平台 云打码http://www.yundama.com/ 能够解决通用的验证码识别 极验验证码智能识别辅助http://jiyandoc.c2567.com/ 能够解决复杂验证码的识别 3 云打码的使用 下面以云打码为例了解打码平台如何使用 3.1 云打码官方接口 下面代码是云打码平台提供做了个简单修改实现了两个方法 indetify:传入图片的响应二进制数即可indetify_by_filepath:传入图片的路径即可识别 其中需要自己配置的地方是 username whoarewe # 用户名password *** # 密码appid 4283 # appidappkey 02074c64f0d0bb9efb2df455537b01c3 # appkeycodetype 1004 # 验证码类型云打码官方提供的api如下 #yundama.py import requests import json import timeclass YDMHttp:apiurl http://api.yundama.com/api.phpusername password appid appkey def __init__(self, username, password, appid, appkey):self.username usernameself.password passwordself.appid str(appid)self.appkey appkeydef request(self, fields, files[]):response self.post_url(self.apiurl, fields, files)response json.loads(response)return responsedef balance(self):data {method: balance, username: self.username, password: self.password, appid: self.appid,appkey: self.appkey}response self.request(data)if (response):if (response[ret] and response[ret] 0):return response[ret]else:return response[balance]else:return -9001def login(self):data {method: login, username: self.username, password: self.password, appid: self.appid,appkey: self.appkey}response self.request(data)if (response):if (response[ret] and response[ret] 0):return response[ret]else:return response[uid]else:return -9001def upload(self, filename, codetype, timeout):data {method: upload, username: self.username, password: self.password, appid: self.appid,appkey: self.appkey, codetype: str(codetype), timeout: str(timeout)}file {file: filename}response self.request(data, file)if (response):if (response[ret] and response[ret] 0):return response[ret]else:return response[cid]else:return -9001def result(self, cid):data {method: result, username: self.username, password: self.password, appid: self.appid,appkey: self.appkey, cid: str(cid)}response self.request(data)return response and response[text] or def decode(self, filename, codetype, timeout):cid self.upload(filename, codetype, timeout)if (cid 0):for i in range(0, timeout):result self.result(cid)if (result ! ):return cid, resultelse:time.sleep(1)return -3003, else:return cid, def post_url(self, url, fields, files[]):# for key in files:# files[key] open(files[key], rb);res requests.post(url, filesfiles, datafields)return res.text username whoarewe # 用户名password *** # 密码appid 4283 # appidappkey 02074c64f0d0bb9efb2df455537b01c3 # appkeyfilename getimage.jpg # 文件位置codetype 1004 # 验证码类型# 超时 timeout 60def indetify(response_content):if (username username):print(请设置好相关参数再测试)else:# 初始化yundama YDMHttp(username, password, appid, appkey)# 登陆云打码uid yundama.login();print(uid: %s % uid)# 查询余额balance yundama.balance();print(balance: %s % balance)# 开始识别图片路径验证码类型ID超时时间秒识别结果cid, result yundama.decode(response_content, codetype, timeout)print(cid: %s, result: %s % (cid, result))return resultdef indetify_by_filepath(file_path):if (username username):print(请设置好相关参数再测试)else:# 初始化yundama YDMHttp(username, password, appid, appkey)# 登陆云打码uid yundama.login();print(uid: %s % uid)# 查询余额balance yundama.balance();print(balance: %s % balance)# 开始识别图片路径验证码类型ID超时时间秒识别结果cid, result yundama.decode(file_path, codetype, timeout)print(cid: %s, result: %s % (cid, result))return resultif __name__ __main__:pass4 常见的验证码的种类 4.1 url地址不变验证码不变 这是验证码里面非常简单的一种类型对应的只需要获取验证码的地址然后请求通过打码平台识别即可 4.2 url地址不变验证码变化 这种验证码的类型是更加常见的一种类型对于这种验证码大家需要思考 在登录的过程中假设我输入的验证码是对的对方服务器是如何判断当前我输入的验证码是显示在我屏幕上的验证码而不是其他的验证码呢 在获取网页的时候请求验证码以及提交验证码的时候对方服务器肯定通过了某种手段验证我之前获取的验证码和最后提交的验证码是同一个验证码那这个手段是什么手段呢 很明显就是通过cookie来实现的所以对应的在请求页面请求验证码提交验证码的到时候需要保证cookie的一致性对此可以使用requests.session来解决 小结 了解 验证码的相关知识掌握 图片识别引擎的使用了解 常见的打码平台掌握 通过打码平台处理验证码的方法
http://www.sadfv.cn/news/292490/

相关文章:

  • 做外贸有哪些好的网站有哪些简答网站内容建设的时候内链重要性
  • 博罗网站建设哪家便宜python编程软件用哪个
  • 备案 网站名称 重复wordpress上不去了
  • 宜昌网站建设平台html5手机网站案例
  • 湖南网站建设 尖端磐石网络网站设计师 要求
  • 包装东莞网站建设0769网架公司招聘施工队伍
  • 南昌制作网站的公司网站开发职责
  • 河南洛阳网站建设京东商城在线网上购物
  • dede网站如何做中英文版本商业网站建设视频教程
  • 商城网站建设哪家便宜创建博客网站
  • 济源建设网站网页设计与制作实训室厂家
  • 网站福利你们会回来感谢我的做网站和微信小程序
  • 专业网站建设专业网站设计网页动画设计培训
  • 英文网站seo如何做微信公众号文章编辑wordpress
  • 自考本科条件湛江seo
  • 营销型网站的网址天津百度网站快速排名
  • 胶州建网站wordpress播放器样式
  • 网站开发开发优势wordpress怎么做伪静态页面
  • 阿里云建网站流程苏州市市政建设集团公司网站
  • 京东第一次做网站做网站价格表
  • 网站审核时间网站傻瓜式建设
  • 广西南宁网站公司免费软件英文
  • 专题研究网站建设工作动态400网站总机 阿里云
  • asp网站安全吗wordpress做的企业官网
  • 建个什么网站吗企业支付宝登录入口
  • 唐山seo设计网站网页设计公司兴田德润在哪儿
  • 有哪些可以免费推广的网站宁波最专业的seo公司
  • 高端网站建设费用预算汕头网站搭建多少钱
  • 赣州专业网站推广怎么在自己的网站上做漂浮链接
  • tp框架做响应式网站直播网站开发步骤