Info Call to command execution API

Description

List of all command execution API calls

Recommendation

This entry is informative, no recommendations applicable.

Technical details

Method com.baidu.android.pushservice.i.l.c() calling method java.lang.Runtime.exec()


    private static int c(String p10)
    {
        java.io.Closeable[] v0_0 = 0;
        try {
            int v4_1 = Runtime.getRuntime();
            int v5_4 = new StringBuilder();
            v5_4.append("/system/bin/ping -w 1 ");
            v5_4.append(p10);
            int v4_0 = v4_1.exec(v5_4.toString());
            try {
                int v5_1 = new java.io.InputStreamReader(v4_0.getInputStream());
                try {
                    java.io.BufferedReader v6_2 = new java.io.BufferedReader(v5_1);
                    try {
                        new String();
                        java.io.Closeable[] v0_2 = 0;
                    } catch (java.io.Closeable[] v10_1) {
                        v0_0 = v6_2;
                        java.io.Closeable[] v1_1 = new java.io.Closeable[2];
                        v1_1[0] = v0_0;
                        v1_1[1] = v5_1;
                        com.baidu.android.pushservice.e.b.a(v1_1);
                        if (v4_0 != 0) {
                            v4_0.destroy();
                        }
                        throw v10_1;
                    } catch (Exception) {
                        v0_0 = v6_2;
                        java.io.Closeable[] v10_2 = new java.io.Closeable[2];
                        v10_2[0] = v0_0;
                        v10_2[1] = v5_1;
                        com.baidu.android.pushservice.e.b.a(v10_2);
                        if (v4_0 != 0) {
                            v4_0.destroy();
                        }
                        return 1;
                    }
                    do {
                        int v7_0 = v6_2.readLine();
                        if (v7_0 == 0) {
                            break;
                        }
                        v0_2++;
                        String v8_1 = new StringBuilder();
                        v8_1.append("64 bytes from ");
                        v8_1.append(p10);
                        if (!v7_0.contains(v8_1.toString())) {
                        } else {
                            java.io.Closeable[] v10_4 = new java.io.Closeable[2];
                            v10_4[0] = v6_2;
                            v10_4[1] = v5_1;
                            com.baidu.android.pushservice.e.b.a(v10_4);
                            if (v4_0 != 0) {
                                v4_0.destroy();
                            }
                            return 0;
                        }
                    } while(v0_2 <= 3);
                    java.io.Closeable[] v0_3 = new java.io.Closeable[2];
                    v0_3[0] = v6_2;
                    v0_3[1] = v5_1;
                    com.baidu.android.pushservice.e.b.a(v0_3);
                    if (v4_0 != 0) {
                        v4_0.destroy();
                    }
                    return -1;
                } catch (java.io.Closeable[] v10_1) {
                } catch (Exception) {
                }
            } catch (java.io.Closeable[] v10_1) {
                v5_1 = 0;
            } catch (Exception) {
                v5_1 = 0;
            }
        } catch (java.io.Closeable[] v10_1) {
            v4_0 = 0;
            v5_1 = 0;
        } catch (Exception) {
            v4_0 = 0;
            v5_1 = 0;
        }
    }

Method com.baidu.android.pushservice.j.c.a() calling method java.lang.Runtime.exec()


    public static java.util.ArrayList a(String p7, java.io.File p8)
    {
        java.util.ArrayList v0_1 = new java.util.ArrayList();
        java.io.FileWriter v2_2 = 0;
        try {
            Process v3_1 = Runtime.getRuntime().exec(p7);
            int v4_0 = new java.io.InputStreamReader(v3_1.getInputStream(), "utf-8");
            try {
                String v7_3;
                java.io.LineNumberReader v5_2 = new java.io.LineNumberReader(v4_0);
            } catch (String v7_6) {
                if (v4_0 != 0) {
                    try {
                        v4_0.close();
                    } catch (StringBuilder v8_5) {
                        v8_5.printStackTrace();
                    }
                }
                throw v7_6;
            } catch (String v7_1) {
                v2_2 = v4_0;
                v7_1.printStackTrace();
                v0_1.add("no su");
                if (v2_2 == null) {
                    return v0_1;
                } else {
                    v2_2.close();
                    return v0_1;
                }
            }
            if (p8 != null) {
                if (!p8.exists()) {
                    p8.createNewFile();
                }
                v2_2 = new java.io.FileWriter(p8, 1);
                StringBuilder v8_2 = new StringBuilder();
                v8_2.append("\n\n\n---------------   CMD : ");
                v8_2.append(p7);
                v8_2.append("   ---------------\n\n\n");
                v7_3 = v8_2.toString();
                v2_2.append(v7_3);
            }
            do {
                String v7_4 = v5_2.readLine();
                if (v7_4 == null) {
                    if (v2_2 != null) {
                        v2_2.flush();
                        v2_2.close();
                    }
                    v3_1.waitFor();
                    v4_0.close();
                    return v0_1;
                } else {
                    v0_1.add(v7_4);
                }
            } while(v2_2 == null);
            StringBuilder v8_4 = new StringBuilder();
            v8_4.append(v7_4);
            v8_4.append("\n");
            v7_3 = v8_4.toString();
        } catch (String v7_6) {
            v4_0 = v2_2;
        } catch (String v7_1) {
        } catch (String v7_7) {
            v7_7.printStackTrace();
            return v0_1;
        }
    }

