命令行添加保存info信息到json文件选项
This commit is contained in:
parent
7e96fc09ec
commit
9e5c1902af
@ -62,7 +62,7 @@ class MainWxInfo():
|
|||||||
sb_wx_info = parser.add_parser(self.mode, help="获取微信信息")
|
sb_wx_info = parser.add_parser(self.mode, help="获取微信信息")
|
||||||
sb_wx_info.add_argument("-vlp", '--version_list_path', metavar="", type=str,
|
sb_wx_info.add_argument("-vlp", '--version_list_path', metavar="", type=str,
|
||||||
help="(可选)微信版本偏移文件路径", default=VERSION_LIST_PATH)
|
help="(可选)微信版本偏移文件路径", default=VERSION_LIST_PATH)
|
||||||
sb_wx_info.add_argument("-s", '--save_path', metavar="", type=str, help="(可选)保存路径")
|
sb_wx_info.add_argument("-s", '--save_path', metavar="", type=str, help="(可选)保存路径【json文件】")
|
||||||
return sb_wx_info
|
return sb_wx_info
|
||||||
|
|
||||||
def run(self, args):
|
def run(self, args):
|
||||||
@ -70,15 +70,7 @@ class MainWxInfo():
|
|||||||
path = args.version_list_path
|
path = args.version_list_path
|
||||||
save_path = args.save_path
|
save_path = args.save_path
|
||||||
version_list = json.load(open(path, "r", encoding="utf-8"))
|
version_list = json.load(open(path, "r", encoding="utf-8"))
|
||||||
result = read_info(version_list, True) # 读取微信信息
|
result = read_info(version_list, True, save_path) # 读取微信信息
|
||||||
if save_path:
|
|
||||||
try:
|
|
||||||
infos = json.load(open(save_path, "r", encoding="utf-8")) if os.path.exists(save_path) else []
|
|
||||||
except:
|
|
||||||
infos = []
|
|
||||||
with open(save_path, "w", encoding="utf-8") as f:
|
|
||||||
infos += result
|
|
||||||
json.dump(infos, f, ensure_ascii=False, indent=4)
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
@ -290,11 +282,13 @@ class MainAll():
|
|||||||
self.mode = "all"
|
self.mode = "all"
|
||||||
# 添加 'all' 子命令解析器
|
# 添加 'all' 子命令解析器
|
||||||
sb_all = parser.add_parser(self.mode, help="获取微信信息,解密微信数据库,查看聊天记录")
|
sb_all = parser.add_parser(self.mode, help="获取微信信息,解密微信数据库,查看聊天记录")
|
||||||
|
sb_all.add_argument("-s", '--save_path', metavar="", type=str, help="(可选)wx_info保存路径【json文件】")
|
||||||
return sb_all
|
return sb_all
|
||||||
|
|
||||||
def run(self, args):
|
def run(self, args):
|
||||||
# 获取微信信息
|
# 获取微信信息
|
||||||
WxInfo = read_info(VERSION_LIST, True)
|
save_path = args.save_path
|
||||||
|
WxInfo = read_info(VERSION_LIST, True, save_path)
|
||||||
|
|
||||||
for user in WxInfo:
|
for user in WxInfo:
|
||||||
key = user.get("key", "")
|
key = user.get("key", "")
|
||||||
@ -313,7 +307,7 @@ class MainAll():
|
|||||||
print("[-] 未获取到数据库路径")
|
print("[-] 未获取到数据库路径")
|
||||||
return
|
return
|
||||||
|
|
||||||
wxdbpaths = [i for i in wxdbpaths if "Backup.db" not in i and "xInfo.db" not in i] # 过滤掉无需解密的数据库
|
wxdbpaths = [i for i in wxdbpaths if "Backup.db" not in i and "xInfo.db" not in i] # 过滤掉无需解密的数据库
|
||||||
wxdblen = len(wxdbpaths)
|
wxdblen = len(wxdbpaths)
|
||||||
print(f"[+] 共发现 {wxdblen} 个微信数据库")
|
print(f"[+] 共发现 {wxdblen} 个微信数据库")
|
||||||
print("=" * 32)
|
print("=" * 32)
|
||||||
@ -374,15 +368,12 @@ class MainAll():
|
|||||||
|
|
||||||
# # 查看聊天记录
|
# # 查看聊天记录
|
||||||
args.msg_path = merge_save_path
|
args.msg_path = merge_save_path
|
||||||
args.micro_path =merge_save_path
|
args.micro_path = merge_save_path
|
||||||
args.media_path = merge_save_path
|
args.media_path = merge_save_path
|
||||||
args.filestorage_path = FileStorage_path
|
args.filestorage_path = FileStorage_path
|
||||||
MainShowChatRecords().run(args)
|
MainShowChatRecords().run(args)
|
||||||
|
|
||||||
|
|
||||||
PYWXDUMP_VERSION = pywxdump.__version__
|
|
||||||
|
|
||||||
|
|
||||||
class CustomArgumentParser(argparse.ArgumentParser):
|
class CustomArgumentParser(argparse.ArgumentParser):
|
||||||
def format_help(self):
|
def format_help(self):
|
||||||
# 首先显示软件简介
|
# 首先显示软件简介
|
||||||
|
@ -6,13 +6,14 @@
|
|||||||
# Date: 2023/08/21
|
# Date: 2023/08/21
|
||||||
# -------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------
|
||||||
import ctypes
|
import ctypes
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import winreg
|
import winreg
|
||||||
import psutil
|
import psutil
|
||||||
import pymem
|
import pymem
|
||||||
from typing import List, Union
|
from typing import List, Union
|
||||||
from .utils import pattern_scan_all,verify_key,get_exe_version,get_exe_bit
|
from .utils import pattern_scan_all, verify_key, get_exe_version, get_exe_bit
|
||||||
|
|
||||||
ReadProcessMemory = ctypes.windll.kernel32.ReadProcessMemory
|
ReadProcessMemory = ctypes.windll.kernel32.ReadProcessMemory
|
||||||
void_p = ctypes.c_void_p
|
void_p = ctypes.c_void_p
|
||||||
@ -139,7 +140,7 @@ def get_key(pid, db_path, addr_len):
|
|||||||
|
|
||||||
|
|
||||||
# 读取微信信息(account,mobile,name,mail,wxid,key)
|
# 读取微信信息(account,mobile,name,mail,wxid,key)
|
||||||
def read_info(version_list, is_logging=False):
|
def read_info(version_list: dict, is_logging: bool = False, save_path: str = None):
|
||||||
wechat_process = []
|
wechat_process = []
|
||||||
result = []
|
result = []
|
||||||
error = ""
|
error = ""
|
||||||
@ -207,7 +208,14 @@ def read_info(version_list, is_logging=False):
|
|||||||
print(f"[+] {k:>8}: {v}")
|
print(f"[+] {k:>8}: {v}")
|
||||||
print(end="-" * 32 + "\n" if i != len(result) - 1 else "")
|
print(end="-" * 32 + "\n" if i != len(result) - 1 else "")
|
||||||
print("=" * 32)
|
print("=" * 32)
|
||||||
|
if save_path:
|
||||||
|
try:
|
||||||
|
infos = json.load(open(save_path, "r", encoding="utf-8")) if os.path.exists(save_path) else []
|
||||||
|
except:
|
||||||
|
infos = []
|
||||||
|
with open(save_path, "w", encoding="utf-8") as f:
|
||||||
|
infos += result
|
||||||
|
json.dump(infos, f, ensure_ascii=False, indent=4)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user