|
|
@@ -134,41 +134,43 @@ public class MockHackingHelper {
|
|
|
* @return
|
|
|
*/
|
|
|
private boolean antiFrida(Context applicationContext) {
|
|
|
- ActivityManager am = (ActivityManager) applicationContext.getSystemService(Context.ACTIVITY_SERVICE);
|
|
|
- List<ActivityManager.RunningAppProcessInfo> appList = am.getRunningAppProcesses();
|
|
|
-
|
|
|
- if (appList != null) {
|
|
|
- for (ActivityManager.RunningAppProcessInfo runningAppProcessInfo : appList) {
|
|
|
- if (runningAppProcessInfo != null) {
|
|
|
- int pid = runningAppProcessInfo.pid; //실행중인 프로세스의 pid
|
|
|
-
|
|
|
- String maps = "/proc/" + pid + "/maps"; //실행중인 프로세스의 메모리 맵 열람
|
|
|
- File file = new File(maps);
|
|
|
- FileReader mapContent = null;
|
|
|
- try {
|
|
|
- mapContent = new FileReader(file);
|
|
|
- BufferedReader br = new BufferedReader(mapContent);
|
|
|
- String line;
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
+ if(applicationContext != null) {
|
|
|
+ ActivityManager am = (ActivityManager) applicationContext.getSystemService(Context.ACTIVITY_SERVICE);
|
|
|
+ List<ActivityManager.RunningAppProcessInfo> appList = am.getRunningAppProcesses();
|
|
|
+
|
|
|
+ if (appList != null) {
|
|
|
+ for (ActivityManager.RunningAppProcessInfo runningAppProcessInfo : appList) {
|
|
|
+ if (runningAppProcessInfo != null) {
|
|
|
+ int pid = runningAppProcessInfo.pid; //실행중인 프로세스의 pid
|
|
|
+
|
|
|
+ String maps = "/proc/" + pid + "/maps"; //실행중인 프로세스의 메모리 맵 열람
|
|
|
+ File file = new File(maps);
|
|
|
+ FileReader mapContent = null;
|
|
|
try {
|
|
|
- while ((line = br.readLine()) != null) {
|
|
|
- sb.append(line); //메모리 맵 내용
|
|
|
- }
|
|
|
- String str = sb.toString().toLowerCase();
|
|
|
- int index = str.indexOf("frida-agent"); //실행중인 메모리가 프리다에 의해 제어 받고 있는지 확인
|
|
|
- if (index >= 0) {
|
|
|
- googleAnalyticsHelper.sendGA(TAG, "antiFrida", runningAppProcessInfo.processName);
|
|
|
- return false;
|
|
|
+ mapContent = new FileReader(file);
|
|
|
+ BufferedReader br = new BufferedReader(mapContent);
|
|
|
+ String line;
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ try {
|
|
|
+ while ((line = br.readLine()) != null) {
|
|
|
+ sb.append(line); //메모리 맵 내용
|
|
|
+ }
|
|
|
+ String str = sb.toString().toLowerCase();
|
|
|
+ int index = str.indexOf("frida-agent"); //실행중인 메모리가 프리다에 의해 제어 받고 있는지 확인
|
|
|
+ if (index >= 0) {
|
|
|
+ googleAnalyticsHelper.sendGA(TAG, "antiFrida", runningAppProcessInfo.processName);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ if (BuildConfig.DEBUG) {
|
|
|
+ LogHelper.w(getClass().getSimpleName(), "antiFrida: IOException");
|
|
|
+ }
|
|
|
}
|
|
|
- } catch (IOException e) {
|
|
|
+ } catch (FileNotFoundException e) {
|
|
|
if (BuildConfig.DEBUG) {
|
|
|
- LogHelper.w(getClass().getSimpleName(), "antiFrida: IOException");
|
|
|
+ LogHelper.w(getClass().getSimpleName(), "antiFrida: FileNotFoundException");
|
|
|
}
|
|
|
}
|
|
|
- } catch (FileNotFoundException e) {
|
|
|
- if (BuildConfig.DEBUG) {
|
|
|
- LogHelper.w(getClass().getSimpleName(), "antiFrida: FileNotFoundException");
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
}
|