对微信的聊天记录数据库文件EnMicroMsg.db.bak的加密方式有哪些?

对微信的聊天记录数据库文件EnMicroMsg.db.bak的加密方式有哪些?,第1张

一般都是第三方软件实现的加密

使用注意事项:

第一可能要求手机要有ROOT权限;

第二可能在使用第三方软件的时候导致账号的丢失;

不建议进行ROOT,保护自己的隐私及财产的安全。

ROOT是一种存在于UNIX系统(如AIX、BSD等)和类UNIX系统(如大名鼎鼎的Linux,比如稳定到服务器都在用的Debian、适合长期作业成熟老道的Redhat、比较流行的Ubuntu和archlinux等Linux发行版以及Android系统)中的唯一的超级用户,其相当于Windows系统中的SYSTEM(XP及以下)/TrustedInstaller(Vista及以上)用户。其具有系统中所有的权限,如启动或停止一个进程,删除或增加用户,增加或者禁用硬件等等。

在BAE应用中使用云数据库十分简单,数据库列表中的名称即是连接数据库时的dbname。用户名、密码、连接地址和端口在应用中通过环境变量取出。

可使用标准的PHP Mysql 或PHP Mysqli 扩展访问数据库,BAE的PHP中已提供这两个扩展,应用可直接使用。

官方文档,请参考:http://developer.baidu.com/wiki/index.php?title=docs/cplat/rt/mysql

安卓设备已获取root权限,安装SSHDroid(通过ssh、ftp连接手机)

Apple设备越狱,安装OpenSSH插件

0×01 安卓:

很多安卓手机的用户都会遇到这么一个尴尬的问题:手机用久了就不知不觉变得慢了,最后慢到什么都迟钝了。为了解决这个问题和大多数人一样我选择了root设备。

安卓设备在root以后可以对系统文件存在最高级别的 *** 作权限。比如,你在安卓设备上安装了微信,那么root以后通过adb shell你能对微信App的文件配置进行读取修改等 *** 作。

Android应用程序的数据库文件通常会保存在

/data/data/packagename/database 文件夹下,微信App文件存放路径为:/data/data/com.tencent.mm/MicroMsg

首先通过FTP把文件down到本地:

以34位编码(类似于乱码)命名的文件夹中可找到微信账号的加密数据库文件 :EnMicroMsg.db

用数据库管理器打开:提示加密或者不是数据库文件

这里可以用Windows环境下的SQLite Database Browser浏览器打开:

提示输入密码:

那么,加密数据库使用的密码是什么呢?我们又该如何获取到这个密码?通过上网查资料了解到:微信采用手机的IMEI值和微信UIN值的组合来对数据进行加密。

微信账号uin:即user information 微信用户信息识别码,获取微信UIN的方式有两种:

1.通过微信app的“system_config_prefs.xml”配置文件获取微信账号uin

2.通过抓取WEB版微信聊天的数据包获取到uin。

1.1 App 配置文件

find / -name “system_config_prefs.xml”

/data/data/com.tencent.mm/shared_prefs/system_config_prefs.xml

cat /data/data/com.tencent.mm/shared_prefs/system_config_prefs.xml | grep uin

<int name="default_uin" value="146****21" />

1.2 谷歌chrome浏览器登陆WEB版微信:

登陆后新建窗口并访问chrome://net-internals/#events

发送信息 抓包 find uin值

uin:146****21

通过上述两种方法找到的uin值是相同的。

安卓拨号界面输入*#06#获得手机IMEI码:354**********85

IMEI值+uin值组合即为354**********85146****21

md5: http://www.spriteking.com/cmd5/左侧加密

得到32位小写md5值:1cbf8b842f8bf650aa65e5d3ced07735取其前七位:1cbf8b8输入到sql浏览器中。

linux、Mac用户也可以在终端执行:

echo -n "354**********85146****21" | md5sum | cut -c -7

成功打开微信的数据库文件:

Wechat2txt.py:gist.github.com

import os

import sys

import re

import hashlib

import csv

import time

import locale

import getopt

def get_db():

os.popen('adb root').close()

text = os.popen(

'adb shell ls /data/data/com.tencent.mm/MicroMsg/*/EnMicroMsg.db').read()

return text.splitlines()[- 1] if text else ''

def get_default_uin():

os.popen('adb root').close()

text = os.popen(

'adb shell cat /data/data/com.tencent.mm/shared_prefs/system_config_prefs.xml').read()

default_uin = re.findall(

'name="default_uin" value=http://www.ithao123.cn/"([0-9]+)"', text)

return default_uin[0] if default_uin else 0

def get_device_ID():

text = os.popen('adb shell dumpsys iphonesubinfo').read()

device_ID = re.findall('Device ID = ([0-9]+)', text)

return device_ID[0] if device_ID else 0

def get_md5():

default_uin = get_default_uin()

