chatViewTool icon indicating copy to clipboard operation
chatViewTool copied to clipboard

运行失败

Open Robinlmx opened this issue 2 years ago • 1 comments

我使用的是java -jar命令,jar包也是和MSG文件同一个目录的,bin文件里面放着秘钥,但是点击查看数据库的时候还是报错

[-][SQLITE_ERROR] SQL error or missing database (no such table: Session) Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1774) at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1657) at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191) at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74) at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49) at javafx.event.Event.fireEvent(Event.java:198) at javafx.scene.Node.fireEvent(Node.java:8411) at javafx.scene.control.Button.fire(Button.java:185) at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182) at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96) at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89) at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218) at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191) at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74) at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54) at javafx.event.Event.fireEvent(Event.java:198) at javafx.scene.Scene$MouseHandler.process(Scene.java:3760) at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3488) at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1765) at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2497) at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:397) at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:434) at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:411) at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:433) at com.sun.glass.ui.View.handleMouseEvent(View.java:555) at com.sun.glass.ui.View.notifyMouse(View.java:941) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:185) at java.lang.Thread.run(Thread.java:750) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71) at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275) at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1771) ... 48 more Caused by: java.lang.NullPointerException at com.example.wxdep.HelloController.getSessionList(HelloController.java:143) at com.example.wxdep.HelloController.onMsgInfoButtonClick(HelloController.java:104) ... 58 more

Robinlmx avatar Apr 07 '23 12:04 Robinlmx

不需要了,我使用了python解决了这个问题。 很简单得一点的代码。

我把全部代码给你了 不懂得话

电话问我也行 18369627908

import os import shutil import sys

import traceback import os import shutil import sys

def get_all_file(path): # import os return_list=[] for root,dirs,files in os.walk(path,topdown=True): for file_one in files: use_path=root+'/'+file_one return_list.append(use_path.replace('\','/')) return return_list

def del_file(path): #!/usr/bin/env python import os import shutil filelist=[] rootdir=path filelist=os.listdir(rootdir) for f in filelist: filepath = os.path.join( rootdir, f ) if os.path.isfile(filepath): os.remove(filepath) #print filepath+" removed!" elif os.path.isdir(filepath): shutil.rmtree(filepath,True) #print "dir "+filepath+" removed!"

def make_file(path): try: os.makedirs(path) except: pass

def get_all_txt(txt_path): return_list=[] lines = open(txt_path,'r',encoding='utf8',errors='ignore') for line in lines: # print(line) # line=line.replace(' ','') line=line.replace('\n','') return_list.append(line) # if 'def ' in line and '(' in line and ')' in line: # return_list.append(str(line))

    # return_list.append(int(line))
lines.close()
return return_list

import os

获得打包以后得路径。

def get_exe_path(relative_path=''): if hasattr(sys, '_MEIPASS'): return os.path.join(sys._MEIPASS, relative_path) return os.path.join(os.path.abspath("."), relative_path)[:-1]

def get_year_month_day_number(): import datetime year=str(int(datetime.datetime.now().year)) month=str(int(datetime.datetime.now().month)) day=str(int(datetime.datetime.now().day)) return year+'-'+month+'-'+day

import xlsxwriter def write_xlsx_list(path,write_list): workbook_zheng = xlsxwriter.Workbook(path) #新建excel表 worksheet_zheng = workbook_zheng.add_worksheet('sheet1') #新建sheet(sheet的名称为"sheet1") # worksheet_zheng.set_column(0,1,50) # worksheet_zheng.set_column(1,2,20) # worksheet_zheng.set_column(2,10,50) for fx in range(0,len(write_list)): try: x_list=write_list[fx] for fy in range(0,len(x_list)): y_v=x_list[fy] worksheet_zheng.write(fx,fy,y_v) # print(x_list) except: pass workbook_zheng.close()

