验证码拦截绕过

验证码拦截绕过

前言

​ 介绍了验证码自动识别项目及burpsuite插件对接项目的方法。

通用验证码识别

​ 验证码识别项目使用ddddocr项目,项目地址https://github.com/sml2h3/ddddocr。装好需要的包后验证是否正常工作。

import ddddocr

ocr = ddddocr.DdddOcr(beta=True)

with open("test.png", 'rb') as f:
    image = f.read()

res = ocr.classification(image)
print(res)

验证码识别项目对接burpsuite

​ 给burpsuite安装插件对接验证码识别接口。项目地址https://github.com/f0ng/captcha-killer-modified。此项目提供的codereg.py在我环境上无法正常工作,可能是python版本问题(我的机器是python3.8)或者是包版本问题。修改了一下代码。运行代码后在burpsuite中抓包使用插件即可,看图。

from aiohttp import web
import base64
import ddddocr  

ocr = ddddocr.DdddOcr()

#如果需要使用装饰器来路由uri的话,需要创建RouteTableDef类的对象来获取一个装饰器
routes = web.RouteTableDef()

@routes.get("/get")
async def get_req(request):
    print("this is get req")
    return web.Response(text="Hello World")


@routes.post("/reg")
async def post_req(request):
    print(await request.text())
    img_base64 = await request.text()
    img_bytes = base64.b64decode(img_base64)
    return web.Response(text=ocr.classification(img_bytes))


@routes.route("*", "/all")#支持GET/POST/PUT/DELETE
async def all_handler(request):
    print(request.method)
    print(type(request))
    print("handle all request")
    return web.Response(text="All")


def main():
    pass


if __name__ == '__main__':
    app = web.Application()
    #如果不使用装饰器的话, 添加如下代码
    # app.add_routes([web.get("/get", get_req),
    #                 web.post("/post",post_req)])

    #如果使用装饰器,则添加如下一行
    app.add_routes(routes)
    web.run_app(app, port=8900)
POST /reg HTTP/1.1
Host: 192.168.31.210:8900
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

<@BASE64><@IMG_RAW></@IMG_RAW></@BASE64>
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值