package com.kuaishou.weapon.p0; import android.app.Activity; import android.app.ActivityManager; import android.content.Context; import android.content.pm.PackageManager; import android.database.sqlite.SQLiteDatabase; import android.hardware.Camera; import android.location.Location; import android.media.MediaPlayer; import android.media.MediaRecorder; import android.net.Uri; import android.net.wifi.WifiInfo; import android.os.Build; import android.os.Process; import android.provider.Settings; import android.telephony.TelephonyManager; import android.text.TextUtils; import com.sigmob.sdk.base.h; import com.sigmob.sdk.base.mta.PointCategory; import com.sigmob.sdk.base.mta.PointType; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.FileOutputStream; import java.io.FileReader; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.net.HttpURLConnection; import java.security.MessageDigest; import java.security.SecureRandom; import java.util.HashSet; import java.util.Map; import java.util.Set; import javax.crypto.Cipher; import org.json.JSONArray; import org.json.JSONObject; public class p0 { public static final String a = "de.robv.android.xposed.XposedHelpers"; public static final String b = "de.robv.android.xposed.XposedBridge"; public static final String c = "com.elderdrivers.riru.edxp.config.EdXpConfigGlobal"; private boolean a(Context context, String str, Set set) { TelephonyManager telephonyManager; try { if (set.size() > 0 && (telephonyManager = (TelephonyManager) context.getSystemService("phone")) != null) { return a(telephonyManager.getClass(), str, set); } return false; } catch (Exception unused) { return false; } } private boolean a(Class cls, String str, Set set) { if (str != null) { try { return set.size() > 0 && set.toString().contains(str) && set.toString().contains(cls.getName()); } catch (Exception unused) { } } } private boolean a(Method method) { return method != null && Modifier.isNative(method.getModifiers()); } public int a(Context context, int i, Set set) { boolean z; String str; Class cls; String str2; try { if (ClassLoader.getSystemClassLoader() == null) { return 0; } switch (i) { case 13: str = "getDeviceId"; z = a(context, str, set); int i2 = z ? 1 : 0; int i3 = z ? 1 : 0; int i4 = z ? 1 : 0; return i2; case 14: str = "getSubscriberId"; z = a(context, str, set); int i22 = z ? 1 : 0; int i32 = z ? 1 : 0; int i42 = z ? 1 : 0; return i22; case 15: str = "getSimSerialNumber"; z = a(context, str, set); int i222 = z ? 1 : 0; int i322 = z ? 1 : 0; int i422 = z ? 1 : 0; return i222; case 16: cls = Settings.Secure.class; str2 = "getString"; z = a(cls, str2, set); int i2222 = z ? 1 : 0; int i3222 = z ? 1 : 0; int i4222 = z ? 1 : 0; return i2222; case 17: cls = StringBuilder.class; str2 = "toString"; z = a(cls, str2, set); int i22222 = z ? 1 : 0; int i32222 = z ? 1 : 0; int i42222 = z ? 1 : 0; return i22222; case 18: cls = Method.class; str2 = "invoke"; z = a(cls, str2, set); int i222222 = z ? 1 : 0; int i322222 = z ? 1 : 0; int i422222 = z ? 1 : 0; return i222222; case 19: cls = WifiInfo.class; str2 = "getMacAddress"; z = a(cls, str2, set); int i2222222 = z ? 1 : 0; int i3222222 = z ? 1 : 0; int i4222222 = z ? 1 : 0; return i2222222; case 20: cls = WifiInfo.class; str2 = "getSSID"; z = a(cls, str2, set); int i22222222 = z ? 1 : 0; int i32222222 = z ? 1 : 0; int i42222222 = z ? 1 : 0; return i22222222; case 21: cls = WifiInfo.class; str2 = "getBSSID"; z = a(cls, str2, set); int i222222222 = z ? 1 : 0; int i322222222 = z ? 1 : 0; int i422222222 = z ? 1 : 0; return i222222222; default: return 0; } } catch (Exception unused) { return 0; } } public JSONObject a() { try { JSONObject jSONObject = new JSONObject(); boolean z = true; boolean a2 = a(Cipher.class, "doFinal", byte[].class); int i = a2 ? 1 : 0; int i2 = a2 ? 1 : 0; jSONObject.put("0", i); boolean a3 = a(SecureRandom.class, "setSeed", byte[].class); jSONObject.put("1", a3 ? 1 : 0); if (a3) { a2 = true; } boolean a4 = a(MessageDigest.class, h.p, byte[].class); jSONObject.put("2", a4 ? 1 : 0); if (a4) { a2 = true; } boolean a5 = a(MessageDigest.class, "getInstance", String.class); jSONObject.put("3", a5 ? 1 : 0); if (a5) { a2 = true; } boolean a6 = a(Uri.class, "parse", String.class); jSONObject.put("4", a6 ? 1 : 0); if (a6) { a2 = true; } boolean a7 = a(SQLiteDatabase.class, "execSQL", String.class); jSONObject.put("5", a7 ? 1 : 0); if (a7) { a2 = true; } boolean a8 = a(Activity.class, PointCategory.FINISH, new Class[0]); jSONObject.put("6", a8 ? 1 : 0); if (!a8) { boolean z2 = a2 ? 1 : 0; Object[] objArr = a2 ? 1 : 0; Object[] objArr2 = a2 ? 1 : 0; Object[] objArr3 = a2 ? 1 : 0; z = z2; } if (z) { return jSONObject; } return null; } catch (Exception unused) { } } public JSONObject a(Set set) { try { JSONObject jSONObject = new JSONObject(); if (ClassLoader.getSystemClassLoader() != null && set.size() > 0) { jSONObject.put("0", a(Class.class, "forName", set) ? 1 : 0); jSONObject.put("1", a(ClassLoader.class, "loadClass", set) ? 1 : 0); jSONObject.put("2", a(Throwable.class, "getStackTrace", set) ? 1 : 0); jSONObject.put("3", a(PackageManager.class, d.b("Z2V0SW5zdGFsbGVkUGFja2FnZXM=", 2), set) ? 1 : 0); jSONObject.put("4", a(PackageManager.class, d.b("Z2V0SW5zdGFsbGVkQXBwbGljYXRpb25z", 2), set) ? 1 : 0); jSONObject.put("5", a(ActivityManager.class, "getRunningServices", set) ? 1 : 0); jSONObject.put("6", a(JSONObject.class, "toString", set) ? 1 : 0); } return jSONObject; } catch (Exception unused) { return null; } } public boolean a(Class cls, String str, Class<?>... clsArr) { try { return a(h1.b(cls, str, clsArr)); } catch (Exception unused) { return false; } } public Set b(Set set) { HashSet hashSet = new HashSet(); for (Object obj : set) { if (obj instanceof String) { if (obj != null) { String str = (String) obj; if (!str.startsWith("android.app.ResourcesManager#")) { if (str.startsWith("android.view.LayoutInflater#")) { } } } } else if (obj instanceof Method) { obj = ((Method) obj).getName(); } hashSet.add(obj); } return hashSet; } public JSONObject b() { try { JSONObject jSONObject = new JSONObject(); jSONObject.put("0", a(TelephonyManager.class, "getDeviceId", new Class[0]) ? 1 : 0); jSONObject.put("1", a(TelephonyManager.class, "getSubscriberId", new Class[0]) ? 1 : 0); jSONObject.put("2", a(TelephonyManager.class, "getSimSerialNumber", new Class[0]) ? 1 : 0); jSONObject.put("3", a(Location.class, "getLatitude", new Class[0]) ? 1 : 0); jSONObject.put("4", a(Location.class, "getLongitude", new Class[0]) ? 1 : 0); if (Build.VERSION.SDK_INT >= 26) { jSONObject.put("5", a(Build.class, "getSerial", new Class[0]) ? 1 : 0); } else { jSONObject.put("5", 0); } jSONObject.put("6", a(WifiInfo.class, "getMacAddress", new Class[0]) ? 1 : 0); jSONObject.put("7", a(WifiInfo.class, "getBSSID", new Class[0]) ? 1 : 0); jSONObject.put("8", a(WifiInfo.class, "getRssi", new Class[0]) ? 1 : 0); jSONObject.put(PointType.SIGMOB_ERROR, a(Class.class, "forName", new Class[]{String.class}) ? 1 : 0); jSONObject.put(PointType.SIGMOB_APP, a(ActivityManager.class, "getRunningServices", new Class[]{Integer.TYPE}) ? 1 : 0); return jSONObject; } catch (Exception unused) { return null; } } public JSONObject c() { try { JSONObject jSONObject = new JSONObject(); boolean a2 = a(MediaRecorder.class, "setOutputFile", String.class); if (a2) { jSONObject.put("0", a2 ? 1 : 0); } boolean a3 = a(Camera.class, "takePicture", Camera.ShutterCallback.class, Camera.PictureCallback.class, Camera.PictureCallback.class); if (a3) { jSONObject.put("1", a3 ? 1 : 0); } boolean a4 = a(MediaPlayer.class, "setDataSource", Context.class, Uri.class); if (a4) { jSONObject.put("2", a4 ? 1 : 0); } if (jSONObject.length() > 0) { return jSONObject; } return null; } catch (Exception unused) { return null; } } public JSONObject d() { try { JSONObject jSONObject = new JSONObject(); boolean a2 = a(JSONObject.class, "toString", new Class[0]); if (a2) { jSONObject.put("0", a2 ? 1 : 0); } boolean a3 = a(TextUtils.class, "isEmpty", CharSequence.class); if (a3) { jSONObject.put("1", a3 ? 1 : 0); } boolean a4 = a(JSONArray.class, "toString", new Class[0]); if (a4) { jSONObject.put("2", a4 ? 1 : 0); } boolean a5 = a(Cipher.class, "doFinal", byte[].class); if (a5) { jSONObject.put("3", a5 ? 1 : 0); } boolean a6 = a(ByteArrayOutputStream.class, "toByteArray", new Class[0]); if (a6) { jSONObject.put("4", a6 ? 1 : 0); } boolean a7 = a(FileOutputStream.class, "write", byte[].class); if (a7) { jSONObject.put("5", a7 ? 1 : 0); } boolean a8 = a(HttpURLConnection.class, "setRequestProperty", String.class, String.class); if (a8) { jSONObject.put("6", a8 ? 1 : 0); } if (jSONObject.length() > 0) { return jSONObject; } return null; } catch (Exception unused) { } } /* JADX WARNING: Code restructure failed: missing block: B:30:0x0087, code lost: if (r4 == null) goto L_0x008f; */ /* JADX WARNING: Removed duplicated region for block: B:24:0x0082 A[SYNTHETIC, Splitter:B:24:0x0082] */ public Set<String> e() { BufferedReader bufferedReader; Throwable th; HashSet hashSet = new HashSet(); BufferedReader bufferedReader2 = null; try { HashSet<String> hashSet2 = new HashSet(); bufferedReader = new BufferedReader(new FileReader("/proc/" + Process.myPid() + "/maps")); while (true) { try { String readLine = bufferedReader.readLine(); if (readLine == null) { break; } else if (readLine.endsWith(".so") || readLine.endsWith(".jar")) { hashSet2.add(readLine.substring(readLine.lastIndexOf(" ") + 1)); } } catch (Exception unused) { } catch (Throwable th2) { th = th2; bufferedReader2 = bufferedReader; if (bufferedReader2 != null) { } throw th; } } bufferedReader.close(); for (String str : hashSet2) { if (str.contains("com.saurik.substrate") || str.contains("XposedBridge.jar")) { hashSet.add(str); } } } catch (Exception unused2) { bufferedReader = null; } catch (Throwable th3) { th = th3; if (bufferedReader2 != null) { try { bufferedReader2.close(); } catch (Exception unused3) { } } throw th; } try { bufferedReader.close(); } catch (Exception unused4) { } if (hashSet.size() > 0) { return hashSet; } return null; } public Set<String> f() { Set keySet; try { Class<?> loadClass = ClassLoader.getSystemClassLoader().loadClass(b); if (loadClass == null) { return null; } Field declaredField = loadClass.getDeclaredField("sHookedMethodCallbacks"); declaredField.setAccessible(true); Map map = (Map) declaredField.get(loadClass); if (map == null || (keySet = map.keySet()) == null || keySet.size() <= 0) { return null; } return b(keySet); } catch (Exception unused) { return null; } } public Set<String> g() { Set keySet; try { Class<?> loadClass = ClassLoader.getSystemClassLoader().loadClass(a); if (loadClass == null) { return null; } Field declaredField = loadClass.getDeclaredField("methodCache"); declaredField.setAccessible(true); Map map = (Map) declaredField.get(loadClass); if (map == null || (keySet = map.keySet()) == null || keySet.size() <= 0) { return null; } return b(keySet); } catch (Exception unused) { return null; } } }