#--------------------------------------------------------------------------------------------------------------------------------------------------------------------- def get_xlsx_list(xlsx_path,sign=0): import xlrd read_one=xlsx_path match_write_in_fp=xlrd.open_workbook(xlsx_path) sheet_names_list = match_write_in_fp.sheet_names() sh_read=match_write_in_fp.sheet_by_name(sheet_names_list[0]) #根据sheet索引获得第一个sheet。 # print(sh_read.row_values(0)) sum_list=[] for line_number in range(sign,sh_read.nrows): try: alone_line=sh_read.row_values(line_number) sum_list.append(alone_line) except: pass return sum_list

import os

import sys

获得打包以后得路径。

def get_exe_path(relative_path=''): if hasattr(sys, '_MEIPASS'): return os.path.join(sys._MEIPASS, relative_path) return os.path.join(os.path.abspath("."), relative_path)[:-1]

#! /usr/bin/env python3

-- coding: utf-8 --

import hmac import ctypes import hashlib import argparse from Crypto.Cipher import AES

def decrypt_msg(path,write_file, password): KEY_SIZE = 32 DEFAULT_ITER = 64000 DEFAULT_PAGESIZE = 4096 # 4048数据 + 16IV + 20 HMAC + 12 SQLITE_FILE_HEADER = bytes("SQLite format 3", encoding="ASCII") + bytes(1) # SQLite 文件头

with open(path, "rb") as f:
    # TODO: 优化,考虑超大文件
    blist = f.read()

salt = blist[:16]  # 前16字节为盐
key = hashlib.pbkdf2_hmac("sha1", password, salt, DEFAULT_ITER, KEY_SIZE)  # 获得Key

page1 = blist[16:DEFAULT_PAGESIZE]  # 丢掉salt

mac_salt = bytes([x ^ 0x3a for x in salt])
mac_key = hashlib.pbkdf2_hmac("sha1", key, mac_salt, 2, KEY_SIZE)

hash_mac = hmac.new(mac_key, digestmod="sha1")
hash_mac.update(page1[:-32])
hash_mac.update(bytes(ctypes.c_int(1)))

if hash_mac.digest() != page1[-32:-12]:
    raise RuntimeError("密码错误!")

pages = [blist[i:i+DEFAULT_PAGESIZE] for i in range(DEFAULT_PAGESIZE, len(blist), DEFAULT_PAGESIZE)]
pages.insert(0, page1)  # 把第一页补上
with open(write_file, "wb") as f:
    f.write(SQLITE_FILE_HEADER)  # 写入文件头

    for i in pages:
        t = AES.new(key, AES.MODE_CBC, i[-48:-32])
        f.write(t.decrypt(i[:-48]))
        f.write(i[-48:])

def get_new_file(read_file,write_path,use_key): # try: if 1==1: # parse = argparse.ArgumentParser() # parse.add_argument("-p", read_file, type=str, required=True, help="待解密数据库路径") # parse.add_argument("-k", use_key, type=str, required=True, help="通过 GetWeChatAesKey.py 获取到的密码") # # parse.add_argument("-p", "--path", type=str, required=True, help=read_file) # # parse.add_argument("-k", "--key", type=str, required=True, help=use_key) # args = parse.parse_args() key = bytes.fromhex(use_key) # path = args.path decrypt_msg(read_file,write_file, key) # except Exception as e : # pass # print(e)

w文件区域。

main_path=os.getcwd() # exe文件存放的路径。 exe_path=get_exe_path() # 打包以后资源文件存放的路径。

read_path=main_path+'/读取文件' write_path=main_path+'/写入文件'

temp_path=main_path+'/临时文件'

make_file(read_path) make_file(write_path)

for one in get_all_file(read_path): print(one) write_file = one.replace(r'C:/Users/Lenovo/Desktop/读取文件/Msg',write_path) try: get_new_file(one,write_file,'填入你的额数据库密码') except Exception as e: print(e)

guanquanchen avatar Apr 07 '23 13:04 guanquanchen