修复bug
This commit is contained in:
parent
40ddb8df30
commit
9f9ed81572
@ -11,16 +11,14 @@ import os
|
||||
from flask import Flask, request, render_template, g, Blueprint, send_file
|
||||
from pywxdump import analyzer, read_img_dat, read_audio
|
||||
from pywxdump.api.rjson import ReJson, RqJson
|
||||
from flask_cors import CORS
|
||||
# app = Flask(__name__, static_folder='../ui/web/dist', static_url_path='/')
|
||||
|
||||
# from flask_cors import CORS
|
||||
|
||||
app = Flask(__name__, static_folder='../ui/web/dist', static_url_path='/')
|
||||
|
||||
CORS(app, resources={r"/*": {"origins": "*"}}, supports_credentials=True) # 允许所有域名跨域
|
||||
api = Blueprint('api', __name__, template_folder='templates')
|
||||
api.debug = False
|
||||
|
||||
|
||||
@app.route('/api/init', methods=["GET", 'POST'])
|
||||
|
||||
@api.route('/api/init', methods=["GET", 'POST'])
|
||||
def init():
|
||||
"""
|
||||
初始化
|
||||
@ -35,7 +33,7 @@ def init():
|
||||
return ReJson(0, rdata)
|
||||
|
||||
|
||||
@app.route('/api/contact_list', methods=["GET", 'POST'])
|
||||
@api.route('/api/contact_list', methods=["GET", 'POST'])
|
||||
def contact_list():
|
||||
"""
|
||||
获取联系人列表
|
||||
@ -59,7 +57,7 @@ def contact_list():
|
||||
return ReJson(9999, msg=str(e))
|
||||
|
||||
|
||||
@app.route('/api/chat_count', methods=["GET", 'POST'])
|
||||
@api.route('/api/chat_count', methods=["GET", 'POST'])
|
||||
def chat_count():
|
||||
"""
|
||||
获取联系人列表
|
||||
@ -77,7 +75,7 @@ def chat_count():
|
||||
return ReJson(9999, msg=str(e))
|
||||
|
||||
|
||||
@app.route('/api/contact_count_list', methods=["GET", 'POST'])
|
||||
@api.route('/api/contact_count_list', methods=["GET", 'POST'])
|
||||
def contact_count_list():
|
||||
"""
|
||||
获取联系人列表
|
||||
@ -116,7 +114,7 @@ def contact_count_list():
|
||||
return ReJson(9999, msg=str(e))
|
||||
|
||||
|
||||
@app.route('/api/msgs', methods=["GET", 'POST'])
|
||||
@api.route('/api/msgs', methods=["GET", 'POST'])
|
||||
def get_msgs():
|
||||
msg_path = request.headers.get("msg_path")
|
||||
micro_path = request.headers.get("micro_path")
|
||||
@ -151,7 +149,7 @@ def get_msgs():
|
||||
return ReJson(0, {"msg_list": msg_list, "user_list": userlist, "my_wxid": g.my_wxid})
|
||||
|
||||
|
||||
@app.route('/api/img', methods=["GET", 'POST'])
|
||||
@api.route('/api/img', methods=["GET", 'POST'])
|
||||
def get_img():
|
||||
"""
|
||||
获取图片
|
||||
@ -170,7 +168,8 @@ def get_img():
|
||||
else:
|
||||
return ReJson(1001)
|
||||
|
||||
@app.route('/api/audio', methods=["GET", 'POST'])
|
||||
|
||||
@api.route('/api/audio', methods=["GET", 'POST'])
|
||||
def get_audio():
|
||||
MsgSvrID = request.args.get("MsgSvrID")
|
||||
MsgSvrID = request.json.get("MsgSvrID", MsgSvrID)
|
||||
@ -183,18 +182,7 @@ def get_audio():
|
||||
video_data = f"data:audio/wav;base64,{video_base64}"
|
||||
return ReJson(0, video_data)
|
||||
|
||||
@api.route('/')
|
||||
def index():
|
||||
return render_template('index.html')
|
||||
|
||||
if __name__ == '__main__':
|
||||
@app.before_request
|
||||
def before_request():
|
||||
path = r"D:\_code\py_code\test\a2023\b0821wxdb\merge_wfwx_db\kkWxMsg\MSG_all.db"
|
||||
g.msg_path = path
|
||||
g.micro_path = path
|
||||
g.media_path = path
|
||||
g.wxid_path = r"C:\Users\xaoyo\Documents\Tencent\WeChat Files\wxid_vzzcn5fevion22"
|
||||
g.my_wxid = "wxid_vzzcn5fevion22"
|
||||
g.tmp_path = "dist" # 临时文件夹,用于存放图片等
|
||||
g.user_list = []
|
||||
|
||||
|
||||
app.run(host='0.0.0.0', port=5000, debug=True)
|
||||
|
@ -178,9 +178,11 @@ class MainShowChatRecords():
|
||||
metavar="")
|
||||
sb_decrypt.add_argument("-media", "--media_path", type=str, help="解密后的 MediaMSG.db 的路径", required=True,
|
||||
metavar="")
|
||||
sb_decrypt.add_argument("-fs", "--filestorage_path", type=str,
|
||||
help="(可选)文件夹FileStorage的路径(用于显示图片)", required=False,
|
||||
sb_decrypt.add_argument("-wid", "--wxid_path", type=str,
|
||||
help="(可选)微信文件夹的路径(用于显示图片)", required=False,
|
||||
metavar="")
|
||||
sb_decrypt.add_argument("-myid", "--my_wxid", type=str, help="(可选)微信账号(本人微信id)", required=False,
|
||||
default="wxid_vzzcn5fevion22", metavar="")
|
||||
return sb_decrypt
|
||||
|
||||
def run(self, args):
|
||||
@ -199,19 +201,23 @@ class MainShowChatRecords():
|
||||
print("[-] 输入数据库路径不存在")
|
||||
return
|
||||
|
||||
app = Flask(__name__, template_folder='./show_chat/templates')
|
||||
app = Flask(__name__, template_folder='./ui/web', static_folder='./ui/web/assets/', static_url_path='/assets/')
|
||||
app.logger.setLevel(logging.ERROR)
|
||||
|
||||
from flask_cors import CORS
|
||||
from pywxdump.api.api import api
|
||||
CORS(app, resources={r"/*": {"origins": "*"}}, supports_credentials=True) # 允许所有域名跨域
|
||||
@app.before_request
|
||||
def before_request():
|
||||
g.msg_path = args.msg_path
|
||||
g.micro_path = args.micro_path
|
||||
g.media_path = args.media_path
|
||||
g.wxid_path = args.wxid_path
|
||||
g.my_wxid = args.my_wxid
|
||||
g.tmp_path = "tmp" # 临时文件夹,用于存放图片等
|
||||
g.user_list = []
|
||||
|
||||
g.MSG_ALL_db_path = args.msg_path
|
||||
g.MicroMsg_db_path = args.micro_path
|
||||
g.MediaMSG_all_db_path = args.media_path
|
||||
g.FileStorage_path = args.filestorage_path
|
||||
g.USER_LIST = get_user_list(args.msg_path, args.micro_path)
|
||||
|
||||
app.register_blueprint(app_show_chat)
|
||||
app.register_blueprint(api)
|
||||
|
||||
print("[+] 请使用浏览器访问 http://127.0.0.1:5000/ 查看聊天记录")
|
||||
app.run(host='0.0.0.0', port=5000, debug=False)
|
||||
|
35
pywxdump/server.py
Normal file
35
pywxdump/server.py
Normal file
@ -0,0 +1,35 @@
|
||||
# -*- coding: utf-8 -*-#
|
||||
# -------------------------------------------------------------------------------
|
||||
# Name: server.py
|
||||
# Description:
|
||||
# Author: xaoyaoo
|
||||
# Date: 2024/01/04
|
||||
# -------------------------------------------------------------------------------
|
||||
import logging
|
||||
|
||||
from flask import Flask,g
|
||||
from flask_cors import CORS
|
||||
from pywxdump.api.api import api
|
||||
|
||||
app = Flask(__name__, template_folder='./ui/web', static_folder='./ui/web/assets/', static_url_path='/assets/')
|
||||
app.logger.setLevel(logging.ERROR)
|
||||
|
||||
|
||||
CORS(app, resources={r"/*": {"origins": "*"}}, supports_credentials=True) # 允许所有域名跨域
|
||||
|
||||
@app.before_request
|
||||
def before_request():
|
||||
path = r"D:\_code\py_code\test\a2023\b0821wxdb\merge_wfwx_db\kkWxMsg\MSG_all.db"
|
||||
g.msg_path = path
|
||||
g.micro_path = path
|
||||
g.media_path = path
|
||||
g.wxid_path = r"C:\Users\xaoyo\Documents\Tencent\WeChat Files\wxid_vzzcn5fevion22"
|
||||
g.my_wxid = "wxid_vzzcn5fevion22"
|
||||
g.tmp_path = "dist" # 临时文件夹,用于存放图片等
|
||||
g.user_list = []
|
||||
|
||||
|
||||
app.register_blueprint(api)
|
||||
|
||||
print("[+] 请使用浏览器访问 http://127.0.0.1:5000/ 查看聊天记录")
|
||||
app.run(host='0.0.0.0', port=5000, debug=True)
|
24
pywxdump/ui/web/assets/AboutView-rPqWO3uF.js
Normal file
24
pywxdump/ui/web/assets/AboutView-rPqWO3uF.js
Normal file
File diff suppressed because one or more lines are too long
1
pywxdump/ui/web/assets/BiasView-SGGZRxzN.js
Normal file
1
pywxdump/ui/web/assets/BiasView-SGGZRxzN.js
Normal file
@ -0,0 +1 @@
|
||||
import{_ as e}from"./index-E8u1MHmX.js";const r={};function c(n,t){return null}const s=e(r,[["render",c]]);export{s as default};
|
1
pywxdump/ui/web/assets/ChatView-Cq3nrHWr.css
Normal file
1
pywxdump/ui/web/assets/ChatView-Cq3nrHWr.css
Normal file
File diff suppressed because one or more lines are too long
5
pywxdump/ui/web/assets/ChatView-wPwc1zoU.js
Normal file
5
pywxdump/ui/web/assets/ChatView-wPwc1zoU.js
Normal file
File diff suppressed because one or more lines are too long
1
pywxdump/ui/web/assets/DecryptView-Q00DOMTR.js
Normal file
1
pywxdump/ui/web/assets/DecryptView-Q00DOMTR.js
Normal file
@ -0,0 +1 @@
|
||||
import{_ as e}from"./index-E8u1MHmX.js";const r={};function c(t,n){return null}const o=e(r,[["render",c]]);export{o as default};
|
1
pywxdump/ui/web/assets/ExportView-K6aMFPGo.js
Normal file
1
pywxdump/ui/web/assets/ExportView-K6aMFPGo.js
Normal file
@ -0,0 +1 @@
|
||||
import{_ as r}from"./index-E8u1MHmX.js";const e={};function t(c,n){return null}const o=r(e,[["render",t]]);export{o as default};
|
4
pywxdump/ui/web/assets/HelpView-qB-m2RRg.js
Normal file
4
pywxdump/ui/web/assets/HelpView-qB-m2RRg.js
Normal file
File diff suppressed because one or more lines are too long
1
pywxdump/ui/web/assets/MergeView-Y01u0JPM.js
Normal file
1
pywxdump/ui/web/assets/MergeView-Y01u0JPM.js
Normal file
@ -0,0 +1 @@
|
||||
import{_ as e}from"./index-E8u1MHmX.js";const r={};function c(n,t){return null}const o=e(r,[["render",c]]);export{o as default};
|
1
pywxdump/ui/web/assets/StatisticsView-x7MZYcRO.js
Normal file
1
pywxdump/ui/web/assets/StatisticsView-x7MZYcRO.js
Normal file
@ -0,0 +1 @@
|
||||
import{_ as t}from"./index-E8u1MHmX.js";const c={};function e(r,n){return null}const _=t(c,[["render",e]]);export{_ as default};
|
1
pywxdump/ui/web/assets/WxinfoView-3m0pT8F6.js
Normal file
1
pywxdump/ui/web/assets/WxinfoView-3m0pT8F6.js
Normal file
@ -0,0 +1 @@
|
||||
import{_ as e}from"./index-E8u1MHmX.js";const n={};function r(c,t){return null}const o=e(n,[["render",r]]);export{o as default};
|
1
pywxdump/ui/web/assets/index-9ireuRE8.css
Normal file
1
pywxdump/ui/web/assets/index-9ireuRE8.css
Normal file
File diff suppressed because one or more lines are too long
60
pywxdump/ui/web/assets/index-E8u1MHmX.js
Normal file
60
pywxdump/ui/web/assets/index-E8u1MHmX.js
Normal file
File diff suppressed because one or more lines are too long
BIN
pywxdump/ui/web/assets/qq-iQ8jIM6k.png
Normal file
BIN
pywxdump/ui/web/assets/qq-iQ8jIM6k.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 82 KiB |
BIN
pywxdump/ui/web/assets/qrcode_gh-wCDAugtE.jpg
Normal file
BIN
pywxdump/ui/web/assets/qrcode_gh-wCDAugtE.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
BIN
pywxdump/ui/web/favicon.ico
Normal file
BIN
pywxdump/ui/web/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
22
pywxdump/ui/web/index.html
Normal file
22
pywxdump/ui/web/index.html
Normal file
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="icon" href="./favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>PyWxDump</title>
|
||||
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
<script type="module" crossorigin src="./assets/index-E8u1MHmX.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-9ireuRE8.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" style="height: 100%;"></div>
|
||||
</body>
|
||||
</html>
|
@ -12,4 +12,5 @@ flask
|
||||
pyahocorasick
|
||||
blackboxprotobuf
|
||||
lz4
|
||||
lxml
|
||||
lxml
|
||||
flask_cors
|
Loading…
Reference in New Issue
Block a user