也来聊聊滑块验证码的那些事

news2024/10/6 8:31:37

单位做攻防演习,我扮演攻击方尝试破解。发现滑块验证码做了升级,比之前复杂了很多。好在仍然是一维验证,不用太麻烦。

https接口里读出的是json对象,先从对象里取出图片转的base64编码,然后把字符串转回成numpy.ndarray。这里我转了彩色图和灰度图两种,灰度图是为了下一步识别其中缺口用;彩色图是为了找到缺口后验证是否正确用。正式开始攻击时就不再转彩色图了。

"params": {
    "Image": "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAA0JCgsKCA0LCgsODg0PEyAVExISEyccHhcgLikxMC4pLSwzOko+MzZGNywtQFdBRkxOUlNSMj5aYVpQYEpRUk//2wBDAQ4ODhMREyYVFSZPNS01T09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0//wAARCAC+AfQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwC5LqslzN9ntvurVq3RYvvfO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ZIY50+dMfSsbVtKhG94j5b+oH/16qNRy+JAZPm7XqVPm31mlnL8mp0nbf0FXJAX0fanzVCzr91qjyfWtCKwLDLyZP0NSMpqah3bk2r96tJrWL3oeOIL5gU49KdwMmKFtj7qGG6tUQKWUknI6UyWBfMzk5quYRgylmqFVatC8t0jm+QkVcs9JWZfMMuB6AVpzaEGFsZXp6NXVL4fsz1aT86uWWiacr/6gP/vE1EqyDlOPQ7qtRJCTvljUn3Ga7o6PZGHm3i/75ridZto7G+kWIkoOgNTGqpDJv9CiTc8Mf/fIpqyxyf6q0iX6oKistMlvPvSon4E10Nn4dgRP30zt9AKUrIDGMCFsmJf++BTRbQM2CkbN7KK6+DSbAPxEz/75NaMCW8P+rt41+iisfadkVY4+08OXN0N0dusaf3nAFbMfhSAwqt7LEdvXyogP1rcV5G++c01JfN/hAqJSmFiO10nSLSLbFYROfWRATVyL7La7vs8EUW7rsQLn8qjX+OkT977Vm3LqSPlv9qfKlNS/3O67/u/eqlc/I7LHw56tVGGYmZcgbx09KCuVHQpd7vm/honu1Z9q7Kp225gDhCT1zVW8DrN0QfSgXKi+tzGv3n/76qbzI3+ZX31z80xD8gD6Vat5JSnLCgfKjUWTd8uypU/2qpRSHyU+ZqkjmI6AUEFuq9/Yx3ls8Mnzq1TqnGdq5pWAqogeTeIdBm0u5+5vgb7rVi7a9nurSO9gaO4AaM9RivN9b0UWN26xSZT0Nd9Ko5aSQmYyVct4mlfatVFrV0Xm7TNXLYcTodN8JwsiST/OzVv2Fjb2b/uERNv3pNtWbWMrbDY2M9akUB3UEbUHQLXBOcnuUTWs29Pl+7/6FU+/b/HVNHkaXc7ZT+7Ur/crImRZWVWp+azQzh+DU8csh6mgRbopuT60VQH/2Q==",
    "height": "109"
}
def str2Image_COLOR(src):
    data = src.split('base64,')[-1]
    img_byte = base64.b64decode(data)
    
    nparr = np.frombuffer(img_byte, dtype=np.uint8)
    npimage = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
    
    return npimage

def str2Image_GRAYSCALE(src):
    data = src.split('base64,')[-1]
    img_byte = base64.b64decode(data)
    
    nparr = np.frombuffer(img_byte, dtype=np.uint8)
    npimage = cv2.imdecode(nparr, cv2.IMREAD_GRAYSCALE)
    
    return npimage

由于目前滑块验证码是一维的,也就是说图片中缺口的Y值是固定的,在http接口里直接返回了这个值。所以我根据Y值截取了图片中有效的部分。代码如下:

