Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
package com.tencent.open.web.security;
import android.content.Context;
import com.tencent.connect.auth.AuthAgent;
import com.tencent.open.a.f;
import com.tencent.open.utils.d;
import java.io.File;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class JniInterface {
public static boolean isJniOk = false;
public static native boolean BackSpaceChar(boolean z, int i);
public static native boolean clearAllPWD();
public static native String getPWDKeyToMD5(String str);
public static native boolean insetTextToArray(int i, String str, int i2);
public static void loadSo() {
if (isJniOk) {
return;
}
try {
Context a = d.a();
if (a != null) {
if (new File(a.getFilesDir().toString() + "/" + AuthAgent.g).exists()) {
System.load(a.getFilesDir().toString() + "/" + AuthAgent.g);
isJniOk = true;
f.c("openSDK_LOG.JniInterface", "-->load lib success:" + AuthAgent.g);
} else {
f.c("openSDK_LOG.JniInterface", "-->fail, because so is not exists:" + AuthAgent.g);
}
} else {
f.c("openSDK_LOG.JniInterface", "-->load lib fail, because context is null:" + AuthAgent.g);
}
} catch (Throwable th) {
f.b("openSDK_LOG.JniInterface", "-->load lib error:" + AuthAgent.g, th);
}
}
}

View File

@@ -0,0 +1,84 @@
package com.tencent.open.web.security;
import com.tencent.open.a;
import com.tencent.open.a.f;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class SecureJsInterface extends a.b {
public static boolean isPWDEdit = false;
private String a;
public void clearAllEdit() {
f.c("openSDK_LOG.SecureJsInterface", "-->clear all edit.");
try {
JniInterface.clearAllPWD();
} catch (Exception e) {
f.e("openSDK_LOG.SecureJsInterface", "-->clear all edit exception: " + e.getMessage());
throw new RuntimeException(e);
}
}
public void curPosFromJS(String str) {
int i;
f.b("openSDK_LOG.SecureJsInterface", "-->curPosFromJS: " + str);
try {
i = Integer.parseInt(str);
} catch (NumberFormatException e) {
f.b("openSDK_LOG.SecureJsInterface", "-->curPosFromJS number format exception.", e);
i = -1;
}
if (i < 0) {
throw new RuntimeException("position is illegal.");
}
boolean z = a.c;
boolean z2 = a.b;
if (z2) {
if (Boolean.valueOf(JniInterface.BackSpaceChar(z2, i)).booleanValue()) {
a.b = false;
return;
}
return;
}
this.a = a.a;
String str2 = this.a;
JniInterface.insetTextToArray(i, str2, str2.length());
f.a("openSDK_LOG.SecureJsInterface", "curPosFromJS mKey: " + this.a);
}
@Override // com.tencent.open.a.b
public boolean customCallback() {
return true;
}
public String getMD5FromNative() {
f.c("openSDK_LOG.SecureJsInterface", "-->get md5 form native");
try {
String pWDKeyToMD5 = JniInterface.getPWDKeyToMD5(null);
f.a("openSDK_LOG.SecureJsInterface", "-->getMD5FromNative, MD5= " + pWDKeyToMD5);
return pWDKeyToMD5;
} catch (Exception e) {
f.e("openSDK_LOG.SecureJsInterface", "-->get md5 form native exception: " + e.getMessage());
throw new RuntimeException(e);
}
}
public void isPasswordEdit(String str) {
int i;
f.c("openSDK_LOG.SecureJsInterface", "-->is pswd edit, flag: " + str);
try {
i = Integer.parseInt(str);
} catch (Exception e) {
f.e("openSDK_LOG.SecureJsInterface", "-->is pswd edit exception: " + e.getMessage());
i = -1;
}
if (i != 0 && i != 1) {
throw new RuntimeException("is pswd edit flag is illegal.");
}
if (i == 0) {
isPWDEdit = false;
} else if (i == 1) {
isPWDEdit = true;
}
}
}

View File

