Skip to content

Commit

Permalink
改善python3.8以下版本的容错
Browse files Browse the repository at this point in the history
  • Loading branch information
xaoyaoo committed Dec 18, 2023
1 parent 5a98f08 commit 1587095
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 21 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ qq交流群:577704006(左边二维码) or 点击链接加入群聊[pywxdum
* 11.增加好友的信息获取
* 12.备份后的聊天记录,恢复到微信中
* 13.朋友圈的查看与备份
* 14.微信存储空间清理,减少微信占用空间

## 4. 其他

Expand Down
17 changes: 9 additions & 8 deletions doc/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,15 @@ python build_exe.py

```shell script
wxdump 模式 [参数]
# 运行模式(mode):
# bias 获取微信基址偏移
# info 获取微信信息
# db_path 获取微信文件夹路径
# decrypt 解密微信数据库
# dbshow 聊天记录查看
# export 聊天记录导出为html
# all 获取微信信息,解密微信数据库,查看聊天记录
# mode 运行模式:
# bias 获取微信基址偏移
# info 获取微信信息
# db_path 获取微信文件夹路径
# decrypt 解密微信数据库
# merge [测试功能]合并微信数据库(MSG.db or MediaMSG.db)
# dbshow 聊天记录查看
# export 聊天记录导出为html
# all 获取微信信息,解密微信数据库,查看聊天记录
```

*示例*
Expand Down
11 changes: 7 additions & 4 deletions pywxdump/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
# Author: xaoyaoo
# Date: 2023/10/14
# -------------------------------------------------------------------------------
from .wx_info import BiasAddr,read_info, get_wechat_db,encrypt,batch_decrypt,decrypt
from .wx_info import merge_copy_db, merge_msg_db, merge_media_msg_db,merge_db
from .analyzer.db_parsing import read_img_dat, read_emoji, decompress_CompressContent, read_audio_buf, read_audio, parse_xml_string,read_BytesExtra
from .wx_info import BiasAddr, read_info, get_wechat_db, encrypt, batch_decrypt, decrypt
from .wx_info import merge_copy_db, merge_msg_db, merge_media_msg_db, merge_db
from .analyzer.db_parsing import read_img_dat, read_emoji, decompress_CompressContent, read_audio_buf, read_audio, \
parse_xml_string, read_BytesExtra
from .ui import app_show_chat, get_user_list, export

import os,json
import os, json

VERSION_LIST_PATH = os.path.join(os.path.dirname(__file__), "version_list.json")
with open(VERSION_LIST_PATH, "r", encoding="utf-8") as f:
VERSION_LIST = json.load(f)

__version__ = "2.3.23"
12 changes: 4 additions & 8 deletions pywxdump/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import sys

from pywxdump import *
import pywxdump

wxdump_ascii = r"""
██████╗ ██╗ ██╗██╗ ██╗██╗ ██╗██████╗ ██╗ ██╗███╗ ███╗██████╗
Expand Down Expand Up @@ -352,19 +353,14 @@ def run(self, args):
args.filestorage_path = FileStorage_path
MainShowChatRecords().run(args)

try:
import importlib.metadata as importlib
except ImportError:
import importlib_metadata as importlib
PYWXDUMP_VERSION = importlib.version('pywxdump')

PYWXDUMP_VERSION = pywxdump.__version__

class CustomArgumentParser(argparse.ArgumentParser):
def format_help(self):
# 首先显示软件简介
# 定义软件简介文本并进行格式化
line_len = 70
PYWXDUMP_VERSION = importlib.version('pywxdump')
PYWXDUMP_VERSION = pywxdump.__version__
wxdump_line = '\n'.join([f'\033[36m{line:^{line_len}}\033[0m' for line in wxdump_ascii.split('\n') if line])
first_line = f'\033[36m{" PyWxDump v" + PYWXDUMP_VERSION + " ":=^{line_len}}\033[0m'
brief = 'PyWxDump功能:获取账号信息、解密数据库、查看聊天记录、导出聊天记录为html等'
Expand All @@ -381,7 +377,7 @@ def format_help(self):
def console_run():
# 创建命令行参数解析器
parser = CustomArgumentParser(formatter_class=argparse.RawTextHelpFormatter)
PYWXDUMP_VERSION = importlib.version('pywxdump')
PYWXDUMP_VERSION = pywxdump.__version__
parser.add_argument('-V', '--version', action='version', version=f"PyWxDump v{PYWXDUMP_VERSION}")

# 添加子命令解析器
Expand Down
9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()

version = "2.3.22"
# 读取版本号 pywxdump/__init__.py 中的 __version__
with open("pywxdump/__init__.py", "r", encoding="utf-8") as f:
for line in f.readlines():
if line.startswith("__version__"):
version = line.split("=")[-1].strip().strip("\"'")
break
else:
raise RuntimeError("version not found")

install_requires = [
"psutil",
Expand Down

0 comments on commit 1587095

Please sign in to comment.