|
@@ -1,7 +1,5 @@
|
|
|
package de.tudarmstadt.informatik.hostage.ui2.activity;
|
|
|
|
|
|
-import java.io.BufferedReader;
|
|
|
-import java.io.InputStreamReader;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
|
|
@@ -55,10 +53,6 @@ import de.tudarmstadt.informatik.hostage.ui2.model.DrawerListItem;
|
|
|
public class MainActivity extends Activity {
|
|
|
public static volatile Context context;
|
|
|
|
|
|
- public static boolean isRooted = false;
|
|
|
-
|
|
|
- public static boolean porthackInstalled = false;
|
|
|
-
|
|
|
/** singleton instance of the MainActivity **/
|
|
|
private static MainActivity sInstance = null;
|
|
|
|
|
@@ -143,6 +137,12 @@ public class MainActivity extends Activity {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void onStop() {
|
|
|
+ this.unbindService();
|
|
|
+ super.onStop();
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
@@ -209,7 +209,6 @@ public class MainActivity extends Activity {
|
|
|
};
|
|
|
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
|
|
|
|
|
- checkRootAndPorthack();
|
|
|
startAndBind();
|
|
|
|
|
|
if (savedInstanceState == null) {
|
|
@@ -515,37 +514,6 @@ public class MainActivity extends Activity {
|
|
|
return this.mDisplayedFragment;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Checks if the phone ist rooted and if porthack is installed. Sets flags
|
|
|
- * {@link this.isRooted} and {@link this.porthackInstalled}
|
|
|
- */
|
|
|
- private void checkRootAndPorthack() {
|
|
|
- isRooted = false;
|
|
|
- porthackInstalled = false;
|
|
|
- Process p;
|
|
|
- try {
|
|
|
- String found = "Found";
|
|
|
- String notFound = "Not found";
|
|
|
- String command = "[ -f /data/local/p ] && echo " + found + " || echo " + notFound;
|
|
|
- p = Runtime.getRuntime().exec(new String[] { "su", "-c", command });
|
|
|
- BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
|
|
- /*
|
|
|
- * int av = byte[] b = new byte[av]; if (av != 0) { in.read(b); }
|
|
|
- */
|
|
|
- String echoResponse = in.readLine();
|
|
|
- Log.i("MainAc", echoResponse);
|
|
|
- if (echoResponse.equals(found)) {
|
|
|
- isRooted = true;
|
|
|
- porthackInstalled = true;
|
|
|
- } else if (echoResponse.equals(notFound)) {
|
|
|
- isRooted = true;
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- Log.i("MainAc", "Rooted: " + isRooted + " Porthack: " + porthackInstalled);
|
|
|
- }
|
|
|
-
|
|
|
public Hostage getHostageService() {
|
|
|
return this.mHoneyService;
|
|
|
}
|