Method com.sophos.cloud.a.a.a() calling method java.lang.Runtime.exec()


    public static String a(String p5)
    {
        if ((p5 != null) && (!p5.isEmpty())) {
            try {
                String v5_6 = Runtime.getRuntime().exec(p5);
                int v0_0 = new java.io.BufferedReader(new java.io.InputStreamReader(v5_6.getInputStream()));
                StringBuilder v1_2 = new StringBuilder();
                String v2_2 = new char[1024];
            } catch (String v5_2) {
                StringBuilder v1_4 = new StringBuilder();
                v1_4.append("Could not read the shell command result: ");
                v1_4.append(v5_2.getMessage());
                com.sophos.smsec.core.smsectrace.d.d(ark>com.sophos.cloud.a.aark>.b, v1_4.toString());
            }
            while(true) {
                int v3 = v0_0.read(v2_2);
                if (v3 <= 0) {
                    break;
                }
                v1_2.append(v2_2, 0, v3);
            }
            v0_0.close();
            v5_6.waitFor();
            String v5_1 = v1_2.toString();
            if (v5_1.length() > 0) {
                return v5_1;
            }
        }
        return 0;
    }

Method com.sophos.cloud.core.device.RootDetectorBase.c() calling method java.lang.Runtime.exec()


    static String[] c()
    {
        try {
            Throwable v2_1 = new java.io.BufferedReader(new java.io.InputStreamReader(Runtime.getRuntime().exec(new String[] {"/system/bin/sh", "-c", "echo $PATH"})).getInputStream()));
            String[] v1_1 = 0;
            try {
                Throwable v3_2 = v2_1.readLine();
            } catch (Throwable v3_3) {
                if (v1_1 == null) {
                    v2_1.close();
                } else {
                    try {
                        v2_1.close();
                    } catch (Throwable v2_3) {
                        v1_1.addSuppressed(v2_3);
                    }
                }
                throw v3_3;
            } catch (String[] v1_1) {
                throw v1_1;
            }
            if (v3_2 == null) {
                v1_1 = new String[0];
                v2_1.close();
                return v1_1;
            } else {
                v1_1 = v3_2.split(":");
                v2_1.close();
                return v1_1;
            }
        } catch (String[] v1_3) {
            com.sophos.smsec.core.smsectrace.d.d("RD", "getPath IOException:", v1_3);
            String[] v0_1 = new String[0];
            return v0_1;
        }
    }

Method com.sophos.cloud.core.device.RootDetectorBase.b() calling method java.lang.Runtime.exec()


    boolean b()
    {
        Throwable v0_1 = new com.sophos.cloud.core.device.RootDetectorResultItem(com.sophos.cloud.core.device.RootDetectorResultItem$RootDetectorResultType.SU);
        try {
            Throwable v3_0 = new java.io.BufferedReader(new java.io.InputStreamReader(Runtime.getRuntime().exec("su -c date").getInputStream()));
            Throwable v2_1 = 0;
            try {
                if (v3_0.readLine() != null) {
                    com.sophos.smsec.core.smsectrace.d.b("RD", "found rooting indicator: no exception was thrown by executing \'su\' command");
                    v0_1.a(1);
                    v3_0.close();
                    return 1;
                } else {
                    v3_0.close();
                    return 0;
                }
            } catch (Throwable v0_3) {
                if (v2_1 == null) {
                    v3_0.close();
                } else {
                    try {
                        v3_0.close();
                    } catch (Throwable v3_1) {
                        v2_1.addSuppressed(v3_1);
                    }
                }
                throw v0_3;
            } catch (Throwable v0_2) {
                v2_1 = v0_2;
                throw v2_1;
            }
        } catch (Exception) {
            return 0;
        }
    }

