package diff.strazzere.anti;

import diff.strazzere.anti.emulator.FindEmulator;
import diff.strazzere.anti.taint.FindTaint;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		isQEmuEnvDetected();

		isTaintTrackingDetected();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	public boolean isQEmuEnvDetected() {
		log("Checking for QEmu env...");
		log("hasKnownDeviceId : " + FindEmulator.hasKnownDeviceId(getApplicationContext()));
		log("hasKnownImei : " + FindEmulator.hasKnownImei(getApplicationContext()));
		log("hasKnownPhoneNumber : " + FindEmulator.hasKnownPhoneNumber(getApplicationContext()));
		log("hasPipes : " + FindEmulator.hasPipes());
		log("hasQEmuDriver : " + FindEmulator.hasQEmuDriver());
		log("hasQEmuFiles : " + FindEmulator.hasQEmuFiles());
		if(FindEmulator.hasKnownDeviceId(getApplicationContext()) ||
				FindEmulator.hasKnownImei(getApplicationContext()) ||
				FindEmulator.hasKnownPhoneNumber(getApplicationContext()) ||
				FindEmulator.hasPipes() ||
				FindEmulator.hasQEmuDriver() ||
				FindEmulator.hasQEmuFiles()) {
			log("QEmu environment detected.");
			return true;
		} else {
			log("QEmu environment not detected.");
			return false;
		}
	}

	public boolean isTaintTrackingDetected() {
		log("Checking for Taint tracking...");
		log("hasAppAnalysisPackage : " + FindTaint.hasAppAnalysisPackage(getApplicationContext()));
		log("hasTaintClass : " + FindTaint.hasTaintClass());
		log("hasTaintMemberVariables : " + FindTaint.hasTaintMemberVariables());
		if(FindTaint.hasAppAnalysisPackage(getApplicationContext()) ||
				FindTaint.hasTaintClass() ||
				FindTaint.hasTaintMemberVariables()) {
			log("Taint tracking was detected.");
			return true;
		} else {
			log("Taint tracking was not detected.");
			return false;
		}
	}

    public void log(String msg) {
    	Log.v("AntiEmulator", msg);
    }
}

@@ -1018,45 +1018,94 @@
 og(%22
-hasPipes : %22 + FindEmulator.hasPipes(
+isOperatorNameAndroid : %22 + FindEmulator.isOperatorNameAndroid(getApplicationContext()
 ));%0A
@@ -1114,26 +1114,25 @@
 log(%22has
-QEmuDriver
+KnownImsi
  : %22 + F
@@ -1146,27 +1146,49 @@
 ator.has
-QEmuDriver(
+KnownImsi(getApplicationContext()
 ));%0A%09%09lo
@@ -1197,20 +1197,22 @@
 %22has
-Q
 Emu
-Files : 
+latorBuild:
 %22 + 
@@ -1231,24 +1231,61 @@
 .has
-Q
 Emu
-Files());%0A%09%09
+latorBuild(getApplicationContext()));%0A%09%09%0A%09        
 if(F
@@ -1334,34 +1334,40 @@
 nContext()) %7C%7C%0A%09
-%09%09
+        
 %09FindEmulator.ha
@@ -1398,34 +1398,40 @@
 nContext()) %7C%7C%0A%09
-%09%09
+        
 %09FindEmulator.ha
@@ -1432,35 +1432,28 @@
 tor.hasKnown
-PhoneNumber
+Imsi
 (getApplicat
@@ -1466,26 +1466,32 @@
 text()) %7C%7C%0A%09
-%09%09
+        
 %09FindEmulato
@@ -1499,92 +1499,129 @@
 .has
-Pipes() %7C%7C%0A%09%09%09%09FindEmulator.hasQEmuDriver() %7C%7C%0A%09%09%09%09FindEmulator.hasQEmuFiles()) %7B%0A%09%09
+EmulatorBuild(getApplicationContext()) %7C%7C%0A%09        %09FindEmulator.hasKnownPhoneNumber(getApplicationContext()))%7B%0A%09        
 %09log
@@ -1645,33 +1645,40 @@
 t detected.%22);%0A%09
-%09
+        
 %09return true;%0A%09%09
@@ -1672,36 +1672,48 @@
 turn true;%0A%09
-%09%7D 
+        %7D
 else
- 
 %7B%0A%09
-%09
+        
 %09log(%22QEmu e
@@ -1733,33 +1733,40 @@
 t detected.%22);%0A%09
-%09
+        
 %09return false;%0A%09
@@ -1761,25 +1761,32 @@
 urn false;%0A%09
-%09
+        
 %7D%0A%09%7D%0A%0A%09publi

Update MainActivity.java