@@ -0,0 +1,46 @@
package com.tencent.open.web.security;
import android.view.KeyEvent;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputConnectionWrapper;
import com.tencent.open.a.f;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class a extends InputConnectionWrapper {
public static String a = null;
public static boolean b = false;
public static boolean c = false;
public a(InputConnection inputConnection, boolean z) {
super(inputConnection, z);
}
@Override // android.view.inputmethod.InputConnectionWrapper, android.view.inputmethod.InputConnection
public boolean commitText(CharSequence charSequence, int i) {
c = true;
a = charSequence.toString();
f.a("openSDK_LOG.CaptureInputConnection", "-->commitText: " + charSequence.toString());
return super.commitText(charSequence, i);
}
@Override // android.view.inputmethod.InputConnectionWrapper, android.view.inputmethod.InputConnection
public boolean sendKeyEvent(KeyEvent keyEvent) {
if (keyEvent.getAction() == 0) {
f.c("openSDK_LOG.CaptureInputConnection", "sendKeyEvent");
a = String.valueOf((char) keyEvent.getUnicodeChar());
c = true;
f.b("openSDK_LOG.CaptureInputConnection", "s: " + a);
}
f.b("openSDK_LOG.CaptureInputConnection", "-->sendKeyEvent: " + a);
return super.sendKeyEvent(keyEvent);
}
@Override // android.view.inputmethod.InputConnectionWrapper, android.view.inputmethod.InputConnection
public boolean setComposingText(CharSequence charSequence, int i) {
c = true;
a = charSequence.toString();
f.a("openSDK_LOG.CaptureInputConnection", "-->setComposingText: " + charSequence.toString());
return super.setComposingText(charSequence, i);
}
}

View File

@@ -0,0 +1,64 @@
package com.tencent.open.web.security;
import android.net.Uri;
import android.text.TextUtils;
import android.webkit.WebView;
import com.tencent.open.a;
import com.tencent.open.a.f;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class b extends com.tencent.open.a {
@Override // com.tencent.open.a
public void a(String str, String str2, List<String> list, a.C0016a c0016a) {
f.a("openSDK_LOG.SecureJsBridge", "-->getResult, objectName: " + str + " | methodName: " + str2);
int size = list.size();
for (int i = 0; i < size; i++) {
try {
list.set(i, URLDecoder.decode(list.get(i), "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
a.b bVar = this.a.get(str);
if (bVar != null) {
f.b("openSDK_LOG.SecureJsBridge", "-->handler != null");
bVar.call(str2, list, c0016a);
} else {
f.b("openSDK_LOG.SecureJsBridge", "-->handler == null");
if (c0016a != null) {
c0016a.a();
}
}
}
@Override // com.tencent.open.a
public boolean a(WebView webView, String str) {
f.a("openSDK_LOG.SecureJsBridge", "-->canHandleUrl---url = " + str);
if (str == null || !Uri.parse(str).getScheme().equals("jsbridge")) {
return false;
}
ArrayList arrayList = new ArrayList(Arrays.asList((str + "/#").split("/")));
if (arrayList.size() < 7) {
return false;
}
String str2 = (String) arrayList.get(2);
String str3 = (String) arrayList.get(3);
String str4 = (String) arrayList.get(4);
String str5 = (String) arrayList.get(5);
f.a("openSDK_LOG.SecureJsBridge", "-->canHandleUrl, objectName: " + str2 + " | methodName: " + str3 + " | snStr: " + str4);
if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3) && !TextUtils.isEmpty(str4)) {
try {
a(str2, str3, arrayList.subList(6, arrayList.size() - 1), new c(webView, Long.parseLong(str4), str, str5));
return true;
} catch (Exception unused) {
}
}
return false;
}
}

View File

@@ -0,0 +1,60 @@
package com.tencent.open.web.security;
import android.webkit.WebView;
import com.tencent.open.a;
import com.tencent.open.a.f;
import com.ubt.jimu.unity.bluetooth.UnityActivity;
import org.json.JSONException;
import org.json.JSONObject;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class c extends a.C0016a {
private String d;
public c(WebView webView, long j, String str, String str2) {
super(webView, j, str);
this.d = str2;
}
private void b(String str) {
WebView webView = this.a.get();
if (webView != null) {
StringBuffer stringBuffer = new StringBuffer("javascript:");
stringBuffer.append("if(!!");
stringBuffer.append(this.d);
stringBuffer.append("){");
stringBuffer.append(this.d);
stringBuffer.append("(");
stringBuffer.append(str);
stringBuffer.append(")}");
String stringBuffer2 = stringBuffer.toString();
f.a("openSDK_LOG.SecureJsListener", "-->callback, callback: " + stringBuffer2);
webView.loadUrl(stringBuffer2);
}
}
@Override // com.tencent.open.a.C0016a
public void a(Object obj) {
f.a("openSDK_LOG.SecureJsListener", "-->onComplete, result: " + obj);
}
@Override // com.tencent.open.a.C0016a
public void a() {
f.b("openSDK_LOG.SecureJsListener", "-->onNoMatchMethod...");
}
@Override // com.tencent.open.a.C0016a
public void a(String str) {
f.a("openSDK_LOG.SecureJsListener", "-->onCustomCallback, js: " + str);
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put(UnityActivity.RESULT, !com.tencent.open.c.c.a ? -4 : 0);
jSONObject.put("sn", this.b);
jSONObject.put("data", str);
} catch (JSONException e) {
e.printStackTrace();
}
b(jSONObject.toString());
}
}