Coder Social home page Coder Social logo

0xnethousand / python_web_auth Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jiayouzl/python_web_auth

0.0 0.0 0.0 1.68 MB

基于Python3开发的一款网络验证系统

License: MIT License

JavaScript 46.76% Python 1.55% CSS 50.34% HTML 1.32% Dockerfile 0.04%

python_web_auth's Introduction

极简网络验证Python3版

一款轻量级的网络验证服务端应用程序,基于JSON改造的数据库,免去部署MySQL等数据库的烦恼,实现快速部署上线生产的目的。

后台管理界面预览

Empty interface Empty interface

简介

之前网上乱转看到一篇文章在介绍Sanic这款Python3的Web应用框架,看着介绍挺不错,就有了大家现在看到的这款我用来练手作品。

如要直接外网访问将.env配置文件中HOST改为0.0.0.0利用Sanic自带服务端用于生产环境(Sanic框架官方允许这样做),但是不建议这样做,强烈建议使用Nginx反向代理。

这款网络验证要优化的地方还是很多的,后续我会对该项目慢慢进行升级优化。

使用前务必阅读.env配置文件中的相关参数说明。

后续优化准备规划删除线代表已完成

  • 验证相关类接口加密返回数据
  • 登陆验证接口安全认证
  • 后台管理在增加一些常用功能
  • 增加使用DEMO

接口文档

机器码注册

curl --request POST \
  --url http://domain:8081/reg \
  --data '{
	"machineCode": "12345abcde"
}'

机器码验证

2022-09-28更新增加接口签名认证,POST需带上header协议头并增加2个参数,详细参考/demo/python3/demo.py代码。
curl --request POST \
  --url http://domain:8081/login \
  --header 'sign: 7272d8673cc676d594cda7aea94ca84f' \
  --header 'timestamp: 1664210885' \
  --data '{
	"machineCode": "12345abcde"
}'

机器码充值

curl --request POST \
  --url http://domain:8081/recharge \
  --data '{
    "machineCode": "12345abcde",
    "card_number": "20220915RWLLG",
    "card_password": "OGPVQZSV"
}'

后台管理(默认账号:admin 默认密码:admin888)

http://domain:8081/admin/login

开发环境

  1. macOS 12.6 / Ubuntu Desktop 22.04
  2. Python 3.9.14
  3. VS Code 1.71.2 / PyCharm 2022.2.2
  4. Sanic 22.6.2

文件说明

├── .env                        应用配置文件
├── app.py                      Web路由相关
├── db.json                     JSON数据库文件
├── error.log                   错误日志
├── requirements.txt            依赖组件库
├── templates                   静态模版目录
│   ├── base.html               后台管理UI头文件
│   ├── card_info.html          充值卡管理
│   ├── login.html              管路员登录
│   ├── static                  第三方js库目录
│   └── user_info.html          机器码管理
├── Dockerfile                  docker Dockerfile文件
├── aes_model.py                AEC加解密类
└── verification_model.py       网络验证核心库类

安装&运行

本地克隆运行方式(Python≥3.7)

docker运行方式

git clone https://github.com/jiayouzl/python_web_auth.git
# docker怎么安装?百度或谷歌吧~

cd python_web_auth

# 编译镜像
docker build -t wlyz:v1 .

# 运行镜像(~/python3/docker_volumes/wlyz_data改为你自己的路径)
# 1.把[database]目录下的[db.json]文件先拷贝至[~/python3/docker_volumes/wlyz_data]目录下。
# 2.把根目录下的[.env]文件先拷贝至[~/python3/docker_volumes]目录下。
docker run --name wlyz -p 8081:8081 -itd -v ~/python3/docker_volumes/wlyz_data:/app/database:rw -v ~/python3/docker_volumes/.env:/app/.env:rw --restart=always wlyz:v1

# 测试访问(这个内网IP是我自己的,可能与你的不同,自行查找自己的内网IP地址)
http://192.168.5.100:8081

更新记录

2022-10-02

  1. 增加后台充值卡批量复制导出功能。

2022-09-29

  1. 增加认证接口签名加密认证。
  2. 增加认证接口结果加密返回,杜绝结果本地重写规则破解方式。

2022-09-25

  1. 增加Python3的DEMO。/demo/python3/demo.py
  2. 其他语言DEMO后续新增,也可参考curl样板进行自行修改。

2022-09-22

  1. 增加Dockerfile,我都写好了,直接编译镜像即能以docker方式运行。

交流群组

进QQ群验证问答

问:这是什么?
答:网络验证

Python3网络验证交流群

QQ群二维码

License

MIT

python_web_auth's People

Contributors

jiayouzl avatar leileihz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.