-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 23 | ||
buildToolsVersion "23.0.2" | ||
|
||
defaultConfig { | ||
applicationId "moe.chionlab.wechatmomentstat" | ||
minSdkVersion 15 | ||
targetSdkVersion 23 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
provided fileTree(dir: 'libs', include: ['*.jar']) | ||
testCompile 'junit:junit:4.12' | ||
compile 'com.android.support:appcompat-v7:23.1.1' | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in /Users/chiontang/Library/Android/sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package moe.chionlab.wechatmomentstat; | ||
|
||
import android.app.Application; | ||
import android.test.ApplicationTestCase; | ||
|
||
/** | ||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> | ||
*/ | ||
public class ApplicationTest extends ApplicationTestCase<Application> { | ||
public ApplicationTest() { | ||
super(Application.class); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="moe.chionlab.wechatmomentstat"> | ||
|
||
<uses-permission android:name="android.permission.ACCESS_SUPERUSER" /> | ||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<meta-data | ||
android:name="xposedmodule" | ||
android:value="true" /> | ||
<meta-data | ||
android:name="xposedminversion" | ||
android:value="30" /> | ||
<meta-data | ||
android:name="xposeddescription" | ||
android:value="Export WeChat moments and get statistics." /> | ||
|
||
<activity android:name=".gui.MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
moe.chionlab.wechatmomentstat.Main |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package moe.chionlab.wechatmomentstat; | ||
|
||
import android.os.Environment; | ||
|
||
/** | ||
* Created by chiontang on 2/4/16. | ||
*/ | ||
public class Config { | ||
|
||
static boolean ready = false; | ||
|
||
final static public String EXT_DIR = Environment.getExternalStorageDirectory() + "/WeChatMomentStat"; | ||
final static public String DATA_DIR = Environment.getDataDirectory() + "/data/moe.chionlab.wechatmomentstat"; | ||
|
||
final static public String WECHAT_PACKAGE = "com.tencent.mm"; | ||
|
||
final static String[] VERSIONS = {"6.3.13.49_r4080b63", "6.3.13.64_r4488992"}; | ||
final static String[] PROTOCAL_SNS_DETAIL_CLASSES = {"com.tencent.mm.protocal.b.atp", "com.tencent.mm.protocal.b.atp"}; | ||
final static String[] PROTOCAL_SNS_DETAIL_METHODS = {"a", "a"}; | ||
final static String[] SNS_XML_GENERATOR_CLASSES = {"com.tencent.mm.plugin.sns.f.i", "com.tencent.mm.plugin.sns.f.i"}; | ||
final static String[] SNS_XML_GENERATOR_METHODS = {"a", "a"}; | ||
final static String[] PROTOCAL_SNS_OBJECT_CLASSES = {"com.tencent.mm.protocal.b.aqi", "com.tencent.mm.protocal.b.aqi"}; | ||
final static String[] PROTOCAL_SNS_OBJECT_METHODS = {"a", "a"}; | ||
final static String[] PROTOCAL_SNS_OBJECT_USERID_FIELDS = {"iYA", "iYA"}; | ||
final static String[] PROTOCAL_SNS_OBJECT_NICKNAME_FIELDS = {"jyd", "jyd"}; | ||
final static String[] PROTOCAL_SNS_OBJECT_TIMESTAMP_FIELDS = {"fpL", "fpL"}; | ||
final static String[] PROTOCAL_SNS_OBJECT_COMMENTS_FIELDS = {"jJX", "jJX"}; | ||
final static String[] PROTOCAL_SNS_OBJECT_LIKES_FIELDS = {"jJU", "jJU"}; | ||
final static String[] SNS_OBJECT_EXT_AUTHOR_NAME_FIELDS = {"jyd", "jyd"}; | ||
final static String[] SNS_OBJECT_EXT_REPLY_TO_FIELDS = {"jJM", "jJM"}; | ||
final static String[] SNS_OBJECT_EXT_COMMENT_FIELDS = {"fsI", "fsI"}; | ||
final static String[] SNS_OBJECT_EXT_AUTHOR_ID_FIELDS = {"iYA", "iYA"}; | ||
final static String[] SNS_DETAIL_FROM_BIN_METHODS = {"am", "am"}; | ||
final static String[] SNS_OBJECT_FROM_BIN_METHODS = {"am", "am"}; | ||
|
||
static String PROTOCAL_SNS_DETAIL_CLASS; | ||
static String PROTOCAL_SNS_DETAIL_METHOD; | ||
static String SNS_XML_GENERATOR_CLASS; | ||
static String SNS_XML_GENERATOR_METHOD; | ||
static String PROTOCAL_SNS_OBJECT_CLASS; | ||
static String PROTOCAL_SNS_OBJECT_METHOD; | ||
static String PROTOCAL_SNS_OBJECT_USERID_FIELD; | ||
static String PROTOCAL_SNS_OBJECT_NICKNAME_FIELD; | ||
static String PROTOCAL_SNS_OBJECT_TIMESTAMP_FIELD; | ||
static String PROTOCAL_SNS_OBJECT_COMMENTS_FIELD; | ||
static String PROTOCAL_SNS_OBJECT_LIKES_FIELD; | ||
static String SNS_OBJECT_EXT_AUTHOR_NAME_FIELD; | ||
static String SNS_OBJECT_EXT_REPLY_TO_FIELD; | ||
static String SNS_OBJECT_EXT_COMMENT_FIELD; | ||
static String SNS_OBJECT_EXT_AUTHOR_ID_FIELD; | ||
static String SNS_DETAIL_FROM_BIN_METHOD; | ||
static String SNS_OBJECT_FROM_BIN_METHOD; | ||
|
||
static public void initWeChatVersion(String version) { | ||
for (int i=0;i<VERSIONS.length;i++) { | ||
if (VERSIONS[i].equals(version)) { | ||
Config.setConstants(i); | ||
Config.ready = true; | ||
return; | ||
} | ||
} | ||
Config.ready = false; | ||
} | ||
|
||
static private void setConstants(int index) { | ||
PROTOCAL_SNS_DETAIL_CLASS = PROTOCAL_SNS_DETAIL_CLASSES[index]; | ||
PROTOCAL_SNS_DETAIL_METHOD = PROTOCAL_SNS_DETAIL_METHODS[index]; | ||
SNS_XML_GENERATOR_CLASS = SNS_XML_GENERATOR_CLASSES[index]; | ||
SNS_XML_GENERATOR_METHOD = SNS_XML_GENERATOR_METHODS[index]; | ||
PROTOCAL_SNS_OBJECT_CLASS = PROTOCAL_SNS_OBJECT_CLASSES[index]; | ||
PROTOCAL_SNS_OBJECT_METHOD = PROTOCAL_SNS_OBJECT_METHODS[index]; | ||
PROTOCAL_SNS_OBJECT_USERID_FIELD = PROTOCAL_SNS_OBJECT_USERID_FIELDS[index]; | ||
PROTOCAL_SNS_OBJECT_NICKNAME_FIELD = PROTOCAL_SNS_OBJECT_NICKNAME_FIELDS[index]; | ||
PROTOCAL_SNS_OBJECT_TIMESTAMP_FIELD = PROTOCAL_SNS_OBJECT_TIMESTAMP_FIELDS[index]; | ||
PROTOCAL_SNS_OBJECT_COMMENTS_FIELD = PROTOCAL_SNS_OBJECT_COMMENTS_FIELDS[index]; | ||
PROTOCAL_SNS_OBJECT_LIKES_FIELD = PROTOCAL_SNS_OBJECT_LIKES_FIELDS[index]; | ||
SNS_OBJECT_EXT_AUTHOR_NAME_FIELD = SNS_OBJECT_EXT_AUTHOR_NAME_FIELDS[index]; | ||
SNS_OBJECT_EXT_REPLY_TO_FIELD = SNS_OBJECT_EXT_REPLY_TO_FIELDS[index]; | ||
SNS_OBJECT_EXT_COMMENT_FIELD = SNS_OBJECT_EXT_COMMENT_FIELDS[index]; | ||
SNS_OBJECT_EXT_AUTHOR_ID_FIELD = SNS_OBJECT_EXT_AUTHOR_ID_FIELDS[index]; | ||
SNS_DETAIL_FROM_BIN_METHOD = SNS_DETAIL_FROM_BIN_METHODS[index]; | ||
SNS_OBJECT_FROM_BIN_METHOD = SNS_OBJECT_FROM_BIN_METHODS[index]; | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package moe.chionlab.wechatmomentstat; | ||
|
||
import android.app.Activity; | ||
import android.content.Context; | ||
import android.content.pm.PackageInfo; | ||
import de.robv.android.xposed.XC_MethodHook; | ||
import de.robv.android.xposed.XposedBridge; | ||
import de.robv.android.xposed.XposedHelpers; | ||
import de.robv.android.xposed.callbacks.XC_LoadPackage; | ||
|
||
/** | ||
* Created by chiontang on 2/11/16. | ||
*/ | ||
public class Hook { | ||
|
||
Class SnsDetail = null; | ||
Class SnsDetailParser = null; | ||
Class SnsObject = null; | ||
|
||
Context wechatContext = null; | ||
|
||
XC_LoadPackage.LoadPackageParam lpparam = null; | ||
XC_MethodHook.MethodHookParam param = null; | ||
|
||
SnsReader bgTask = null; | ||
|
||
Hook(XC_LoadPackage.LoadPackageParam lpparam, XC_MethodHook.MethodHookParam param) { | ||
this.lpparam = lpparam; | ||
this.param = param; | ||
} | ||
|
||
public void initHook() throws Throwable { | ||
initWeChatVersion(param.thisObject, "com.tencent.mm"); | ||
if (!Config.ready) { | ||
XposedBridge.log("Unsupported WeChat version."); | ||
return; | ||
} | ||
getClasses(lpparam.classLoader); | ||
SnsReader snsReader = new SnsReader(SnsDetail, SnsDetailParser, SnsObject); | ||
snsReader.run(); | ||
} | ||
|
||
protected void initWeChatVersion(Object wechatActivity, String packageName) throws Throwable{ | ||
XposedBridge.log("LauncherUI hooked."); | ||
Context appContext = ((Activity)wechatActivity).getApplicationContext(); | ||
wechatContext = appContext; | ||
PackageInfo pInfo = appContext.getPackageManager().getPackageInfo(packageName, 0); | ||
String wechatVersion = ""; | ||
if (pInfo != null) | ||
wechatVersion = pInfo.versionName; | ||
XposedBridge.log("WeChat version=" + wechatVersion); | ||
Config.initWeChatVersion(wechatVersion); | ||
} | ||
|
||
protected void getClasses(ClassLoader classLoader) throws Throwable { | ||
SnsDetailParser = XposedHelpers.findClass(Config.SNS_XML_GENERATOR_CLASS, classLoader); | ||
SnsDetail = XposedHelpers.findClass(Config.PROTOCAL_SNS_DETAIL_CLASS, classLoader); | ||
SnsObject = XposedHelpers.findClass(Config.PROTOCAL_SNS_OBJECT_CLASS, classLoader); | ||
} | ||
|
||
} |