device_ID = get_device_ID()

if default_uin and device_ID:

return hashlib.md5(device_ID + default_uin).hexdigest()[0: 7]

return ''

def parse_msgcsv(msgcsv):

locale.setlocale(locale.LC_ALL, '')

if hasattr(msgcsv, 'title'):

msgcsv = [ooOoo0O + '\n' for ooOoo0O in msgcsv.splitlines()]

pass

OooO0 = csv.reader(msgcsv)

OooO0.next()

for ooOoo0O in OooO0:

try:

II11iiii1Ii, OO0o, Ooo, O0o0Oo, Oo00OOOOO, O0O, O00o0OO, name, iIi1ii1I1, o0, I11II1i, IIIII = ooOoo0O[

: 12]

pass

except:

continue

ooooooO0oo = 'me' if (Oo00OOOOO == '1') else name

IIiiiiiiIi1I1 = time.localtime(int(O00o0OO) / 1000)

I1IIIii = time.strftime("%Y-%m-%d %a %H:%M:%S", IIiiiiiiIi1I1)

yield [name, I1IIIii, ooooooO0oo, iIi1ii1I1, o0]

pass

pass

def get_names(chat):

names = {}

for name, I1IIIii, ooooooO0oo, iIi1ii1I1, o0 in chat:

names[name] = 1

pass

return names.keys()

def oo(chat, name=''):

text = []

name = name.lower()

for name, I1IIIii, ooooooO0oo, iIi1ii1I1, o0 in chat:

iIi1ii1I1 = iIi1ii1I1.replace('\n', '\n ')

o0 = ('\t' + o0) if o0 else ''

if not name:

text.append('%s: %s %s: %s %s' %

(name, I1IIIii, ooooooO0oo, iIi1ii1I1, o0))

pass

elif name.lower() == name:

text.append('%s %s: %s %s' %

(I1IIIii, ooooooO0oo, iIi1ii1I1, o0))

pass

pass

return '\n'.join(text) + '\n'

def IIIii1II1II(dbn, key=''):

child_stdin, child_stdout = os.popen2(['sqlcipher', dbn])

if key:

child_stdin.write('PRAGMA key=%s\n' % ` key `)

child_stdin.write('pragma cipher_use_hmac=off\n')

pass

child_stdin.write('.tables\n')

child_stdin.close()

return child_stdout.read().split()

def decrypt(dbn, key='', table='message'):

table = table or 'message'

child_stdin, child_stdout = os.popen2(['sqlcipher', dbn])

child_stdin.write('.header on\n')

child_stdin.write('.mode csv\n')

if key:

child_stdin.write('PRAGMA key=%s\n' % ` key `)

child_stdin.write('pragma cipher_use_hmac=off\n')

pass

child_stdin.write('select * from %s\n' % ` table `)

child_stdin.close()

return child_stdout.read()

def wechat2txt(names=[]):

in_file = 'EnMicroMsg.db'

out_file = 'message.csv'

db = get_db()

md5 = get_md5()

os.popen('adb wait-for-device')

os.popen('adb pull %s %s' % (db, in_file)).close()

msgcsv = decrypt(in_file, md5)

if msgcsv.find('\n') <0:

return 1

file(out_file, 'w').write(msgcsv)

msgs = list(parse_msgcsv(msgcsv))

if not msgs:

return 1

if not names:

names = get_names(msgs)

pass

for name in names:

filename = 'message.%s.txt' % name

text = oo(msgs, name)

if len(text) >4:

file(filename, 'w').write(text)

pass

pass

pass

help_msg = '''Usage: wechat2txt.py [OPTIONS] [NAME]...

OPTIONS:

-hdisplay this help and exit

'''

def main():

try:

opts, args = getopt.getopt(sys.argv[1:], 'h')

except getopt.error, e:

print help_msg

return 1

for opt, arg in opts:

if opt == '-h':

print help_msg

return 1

pass

names = args

text = wechat2txt(names)

return not text

if __name__ == "__main__":

sys.exit(main())

0×02 苹果:

Apple设备越狱后可通过Cydia安装各种小插件,通常情况我会安装OpenSSH来使自己能通过终端连接到Apple设备中,并使用sftp传输文件:

iOS中,应用文件夹以hash值命名,要导出微信、QQ的聊天记录其难度相对安卓来说稍微复杂很多。

在实际 *** 作中我们可以通过巧用Linux命令(find、grep、xargs)来绕过这些坑。

find /var/mobile/Containers/Data -name "MM.sqlite"

mkdir /cache

find /var/mobile/Containers/Data -name "MM.sqlite" |xargs -I {} dirname {} | xargs -I {} cp -r {}/../../ /cache

附上出处链接:http://www.07net01.com/program/2016/07/1603637.html


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/8958158.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-23
下一篇 2023-04-23

发表评论

登录后才能评论

评论列表(0条)

保存