From b80bbb39c2de92a3261bb48b96d3ef83c3467fda Mon Sep 17 00:00:00 2001 From: ppwwyyxx Date: Sun, 12 Apr 2015 21:10:11 +0800 Subject: [PATCH] some small change --- README.md | 3 +-- android-interact.sh | 2 +- report.sh => count-message.sh | 8 ++++---- libchat/libchat.py | 13 ++++++++++++- 4 files changed, 18 insertions(+), 8 deletions(-) rename report.sh => count-message.sh (88%) diff --git a/README.md b/README.md index a0de5be..378fcfc 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ This tool can parse and dump WeChat chat history on a rooted android phone. + adb and rooted android phone connected to PC #### Get Necessary Data: -+ Get decrypted WeChat database (Linux only): ++ Get decrypted WeChat database (Linux & Mac Only): + Automatic: `./android-interact.sh db_decrypt` + Manual: + Get /data/data/com.tencent.mm/MicroMsg/long-long-name/EnMicroMsg.db from *root* filesystem, possible ways are: @@ -60,7 +60,6 @@ Screenshots: + Skip existing files when copying android resources + Fix rare unhandled types: > 10000 and < 0 + Better user experiences... see `grep 'TODO' lib -R` -+ mac support (For now you will have to compile sqlcipher 2.1.1 by yourself. Also, shell script might work on BSD) + more easy-to-use for non-programmers (GUI?) ### Disclaimers diff --git a/android-interact.sh b/android-interact.sh index b0bc3a9..28f94d8 100755 --- a/android-interact.sh +++ b/android-interact.sh @@ -1,6 +1,6 @@ #!/bin/bash -e # File: android-interact.sh -# Date: Sun Feb 01 17:26:48 2015 +0800 +# Date: Sun Apr 12 21:19:07 2015 +0900 # Author: Yuxin Wu source compatibility.sh diff --git a/report.sh b/count-message.sh similarity index 88% rename from report.sh rename to count-message.sh index 40e3566..7d496cb 100755 --- a/report.sh +++ b/count-message.sh @@ -1,16 +1,16 @@ #!/bin/bash -e -# File: android-interact.sh -# Date: Sat Mar 7 20:57:51 2015 +0800 +# File: count-message.sh +# Date: Sun Apr 12 21:01:01 2015 +0900 # Author: Kangjing Huang if [[ -z $1 ]] -then +then echo "Usage: $0 [Directory of text messages]" exit 1 fi -echo -e "Filename\tCounts of message\tCounts of chars\tCounts of words" +echo -e "Filename\tCounts of message\tCounts of chars\tCounts of words" SAVEIFS=$IFS IFS=$(echo -en "\n\b") diff --git a/libchat/libchat.py b/libchat/libchat.py index 0662163..360dc6a 100644 --- a/libchat/libchat.py +++ b/libchat/libchat.py @@ -1,7 +1,7 @@ #!/usr/bin/env python2 # -*- coding: UTF-8 -*- # File: libchat.py -# Date: Sat Mar 28 00:08:29 2015 +0800 +# Date: Sun Apr 12 21:08:51 2015 +0900 # Author: Yuxin Wu import sqlite3 import os @@ -14,6 +14,16 @@ NUM_FIELDS = 8 ChatMsgBase = namedtuple('ChatMsgBase', ['source', 'time', 'sender', 'chatroom', 'text', 'image', 'sound', 'extra_data']) +""" source: unicode, + time: datetime, + sender: unicode, + chatroom: unicode, + text: unicode, + image: string, + sound: string, + extra_data: string +""" + class ChatMsg(ChatMsgBase): def __repr__(self): # repr must return str? return "Msg@{}/{}-{}/{}/{}/{}/{}".format( @@ -56,6 +66,7 @@ class SqliteLibChat(object): ','.join(['?']*NUM_FIELDS)), tp) def add_msgs(self, msgs): + """ each message is a ChatMsg instance""" self.c = self.conn.cursor() for m in msgs: self._add_msg(SqliteLibChat.prefilter(m))