plt by hour

This commit is contained in:
ppwwyyxx
2014-11-21 15:57:44 +08:00
parent 55a33c1cf6
commit 199ced0087
2 changed files with 21 additions and 5 deletions
+2 -2
View File
@@ -4,8 +4,8 @@
+ Get /data/data/com.tencent.mm/MicroMsg/long-long-name/EnMicroMsg.db from rooted phone:
+ Get wechat uin:
1. log on [web-based wechat](https://wx.qq.com)
2. get wxuin=1234567 from `document.cookie`
+ log on [web-based wechat](https://wx.qq.com); get wxuin=1234567 from `document.cookie`
+ Or get ``default_uin`` from /data/data/com.tencent.mm/shared_prefs/system_config_prefs.xml.
+ Get phone IMEI:
+ Call `*#06#` on your phone
+ Or find IMEI in system settings
+19 -3
View File
@@ -1,13 +1,13 @@
#!/usr/bin/env python2
# -*- coding: UTF-8 -*-
# File: plot_num_msg_by_time.py
# Date: Fri Nov 21 15:19:00 2014 +0800
# Date: Fri Nov 21 15:57:40 2014 +0800
# Author: Yuxin Wu <[email protected]>
from lib.Parser import WeChatDBParser
from lib.utils import ensure_unicode
from datetime import timedelta
from datetime import timedelta, datetime
import numpy as np
import matplotlib.pyplot as plt
import sys, os
@@ -15,9 +15,9 @@ import sys, os
if len(sys.argv) != 3:
sys.exit("Usage: {0} <path to decrypted_database.db> <name>".format(sys.argv[0]))
every_k_days = 2
db_file = sys.argv[1]
name = ensure_unicode(sys.argv[2])
every_k_days = 2
parser = WeChatDBParser(db_file)
parser.parse()
@@ -35,3 +35,19 @@ plt.xlabel("Date")
plt.ylabel("Number of msgs in k days")
plt.hist(diffs, bins=max_day / every_k_days)
plt.show()
# statistics by hour
# I'm in a different time zone in this period:
#TZ_DELTA = {(datetime(2014, 7, 13), datetime(2014, 10, 1)): -15}
#def real_hour(x):
#for k, v in TZ_DELTA.iteritems():
#if x > k[0] and x < k[1]:
#print x
#return (x.hour + v + 24) % 24
#return x.hour
#hours = [real_hour(x) for x in times]
#plt.ylabel("Number of msgs")
#plt.xlabel("Hour in a day")
#plt.hist(hours, bins=24)
#plt.show()