dubsmash音楽素材取得
3784 ワード
データはhttps/aes暗号化伝送を採用し、分析に少なからぬ面倒をもたらし、最後にrootクライアントを採用して解決する.
int jsoncnt=0;
String lang="";
public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable {
// XposedBridge.log("lzf Loaded app? " + lpparam.packageName);
if (!lpparam.packageName.contains("com.mobilemotion.dubsmash"))
return;
XposedBridge.log("lzf Loaded app: " + lpparam.packageName);
findAndHookMethod("com.android.volley.Request", lpparam.classLoader, "getUrl",
new XC_MethodHook() {
@Override
protected void afterHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
String ret = (String) param.getResult();
// Log.i("lzf request:", param.thisObject.toString());
Log.i("lzf url:", (String) ret);
}
});
XposedHelpers.findAndHookConstructor(Class.forName("org.json.JSONObject"), String.class,
new XC_MethodHook() {
@Override
protected void afterHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
saveJson((String) param.args[0]);
//Log.i("lzf json:", (String) param.args[0]);
}
});
findAndHookMethod("com.mobilemotion.dubsmash.requests.DiscoverRequest", lpparam.classLoader, "setLanguages", String.class,
new XC_MethodHook() {
@Override
protected void afterHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
String langjson = (String) param.args[0];
if(langjson==null) return;
String [] lans=langjson.split("\"");
if(lans.length<3) return;
lang = lans[3];
}
});
XposedHelpers.findAndHookConstructor(Class.forName("org.json.JSONArray"), String.class,
new XC_MethodHook() {
@Override
protected void afterHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
saveJson((String)param.args[0]);
//Log.i("lzf json:", (String)param.args[0]);
}
});
}
private void saveJson(String arg) {
if(arg==null) return;
if(!arg.startsWith("{\"creator\"") && !arg.startsWith("{\"results\"") &&
!arg.startsWith("[{\"type\"") && !arg.startsWith("{\"page\"") && !arg.startsWith("{\"paginate_by\"")
) {
Log.i("lzf", "ignore json:"+arg);
return;
}
try {
File basedir = new File("/sdcard/dubsmash/"+lang);
if(!basedir.exists())
{
basedir.mkdirs();
}
File sf = new File(basedir, String.format("%05d", jsoncnt)+".json");
OutputStream ostream = new FileOutputStream(sf);
OutputStreamWriter osw = new OutputStreamWriter(ostream);
osw.write(arg, 0, arg.length());
osw.flush();
osw.close();
ostream.close();
jsoncnt+=1;
} catch (Exception e) {
e.printStackTrace();
}
}