Method com.sophos.cloud.core.device.b.a() calling method java.lang.Runtime.exec()


    private boolean a()
    {
        try {
            Throwable v2_0 = new java.io.BufferedReader(new java.io.InputStreamReader(Runtime.getRuntime().exec("su -c date").getInputStream()));
            int v1_0 = 0;
            try {
                if (v2_0.readLine() != null) {
                    com.sophos.smsec.core.smsectrace.d.b("ERD", "found rooting indicator: no exception was thrown by executing \'su\' command");
                    v1_0 = 1;
                    v2_0.close();
                    return 1;
                } else {
                    v2_0.close();
                    return 0;
                }
            } catch (String v3_3) {
                if (v1_0 == 0) {
                    v2_0.close();
                } else {
                    try {
                        v2_0.close();
                    } catch (Throwable v2_1) {
                        v1_0.addSuppressed(v2_1);
                    }
                }
                throw v3_3;
            } catch (int v1_0) {
                throw v1_0;
            }
        } catch (Exception) {
            return 0;
        }
    }

Method com.sophos.cloud.core.device.b.a() calling method java.lang.Runtime.exec()


    private boolean a(String p5)
    {
        try {
            Throwable v1_3 = new StringBuilder();
            v1_3.append("ls -l ");
            v1_3.append(p5);
            Throwable v1_2 = new java.io.BufferedReader(new java.io.InputStreamReader(Runtime.getRuntime().exec(v1_3.toString()).getInputStream()));
            int v5_3 = 0;
            try {
                if (v1_2.readLine() != null) {
                    com.sophos.smsec.core.smsectrace.d.b("ERD", "found rooting indicator: ls -l\'su\' command");
                    v5_3 = 1;
                    v1_2.close();
                    return 1;
                } else {
                    v1_2.close();
                    return 0;
                }
            } catch (String v2_4) {
                if (v5_3 == 0) {
                    v1_2.close();
                } else {
                    try {
                        v1_2.close();
                    } catch (Throwable v1_4) {
                        v5_3.addSuppressed(v1_4);
                    }
                }
                throw v2_4;
            } catch (int v5_3) {
                throw v5_3;
            }
        } catch (Exception) {
            return 0;
        }
    }

Method com.sophos.cloud.core.device.b.c() calling method java.lang.Runtime.exec()


    private boolean c()
    {
        Throwable v0_1 = new com.sophos.cloud.core.device.RootDetectorResultItem(com.sophos.cloud.core.device.RootDetectorResultItem$RootDetectorResultType.BUSYBOX);
        try {
            Throwable v3_0 = new java.io.BufferedReader(new java.io.InputStreamReader(Runtime.getRuntime().exec("busybox pwd").getInputStream()));
            Throwable v2_1 = 0;
            try {
                if (v3_0.readLine() != null) {
                    com.sophos.smsec.core.smsectrace.d.b("ERD", "found rooting indicator: no exception was thrown by executing \'busybox\' command");
                    v0_1.a(1);
                    v3_0.close();
                    return 1;
                } else {
                    v3_0.close();
                    return 0;
                }
            } catch (Throwable v0_3) {
                if (v2_1 == null) {
                    v3_0.close();
                } else {
                    try {
                        v3_0.close();
                    } catch (Throwable v3_1) {
                        v2_1.addSuppressed(v3_1);
                    }
                }
                throw v0_3;
            } catch (Throwable v0_2) {
                v2_1 = v0_2;
                throw v2_1;
            }
        } catch (Exception) {
            return 0;
        }
    }

Method com.sophos.cloud.core.device.b.d() calling method java.lang.Runtime.exec()


    private boolean d()
    {
        String v0_1 = new StringBuilder();
        try {
            Throwable v3_0 = new java.io.BufferedReader(new java.io.InputStreamReader(Runtime.getRuntime().exec("/system/bin/getenforce").getInputStream()));
            String v2_1 = 0;
            try {
                v0_1.append(v3_0.readLine());
            } catch (String v0_3) {
                if (v2_1 == null) {
                    v3_0.close();
                } else {
                    try {
                        v3_0.close();
                    } catch (Throwable v3_1) {
                        v2_1.addSuppressed(v3_1);
                    }
                }
                throw v0_3;
            } catch (String v0_2) {
                v2_1 = v0_2;
                throw v2_1;
            }
            v3_0.close();
            String v0_4 = v0_1.toString();
            if (!"Enforcing".equals(v0_4)) {
                if (!"Permissive".equals(v0_4)) {
                    com.sophos.smsec.core.smsectrace.d.c("ERD", "getenforce returned unexpected value, unable to determine selinux!");
                    return 1;
                } else {
                    return 0;
                }
            } else {
                return 1;
            }
        } catch (Exception) {
            com.sophos.smsec.core.smsectrace.d.d("ERD", "OS does not support getenforce");
            return 0;
        }
    }

