Update EntryPoint.java

This commit is contained in:
Yiğit 2024-01-15 17:45:50 +03:00 committed by GitHub
parent a246eb8cf9
commit 5af55f3b2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,13 @@ public final class EntryPoint {
static { static {
try { try {
spoofProvider();
} catch (Throwable t) {
LOG("spoofProvider exception: " + t);
}
}
private static void spoofProvider() throws Exception {
KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore"); KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
keyStore.load(null); keyStore.load(null);
@ -33,21 +40,15 @@ public final class EntryPoint {
Security.insertProviderAt(customProvider, 1); Security.insertProviderAt(customProvider, 1);
LOG("Spoof KeyStoreSpi and Provider done!"); LOG("Spoof KeyStoreSpi and Provider done!");
} catch (Throwable t) {
LOG("spoofProvider exception: " + t);
}
} }
public static void init(String json) { public static void init(String json) {
try { try {
jsonObject = new JSONObject(json); jsonObject = new JSONObject(json);
spoofDevice();
} catch (JSONException e) { } catch (JSONException e) {
LOG("Couldn't parse JSON from Zygisk"); LOG("Couldn't parse JSON from Zygisk");
} }
spoofDevice();
} }
static void LOG(String msg) { static void LOG(String msg) {
@ -65,10 +66,30 @@ public final class EntryPoint {
} }
private static void setFieldValue(String name, Object value) { private static void setFieldValue(String name, Object value) {
if (name == null || value == null || name.isEmpty()) return; if (name == null value == null name.isEmpty()) return;
if (value instanceof String str) if (str.isEmpty() || str.isBlank()) return; if (value instanceof String str) if (str.isEmpty() || str.isBlank()) return;
Field field = getField(name);
if (field == null) return;
field.setAccessible(true);
try {
Object oldValue = field.get(null);
if (!value.equals(oldValue)) {
field.set(null, value);
LOG("Set [" + name + "] field value to [" + value + "]");
}
} catch (IllegalAccessException e) {
LOG("Couldn't modify field: " + e);
}
field.setAccessible(false);
}
private static Field getField(String name) {
Field field = null; Field field = null;
try { try {
@ -81,22 +102,6 @@ public final class EntryPoint {
} }
} }
if (field == null) return; return field;
field.setAccessible(true);
try {
Object oldValue = field.get(null);
if (!value.equals(oldValue)) {
field.set(null, value);
LOG("Set [" + name + "] field value to [" + value + "]");
}
} catch (IllegalAccessException e) {
LOG("Couldn't modify field: " + e);
}
field.setAccessible(false);
} }
} }