Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.93 KB | None | 0 0
  1. String line = null;
  2.             Process process = Runtime.getRuntime().exec("su");
  3.             DataOutputStream stdIn = new DataOutputStream(process.getOutputStream());
  4.             DataInputStream stdErr = new DataInputStream(process.getErrorStream());
  5.             DataInputStream stdOut = new DataInputStream(process.getInputStream());
  6.            
  7.             stdIn.writeBytes("grep TeleGuide < /cache/logger/AOL_main.ap.bin.old >> /sdcard/TeleGuide.log\n");
  8.             stdIn.flush();
  9.            
  10.             while((line = stdOut.readLine()) != null)
  11.                 Log.d(TAG, ">> " + line);
  12.             while((line = stdErr.readLine()) != null)
  13.                 Log.d(TAG, ">>> " + line);
  14.            
  15.             stdIn.writeBytes("exit\n");
  16.             stdIn.flush();
  17.            
  18.             while((line = stdOut.readLine()) != null)
  19.                 Log.d(TAG, ">> " + line);
  20.             while((line = stdErr.readLine()) != null)
  21.                 Log.d(TAG, ">>> " + line);
  22.            
  23.             process.destroy();
  24.             stdIn.close();
  25.             stdOut.close();
  26.             stdErr.close();
  27.             Log.d(TAG, "Successfully preserved last sessions logs!");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement