package fuzion24.device.vulnerability.vulnerabilities.system;

import android.content.Context;
import android.os.storage.StorageManager;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

import fuzion24.device.vulnerability.util.CPUArch;
import fuzion24.device.vulnerability.vulnerabilities.VulnerabilityTest;
import fuzion24.device.vulnerability.vulnerabilities.helper.Proc;

public class ZergRush implements VulnerabilityTest {
    @Override
    public String getName() {
        return null;
    }


    @Override
    public List<CPUArch> getSupportedArchitectures() {
        ArrayList<CPUArch> archs = new ArrayList<CPUArch>();
        archs.add(CPUArch.ALL);
        return archs;
    }


    @Override
    public boolean isVulnerable(Context context) throws Exception {
        int pid = Proc.findPidFor("/system/bin/vold");
        StorageManager sm = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);

        Method getObbPath = sm.getClass().getMethod("getMountedObbPath", String.class);
        getObbPath.invoke(sm, "AAAA AAAA AAAA AAAA "
                + "AAAA AAAA AAAA AAAA "
                + "AAAA AAAA AAAA AAAA "
                + "AAAA AAAA AAAA AAAA"
                + "AAAA AAAA AAAA AAAA"
                + "AAAA AAAA AAAA AAAA"
                + "AAAA AAAA AAAA AAAA"
                + "AAAA AAAA AAAA AAAA"
                + "AAAA AAAA AAAA AAAA"
                + "AAAA AAAA AAAA AAAA"
                + "AAAA AAAA AAAA AAAA");

        Thread.sleep(2000);  // give vold some time to crash

        return false;
    }

}

@@ -399,20 +399,27 @@
 .helper.
-Proc
+SystemUtils
 ;%0A%0Apubli
@@ -835,13 +835,24 @@
 d = 
+SystemUtils.
 Proc
-.
 find

Fix code ref for refactored code