|
|
@@ -17,6 +17,7 @@ import androidx.core.view.WindowInsetsCompat;
|
|
|
import com.example.modifier.databinding.ActivityMainBinding;
|
|
|
import com.google.gson.Gson;
|
|
|
|
|
|
+import org.apache.commons.io.FileUtils;
|
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
@@ -37,7 +38,7 @@ import java.util.concurrent.TimeUnit;
|
|
|
public class MainActivity extends AppCompatActivity {
|
|
|
private static final String TAG = "SpooferModule";
|
|
|
ActivityMainBinding mBinding;
|
|
|
- ExecutorService executor = Executors.newFixedThreadPool(8);
|
|
|
+ ExecutorService executor = Executors.newFixedThreadPool(32);
|
|
|
Handler handler = new Handler(Looper.getMainLooper());
|
|
|
|
|
|
@Override
|
|
|
@@ -149,6 +150,8 @@ public class MainActivity extends AppCompatActivity {
|
|
|
"echo 'copied to siminfo'",
|
|
|
"chmod 777 /data/data/com.kee.SIMdeviceinfo/rcsConfig.json");
|
|
|
|
|
|
+// runAsRoot("ls /system");
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
@@ -233,12 +236,16 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
|
|
|
|
|
private void runAsRoot(String... cmds) throws IOException, InterruptedException {
|
|
|
- Process p = Runtime.getRuntime().exec("su");
|
|
|
- executor.execute(new StreamLogger(p.getInputStream()));
|
|
|
- executor.execute(new StreamLogger(p.getErrorStream()));
|
|
|
+ File outputDir = getCacheDir(); // context being the Activity pointer
|
|
|
+ File outputFile = File.createTempFile("su0000000", ".log", outputDir);
|
|
|
+ Log.i(TAG, "Output file: " + outputFile.getAbsolutePath());
|
|
|
+
|
|
|
+ Process p = new ProcessBuilder("su")
|
|
|
+ .redirectErrorStream(true)
|
|
|
+ .redirectOutput(outputFile)
|
|
|
+ .start();
|
|
|
+
|
|
|
DataOutputStream outputStream = new DataOutputStream(p.getOutputStream());
|
|
|
- outputStream.writeBytes("su\n");
|
|
|
- outputStream.flush();
|
|
|
for (String cmd : cmds) {
|
|
|
outputStream.writeBytes(cmd + "\n");
|
|
|
outputStream.flush();
|
|
|
@@ -246,8 +253,9 @@ public class MainActivity extends AppCompatActivity {
|
|
|
}
|
|
|
outputStream.writeBytes("exit\n");
|
|
|
outputStream.flush();
|
|
|
- p.waitFor(5, TimeUnit.SECONDS);
|
|
|
- Log.i(TAG, "Command executed");
|
|
|
+ p.waitFor();
|
|
|
+ String res = FileUtils.readFileToString(outputFile, "UTF-8");
|
|
|
+ Log.i(TAG, "Command executed: \n" + res);
|
|
|
}
|
|
|
|
|
|
String generateIMEI() {
|