Added a stat report script.

This commit is contained in:
HuangKangJing
2015-03-07 21:22:57 +08:00
parent 8f12344e50
commit 0d8cbb2762
2 changed files with 31 additions and 1 deletions
+4 -1
View File
@@ -43,7 +43,10 @@ This tool can parse and dump WeChat chat history on a rooted android phone.
```
./dump_html.py decrypted.db resource <contact name> output.html
```
+ Generate statistical report on text messages:
```
./report.sh message_dir
```
### Examples:
See [here](http://ppwwyyxx.com/static/wechat/example.html) for an example html.
Executable
+27
View File
@@ -0,0 +1,27 @@
#!/bin/bash -e
# File: android-interact.sh
# Date: Sat Mar 7 20:57:51 2015 +0800
# Author: Kangjing Huang <[email protected]>
if [[ -z $1 ]]
then
echo "Usage: $0 [Directory of text messages]"
exit 1
fi
echo -e "Filename\tCounts of message\tCounts of chars\tCounts of words"
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for i in "$1"/*.txt
do
echo -en "$i\t"
LINECOUNT=$(cat "$i"| wc -l )
CHARCOUNT=$(cat "$i"| sed 's/.*:[0-9][0-9]:\(.*\)/\1/g' | sed 's/\[.*\]//g' | grep -v img | wc -m)
WORDCOUNT=$(cat "$i"| sed 's/.*:[0-9][0-9]:\(.*\)/\1/g' | sed 's/\[.*\]//g' | grep -v img | wc -w)
echo -e "$LINECOUNT\t$CHARCOUNT\t$WORDCOUNT"
done
IFS=$SAVEIFS