mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-31 21:12:44 +01:00
Remove the root check (#114)
This commit is contained in:
parent
62bc00cd68
commit
e9b357e92d
@ -135,7 +135,7 @@ public class ExamsTabFragment extends BaseFragment implements ExamsTabContract.V
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
super.onDestroyView();
|
|
||||||
presenter.onDestroy();
|
presenter.onDestroy();
|
||||||
|
super.onDestroyView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
package io.github.wulkanowy.utils;
|
|
||||||
|
|
||||||
import android.os.Build;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public final class RootChecker {
|
|
||||||
|
|
||||||
private RootChecker() {
|
|
||||||
throw new IllegalStateException("Utility class");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isRooted() {
|
|
||||||
return checkOne() || checkTwo() || checkThree();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean checkOne() {
|
|
||||||
return Build.TAGS != null && Build.TAGS.contains("test-keys");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean checkTwo() {
|
|
||||||
return new File("/system/app/Superuser.apk").exists();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean checkThree() {
|
|
||||||
String[] commands = {"/system/xbin/which su", "/system/bin/which su", "which su"};
|
|
||||||
for (String command : commands) {
|
|
||||||
try {
|
|
||||||
Runtime.getRuntime().exec(command);
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -27,7 +27,6 @@ import javax.crypto.CipherOutputStream;
|
|||||||
import javax.security.auth.x500.X500Principal;
|
import javax.security.auth.x500.X500Principal;
|
||||||
|
|
||||||
import io.github.wulkanowy.utils.LogUtils;
|
import io.github.wulkanowy.utils.LogUtils;
|
||||||
import io.github.wulkanowy.utils.RootChecker;
|
|
||||||
|
|
||||||
public final class Scrambler {
|
public final class Scrambler {
|
||||||
|
|
||||||
@ -46,23 +45,16 @@ public final class Scrambler {
|
|||||||
loadKeyStore();
|
loadKeyStore();
|
||||||
generateNewKey(email, context);
|
generateNewKey(email, context);
|
||||||
return encryptString(email, plainText);
|
return encryptString(email, plainText);
|
||||||
} else {
|
|
||||||
if (RootChecker.isRooted()) {
|
|
||||||
return new String(Base64.encode(plainText.getBytes(), Base64.DEFAULT));
|
|
||||||
} else {
|
|
||||||
throw new UnsupportedOperationException("Stored data in this devices " +
|
|
||||||
"isn't safe because android is rooted");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return new String(Base64.encode(plainText.getBytes(), Base64.DEFAULT));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String decrypt(String email, String encryptedText) throws CryptoException {
|
public static String decrypt(String email, String encryptedText) throws CryptoException {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
||||||
loadKeyStore();
|
loadKeyStore();
|
||||||
return decryptString(email, encryptedText);
|
return decryptString(email, encryptedText);
|
||||||
} else {
|
|
||||||
return new String(Base64.decode(encryptedText, Base64.DEFAULT));
|
|
||||||
}
|
}
|
||||||
|
return new String(Base64.decode(encryptedText, Base64.DEFAULT));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void loadKeyStore() throws CryptoException {
|
private static void loadKeyStore() throws CryptoException {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user