def cutImage(image, height):
    cutImage = image[height:height + 70, 0:500]
    return cutImage

我采用的是边缘检测的方式识别图像中缺口的位置,为了提高图像转二值图像后的清晰度,我先提高了图像的对比度。代码如下:

def AddContrast(image):
    _image = np.zeros_like(image)
    h, w = _image.shape[:2]
    for _i in range(h):
        for _j in range(w):
            # blurred[i][j] = -0.5 * image[i][j] + 255 # 暗区域变亮,亮区域变暗
            _image[_i][_j] = min(255, max(2 * image[_i][_j], 0))  # 对比度增强
            # _SmallImage[i][j] = min(255, max((SmallImage[i][j] - 109), 0))  # 颜色发黑
    return _image

对比度提高之后,感觉有些比较模糊的图变清晰了很多。接下来就可以做窄边界的边缘检测了。代码如下:

def setCanny(image):
    image = cv2.Canny(image, 50, 100)
    return image

得到边缘二值图像后,再通过矩形特征寻找缺口所在位置。通过观察发现,由于背景的干扰,图像缺口的矩形边缘线会出现扭曲变形的情况,进而使其线段分布在前后两列或上下两行,且两行中形成互补。如下图:

我的想法是:

  1. 逐列遍历图片,被遍历的列为x列;

  1. 判断x列与x+1列上的点色值是否一致,如果不一致,说明x与x+1列是线段扭曲后的互补,则当前列计数器累加一;否则不累加;

  1. 由于图像缺口宽度固定66像素,所以判断x+65列与x+66列上的点是否色值一致,如果不一致,说明x+65与x+66列是线段扭曲后的互补,则当前列计数器累加一;否则不累加;

  1. 获取y=2和y=3两行,从x到x+66之间的色值,如果y2与y3行上的点是否色值一致,如果不一致则当前列计数器累加一;否则不累加;

  1. 由于图像缺口高度固定66像素,所以判断y=67和y=68两行,从x到x+66之间的色值,如果不一致则当前列计数器累加一;否则不累加;

  1. 对全部x列的计数器进行排序,数量最大的认为是缺口左侧的x值;

def getMostX(image):
    X = 0
    MaxNum = 0
    H, W = image.shape[:2]
    for w in range(W - 66):
        Num = 0
        for h in range(H):
            C1 = image[h, w]
            _C1 = image[h, w + 1]
            C2 = image[h, w + 65]
            _C2 = image[h, w + 66]
            if C1 != _C1:
                Num += 1
            if C2 != _C2:
                Num += 1
        for _w in range(65):
            C3 = image[2, w + _w]
            _C3 = image[3, w + _w]
            C4 = image[67, w + _w]
            _C4 = image[68, w + _w]  
            if C3 != _C3:
                Num += 1
            if C4 != _C4:
                Num += 1
        if Num > MaxNum:
            MaxNum = Num
            X = w
    return X

为了验证对缺口的识别结果,在前面保存的彩色图片中,按照计算出的缺口左侧x的位置绘制一个红色的矩形用来检查。代码如下:

def checkImage(imageC, X, height):
    imageC = cv2.rectangle(imageC, (X, height), (X + 65, height + 65), (0, 0, 255), 2)
    return imageC

经过验证,识别准确率达到98%。但是这个方式仅仅能够适用于本次攻防演习,遇到其他滑块验证码还需要根据实际情况灵活调整。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/160762.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Verilog HDL 基础语法

一、逻辑值 0: 逻辑低电平,条件为假 1: 逻辑高电平,条件为真 z: 高阻态,无驱动 x: 未知逻辑电平二、实际例子 1. 模块名一般与文件名相同 线网型变量会被映射成一条真实存在的物理连线。 寄存器型变量会被映射成一个寄存器。 2. 参数 para…

2、JavaScript快速入门