Method com.sophos.cloud.core.device.b.e() calling method java.lang.Runtime.exec()


    private String[] e()
    {
        String[] v0 = 0;
        try {
            Throwable v1_1 = new StringBuilder();
            Throwable v3_0 = new java.io.BufferedReader(new java.io.InputStreamReader(Runtime.getRuntime().exec("/system/bin/getprop").getInputStream()));
            try {
                String v2_1 = v3_0.readLine();
            } catch (Throwable v1_3) {
                String v2_3 = 0;
                if (v2_3 == null) {
                    v3_0.close();
                } else {
                    try {
                        v3_0.close();
                    } catch (Throwable v3_1) {
                        v2_3.addSuppressed(v3_1);
                    }
                }
                throw v1_3;
            } catch (Throwable v1_2) {
                try {
                    throw v1_2;
                } catch (String v2_2) {
                    v2_3 = v1_2;
                    v1_3 = v2_2;
                }
            }
            while ((v2_1 != null) && (!v2_1.isEmpty())) {
                v1_1.append(v2_1);
                v1_1.append("\n");
                v2_1 = v3_0.readLine();
            }
            v3_0.close();
            v0 = v1_1.toString().split("\n");
            return v0;
        } catch (Exception) {
            com.sophos.smsec.core.smsectrace.d.d("ERD", "getprop does not work");
            return v0;
        }
    }

Method com.sophos.cloud.core.device.b.f() calling method java.lang.Runtime.exec()


    private boolean f()
    {
        try {
            Throwable v2_0 = new java.io.BufferedReader(new java.io.InputStreamReader(Runtime.getRuntime().exec(new String[] {"which", "su"})).getInputStream()));
            int v1_1 = 0;
            try {
                if (v2_0.readLine() != null) {
                    com.sophos.smsec.core.smsectrace.d.b("ERD", "found rooting indicator: which su");
                    v1_1 = 1;
                    v2_0.close();
                    return 1;
                } else {
                    v2_0.close();
                    return 0;
                }
            } catch (String v3_4) {
                if (v1_1 == 0) {
                    v2_0.close();
                } else {
                    try {
                        v2_0.close();
                    } catch (Throwable v2_1) {
                        v1_1.addSuppressed(v2_1);
                    }
                }
                throw v3_4;
            } catch (int v1_1) {
                throw v1_1;
            }
        } catch (Exception) {
            return 0;
        }
    }

Method com.sophos.smsec.core.smsectrace.a.a() calling method java.lang.Runtime.exec()


    private String a()
    {
        try {
            int v0_1 = new java.util.ArrayList();
            v0_1.add("dumpsys");
            v0_1.add("meminfo");
            v0_1.add(Integer.toString(android.os.Process.myPid()));
            String v2_1 = new String[0];
            return ark>com.sophos.smsec.core.smsectrace.aark>.a(Runtime.getRuntime().exec(((String[]) v0_1.toArray(v2_1))).getInputStream());
        } catch (int v0_7) {
            com.sophos.smsec.core.smsectrace.d.c("CrashReporter", "collectMemInfo could not retrieve data", v0_7);
            return 0;
        }
    }

Method com.sophos.smsec.core.smsutils.a.a() calling method java.lang.Runtime.exec()


    public static java.util.List a(android.content.Context p6, int p7)
    {
        java.io.IOException v6_1 = p6.getPackageManager();
        if (android.os.Build$VERSION.SDK_INT < 22) {
            try {
                java.io.IOException v6_5 = v6_1.getInstalledPackages(p7);
                return v6_5;
            } catch (String v0_4) {
                com.sophos.smsec.core.smsectrace.d.b("AppHelper", "PackageManager died. Trying fallback", v0_4);
                String v0_1 = new java.util.ArrayList();
                android.content.pm.PackageInfo v1_0 = 0;
                try {
                    String v2_2 = Runtime.getRuntime().exec("pm list packages");
                    java.io.BufferedReader v3_2 = new java.io.BufferedReader(new java.io.InputStreamReader(v2_2.getInputStream()));
                } catch (java.io.IOException v6_3) {
                    if (v1_0 != null) {
                        try {
                            v1_0.close();
                        } catch (String v7_3) {
                            com.sophos.smsec.core.smsectrace.d.d("AppHelper", v7_3);
                        }
                    }
                    throw v6_3;
                } catch (java.io.IOException v6_2) {
                    com.sophos.smsec.core.smsectrace.d.c("AppHelper", "Fallback did not work", v6_2);
                    if (v1_0 == null) {
                        return v0_1;
                    } else {
                        v1_0.close();
                        return v0_1;
                    }
                } catch (java.io.IOException v6_4) {
                    com.sophos.smsec.core.smsectrace.d.d("AppHelper", v6_4);
                    return v0_1;
                }
            }
        } else {
            return v6_1.getInstalledPackages(p7);
        }
    }

Method org.apache.commons.io.FileSystemUtils.openProcess() calling method java.lang.Runtime.exec()


    Process openProcess(String[] p2)
    {
        return Runtime.getRuntime().exec(p2);
    }