使用BP插件captcha-killer识别图片验证码&绕过系统验证码机制

使用BP插件captcha-killer绕过验证码

前置条件

1、下载安装插件
burp2020前使用:https://github.com/c0ny1/captcha-killer/tree/0.1.2
burp2020后使用:https://github.com/Ta0ing/captcha-killer-java8
2、导入插件
在这里插入图片描述
分为三个部分:上面为验证码的接口、下面为用来识别验证码的接口网站(百度、图鉴等可用来将图片识别为文字的网站)、右边为识别的结果。

利用过程

1、点击验证码刷新可抓取到验证码接口
在这里插入图片描述
抓到数据包,发送到插件:
在这里插入图片描述
点击获取我们就可以得到验证码:
在这里插入图片描述
2、接入图片识别的接口,这里使用百度的接口
在这里插入图片描述
会得到一个数据包,这里需要我们注册申请得到一个access_token:

POST /rest/2.0/ocr/v1/accurate?access_token=[TOKEN] HTTP/1.1
Host: aip.baidubce.com
Connection: close
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Sec-Fetch-Site: none
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Content-Type: application/x-www-form-urlencoded
Content-Length: 55

image=<@URLENCODE><@BASE64><@IMG_RAW></@IMG_RAW></@BASE64></@URLENCODE>

注册账号:https://cloud.baidu.com/product/ocr_general
实名认证->免费领取资源->创建应用:
在这里插入图片描述
创建后得到一个应用(创建时候需勾选图片识别的相应功能,默认全部勾选就行):
在这里插入图片描述
3、获取access_token
这里用这个方法获取,较为简单:
https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=【你创建应用的API Key值】&client_secret=【你创建应用的Secret Key值】
得到access_token后复制到bp的插件里,点击识别,即可成功获取文本的验证码,右键标记为识别结果:
在这里插入图片描述
4、利用过程
将需要的数据包发送至Intruder模块,添加验证码为变量,选择payload:
在这里插入图片描述
使用并发数为1的线程池,防止冲突:
在这里插入图片描述
然后正常使用就行,可用于有验证码机制的账密bao破、短信hong zha等:
在这里插入图片描述

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
好的,以下是基于BP神经网络的图片验证码识别Python代码: 首先,我们需要导入相关的库: ```python import numpy as np import matplotlib.pyplot as plt from PIL import Image ``` 接着,我们需要准备训练数据。假设我们有一个包含100个验证码图片的数据集,每个验证码有5个字符,每个字符大小为30x30像素。我们可以将每个字符转换成一个长度为900的向量,然后将5个字符的向量合并成一个长度为4500的向量。将这些向量保存到一个numpy数组中,作为训练数据。 ```python # 加载训练数据 X_train = [] y_train = [] for i in range(100): for j in range(5): im = Image.open(f"captcha_{i}_{j}.png") # 加载验证码图片 im = im.convert("L") # 转换为灰度图 im = im.resize((30, 30)) # 缩放为30x30像素 X_train.append(np.array(im).flatten()) # 将字符转换成向量并加入训练数据 y_train.append(i) # 记录验证码的序号 X_train = np.array(X_train) y_train = np.array(y_train) ``` 接着,我们需要对训练数据进行预处理。将像素值归一化到0到1之间,并对标签进行one-hot编码。 ```python # 对训练数据进行预处理 X_train = X_train / 255.0 y_train_onehot = np.zeros((len(y_train), 100)) y_train_onehot[np.arange(len(y_train)), y_train] = 1 ``` 接下来,我们可以构建BP神经网络模型。这里我们使用一个包含一个隐藏层的神经网络,隐藏层的大小为100。输入层大小为4500,输出层大小为100,代表100个不同的验证码。 ```python # 构建BP神经网络模型 class NeuralNetwork: def __init__(self, input_size, hidden_size, output_size): self.W1 = np.random.randn(input_size, hidden_size) * 0.01 self.b1 = np.zeros((1, hidden_size)) self.W2 = np.random.randn(hidden_size, output_size) * 0.01 self.b2 = np.zeros((1, output_size)) def forward(self, X): self.z1 = np.dot(X, self.W1) + self.b1 self.a1 = np.tanh(self.z1) self.z2 = np.dot(self.a1, self.W2) + self.b2 exp_scores = np.exp(self.z2) self.probs = exp_scores / np.sum(exp_scores, axis=1, keepdims=True) return self.probs def backward(self, X, y, learning_rate): delta3 = self.probs delta3[range(len(X)), y] -= 1 dW2 = np.dot(self.a1.T, delta3) db2 = np.sum(delta3, axis=0, keepdims=True) delta2 = np.dot(delta3, self.W2.T) * (1 - np.power(self.a1, 2)) dW1 = np.dot(X.T, delta2) db1 = np.sum(delta2, axis=0) self.W1 -= learning_rate * dW1 self.b1 -= learning_rate * db1 self.W2 -= learning_rate * dW2 self.b2 -= learning_rate * db2 def train(self, X, y, learning_rate, num_passes): for i in range(num_passes): probs = self.forward(X) self.backward(X, y, learning_rate) if i % 10 == 0: loss = self.calculate_loss(X, y) print(f"iteration {i}: loss = {loss}") def calculate_loss(self, X, y): num_examples = len(X) correct_logprobs = -np.log(self.probs[range(num_examples), y]) data_loss = np.sum(correct_logprobs) return 1.0 / num_examples * data_loss nn = NeuralNetwork(4500, 100, 100) nn.train(X_train, y_train, 0.01, 1000) ``` 最后,我们可以使用训练好的模型对新的验证码进行识别。首先需要将验证码转换成向量,然后使用训练好的神经网络模型进行预测。 ```python # 加载测试数据 im = Image.open("test_captcha.png") im = im.convert("L") im = im.resize((30, 150)) X_test = np.array(im).reshape(5, 30*30) # 对测试数据进行预处理 X_test = X_test / 255.0 # 使用训练好的模型进行预测 y_test_prob = nn.forward(X_test) y_test = np.argmax(y_test_prob, axis=1) # 输出预测结果 print("Predicted labels:") print(y_test) ``` 以上就是基于BP神经网络的图片验证码识别Python代码。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值