2.1 引入JavaScript 内部标签 <!-- 在script标签内写JavaScript(简称js)代码&#xff0c;代码块可以放在head中&#xff0c;也可以放在body中--> <script>// alert:弹窗alert(Hello,world!); //注意以分号结尾 </script>外部引入 hello.js alert(Hello,worl…

分享120个ASP源码,总有一款适合您

ASP源码 分享120个ASP源码&#xff0c;总有一款适合您 链接&#xff1a;https://pan.baidu.com/s/1WwTsUTLS_qLvP-TC1w-1vQ?pwdvxpk 提取码&#xff1a;vxpk 下面是文件的名字&#xff0c;我放了一些图片&#xff0c;文章里不是所有的图主要是放不下...&#xff0c;大家下载…

OB0207 obsidian 自动获取url链接:auto-link-title插件使用

序号解读&#xff1a; 01——软件基础使用、基础语法 02——插件使用 03——综合实战 0 写在前面 Ob社区插件汇总&#xff1a;Airtable - OB社区插件汇总 - Johnny整理 - 每周更新 - B站 Johnny学Explore the "OB社区插件汇总 - Johnny整理 - 每周更新 - B站 Johnny学&qu…

过去一年渲染了3亿帧,助力了63.81亿票房、1150亿播放量丨瑞云渲染年度大事记

2022年&#xff0c;注定是充满未知和挑战的一年。抗疫三年&#xff0c;终于在2022年底迎来放开&#xff0c;我们怀着忐忑的心情告别了核酸、行程码和封控&#xff0c;成为了自己健康的第一负责人。这段时间大家应该都忙着和病毒做斗争吧&#xff0c;瑞云各个岗位的小伙伴们也都…

6.7、万维网(如HTTP超文本传输协议)

