Coder Social home page Coder Social logo

运行失败 about chatviewtool HOT 1 OPEN

Robinlmx avatar Robinlmx commented on June 29, 2024
运行失败

from chatviewtool.

Comments (1)

guanquanchen avatar guanquanchen commented on June 29, 2024

不需要了,我使用了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)

from chatviewtool.

Related Issues (10)

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.