Kamixitong/README.md
2025-11-13 16:51:51 +08:00

139 lines
4.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 软件及卡密管理系统
一款面向Python开发者的轻量化软件授权控制+全生命周期管理系统,核心解决"Python软件盗版防护、卡密授权管控、软件版本迭代管理"三大核心需求。
## 项目结构
```
KaMiXiTong/
├── README.md # 项目说明文档
├── requirements.txt # Python依赖包
├── setup.py # 安装脚本
├── config.py # 配置文件
├── run.py # 启动入口
├── auth_validator.py # Python验证器模块供开发者嵌入
├── app/ # Web管理后台
│ ├── __init__.py
│ ├── models/ # 数据模型
│ │ ├── __init__.py
│ │ ├── product.py # 产品模型
│ │ ├── version.py # 版本模型
│ │ ├── license.py # 许可证(卡密)模型
│ │ ├── device.py # 设备模型
│ │ ├── ticket.py # 工单模型
│ │ └── admin.py # 管理员模型
│ ├── api/ # API接口
│ │ ├── __init__.py
│ │ ├── auth.py # 验证相关API
│ │ ├── product.py # 产品管理API
│ │ ├── version.py # 版本管理API
│ │ ├── license.py # 卡密管理API
│ │ ├── device.py # 设备管理API
│ │ ├── ticket.py # 工单管理API
│ │ └── statistics.py # 统计分析API
│ ├── web/ # Web界面
│ │ ├── __init__.py
│ │ ├── views.py # 页面路由
│ │ └── templates/ # HTML模板
│ │ ├── base.html
│ │ ├── login.html
│ │ ├── dashboard.html
│ │ ├── product/
│ │ ├── version/
│ │ ├── license/
│ │ ├── device/
│ │ └── ticket/
│ └── utils/ # 工具函数
│ ├── __init__.py
│ ├── crypto.py # 加密工具
│ ├── machine_code.py # 机器码生成
│ └── validators.py # 验证工具
├── tests/ # 测试文件
│ ├── __init__.py
│ ├── test_validator.py # 验证器测试
│ ├── test_api.py # API测试
│ └── test_models.py # 模型测试
├── docs/ # 文档
│ ├── API.md # API文档
│ ├── INTEGRATION.md # 集成文档
│ └── EXAMPLES.md # 使用示例
├── migrations/ # 数据库迁移文件
│ └── init.sql
└── static/ # 静态文件
├── css/
├── js/
└── uploads/
```
## 核心功能
### 1. Python验证器 (auth_validator.py)
- 轻量级授权验证模块开发者可嵌入自有Python软件
- 支持在线/离线验证模式
- 跨平台机器码生成
- 防篡改机制
### 2. Web管理后台
- 产品管理:创建、编辑、删除软件产品
- 版本管理:版本发布、兼容性控制
- 卡密管理:批量生成、导入导出、状态控制
- 设备管理:设备绑定、解绑、禁用
- 数据统计:下载量、活跃度分析
- 工单管理:用户反馈处理
## 快速开始
### 1. 安装依赖
```bash
pip install -r requirements.txt
```
### 2. 初始化数据库
#### SQLite数据库默认
```bash
python init_db_sqlite.py
```
#### MySQL数据库
1. 配置.env文件中的DATABASE_URL为MySQL连接字符串
```
DATABASE_URL=mysql+pymysql://username:password@localhost:3306/database_name
```
2. 运行MySQL初始化脚本
```bash
python init_db_mysql.py
```
### 3. 启动后台
```bash
python run.py
```
### 4. 嵌入验证器
```python
from auth_validator import AuthValidator
validator = AuthValidator(software_id="your_software_id")
if not validator.validate():
exit() # 验证失败退出程序
```
## 技术栈
- **后端**: Flask + SQLAlchemy + MySQL/SQLite
- **前端**: Bootstrap + jQuery
- **加密**: AES + SHA256
- **验证器**: 纯Python支持Python 3.6+
## 安全特性
- HTTPS通信加密
- 数据库敏感信息加密存储
- 验证器防篡改机制
- 机器码唯一性校验
- 防重放攻击
## 许可证
MIT License