1、基本介绍 万维网 WWW (World Wide Web&#xff09;并非某种特殊的计算机网络\color{red}并非某种特殊的计算机网络并非某种特殊的计算机网络。 它是一个大规模的、联机式的信息储藏所&#xff0c;是运行在因特网上的一个分布式应用。 万维网利用网页之间的超链接\color{r…

Web进阶:Day5 移动适配、rem、less

Web进阶&#xff1a;Day5 Date: January 10, 2023 Summary: 移动适配、rem、less 移动适配 移动适配指网页元素的宽高都要随着设备宽度等比缩放 rem &#xff1a; 目前多数企业在用的解决方案 vw / vh&#xff1a;未来的解决方案 rem 目标&#xff1a;能够使用rem单位设置网…

2022年跨境物流指数研究报告

第一章 行业概况 指提供跨境物流服务的行业。跨境物流是指在电子商务环境下&#xff0c;依靠互联网、大数据、信息化与计算机等先进技术&#xff0c;物品从跨境电商企业流向跨境消费者的跨越不同国家或地区的物流活动。 图 物流运输行业产业链结构图 资料来源&#xff1a;资产…

Tapdata Cloud 场景通关系列:集成阿里云计算巢,实现一键云上部署真正开箱即用

【前言】作为中国的 “Fivetran/Airbyte”, Tapdata Cloud 自去年发布云版公测以来&#xff0c;吸引了近万名用户的注册使用。应社区用户上生产系统的要求&#xff0c;Tapdata Cloud 3.0 将正式推出商业版服务&#xff0c;提供对生产系统的 SLA 支撑。Tapdata 目前专注在实时数…

VS2010 安装NuGet NPIO 基础连接已经关闭:发送时发生错误

1.下载Nuget并安装 NuGet Package Manager - Visual Studio Marketplace 工具->扩展管理器可看见 2.安装NPOI 3. 如果遇见基础连接已经关闭:发送时发生错误 要把https://packages.nuget.org/改为https://www.nuget.org/api/v2/ VS2019要使用https://www.nuget.org/api/v…

OAuth2.0 详解

OAuth2.0介绍 OAuth&#xff08;Open Authorization&#xff09;是一个关于授权&#xff08;authorization&#xff09;的开放网络标准&#xff0c;允许用户授权第三方 应用访问他们存储在另外的服务提供者上的信息&#xff0c;而不需要将用户名和密码提供给第三方移动应用或分…

【日常系列】LeetCode《26·动态规划1》

数据规模->时间复杂度 <10^4 &#x1f62e;(n^2) <10^7:o(nlogn) <10^8:o(n) 10^8<:o(logn),o(1) lc 509【剑指 10-1】&#xff1a;斐波那契数列问题 - 动态规划入门 https://leetcode.cn/problems/fibonacci-number/ 提示&#xff1a; 0 < n < 30 #方案…

WebSocket概念及实现简易聊天室

WebSocket实现简易聊天室 1 WebSocket介绍 网络通信协议是HTML5开始提供的一个单个TCP连接上进行全双工通信协议 1.1 诞生原因&#xff08;http无状态、无连接&#xff09; ①HTTP协议&#xff1a; 由于HTTP协议是一种无状态、无连接、单向的应用层协议&#xff0c;通信请求只…

Java反射机制是什么?

Java 反射机制是 Java 语言的一个重要特性。在学习 Java 反射机制前&#xff0c;大家应该先了解两个概念&#xff0c;编译期和运行期。 编译期是指把源码交给编译器编译成计算机可以执行的文件的过程。在 Java 中也就是把 Java 代码编成 class 文件的过程。编译期只是做了一些…

Qt Creator添加自定义向导

文章目录一、前言二、前置说明三、wizard.json解析3.1、宏观结构3.2、微观解释3.2.1、向导信息3.2.2、定义变量3.2.3、页面定义3.2.4、文件生成四、实战一、前言 在Qt Creator中&#xff0c;当我们选择新建时&#xff0c;Qt自带了很多选项&#xff1b; 如果我们在开发过程中&a…

软件测试——使用mujava测试过程中

文章目录下载对应安装包步骤二、修改代码第二部分&#xff0c;修改对应测试文件下载对应安装包 分别下载junit.jar、mujava.jar和openjava.jar三个包&#xff0c;并设定对应系统路径。三个安装包的下载路径以mujava.jar为例子 设置系统环境变量&#xff0c;计算机》属性》高级…

golang实现一个linux命令ls命令(命令行工具构建)

希望2023可以听到这些话&#xff1a; 恭喜你得到了这份工作恭喜你的建议被采用了恭喜你被录取了恭喜你的考试顺利通过了恭喜你上岸了恭喜你升职了恭喜你加薪了恭喜你体检结果一切正常在这篇文章下面许个愿吧&#xff01; ls 命令 要实现ls&#xff0c;首先先我们复习一下ls命令…

FPGA知识汇集-ASIC向FPGA的移植

ASIC原型验证是整个验证环节中非常重要的步骤之一&#xff0c;也是将ASIC的代码移植到FPGA平台上最重要的原因&#xff0c;本文章的意义在于&#xff1a; 对于系统构架师&#xff0c;将帮助他们在选择商用模拟器还是自行设计方案之间做出更好的选择&#xff1b; 对于逻辑工程师…

一文读懂Go Http Server原理

hello大家好呀&#xff0c;我是小楼&#xff0c;这是系列文《Go底层原理剖析》的第二篇&#xff0c;依旧是分析 Http 模块&#xff0c;话不多说&#xff0c;开始。 从一个 Demo 入手 俗话说万事开头难&#xff0c;但用 Go 实现一个 Http Server 真不难&#xff0c;简单到什么程…

2、Eclipse安装与使用

目录 一、简介 二、下载 三、Eclipse安装 &#xff08;1&#xff09;找到Eclipse安装包&#xff0c;右键【以管理员身份运行】 2.因为是写Java程序&#xff0c;所以安装第一个喽 3.安装位置设置&#xff08;不建议C盘安装哦&#xff09;&#xff0c;点击【INSTALL】 3.点…