柬埔寨通 v6.1.5版本的 MD5 值为:9b68581ac30883219d6a25858a099d6b
以下内容为反编译后的 UrlUtils.java 源代码,内容仅作参考
package net.duohuo.magappx.common.util;
import android.net.Uri;
import android.text.TextUtils;
import java.util.List;
import net.duohuo.core.fresco.FrescoController;
import net.duohuo.core.ioc.Ioc;
import net.duohuo.core.util.StrUtil;
import net.duohuo.magappx.API;
import net.duohuo.magappx.SiteConfig;
import net.duohuo.magappx.common.web.MallHelper;
public class UrlUtils {
public static boolean limitUrlVisit(String str) {
if (TextUtils.isEmpty(str)) {
return false;
}
String baseUrl = getBaseUrl(str);
return isHostIP(baseUrl) || isWhiteDomain(((SiteConfig) Ioc.get(SiteConfig.class)).domainWhite, getHost(baseUrl)) || isWhiteDomain(((SiteConfig) Ioc.get(SiteConfig.class)).domainCooperation, getHost(baseUrl)) || MallHelper.isMallSafeUrl(baseUrl) || baseUrl.contains("paycontent.sapp.magcloud.net");
}
public static String getHost(String str) {
if (TextUtils.isEmpty(str)) {
return null;
}
try {
Uri parse = Uri.parse(str);
parse.getHost();
return parse.getHost();
} catch (Exception unused) {
return null;
}
}
public static boolean isHostIP(String str) {
if (str.startsWith("https://app.jpztong.com/".substring(0, 23))) {
return true;
}
return "https://app.jpztong.com/".contains(getHost(str));
}
public static boolean isWhiteDomain(List<String> list, String str) {
if (list != null && !TextUtils.isEmpty(str)) {
for (int i = 0; i < list.size(); i++) {
if (list.get(i).contains(str)) {
return true;
}
}
}
return false;
}
public static String getBaseUrl(String str) {
if (TextUtils.isEmpty(str)) {
return "";
}
String replace = str.toLowerCase().replace(FrescoController.HTTP_PERFIX, "").replace(FrescoController.HTTPS_PERFIX, "");
int indexOf = replace.indexOf("/");
if (indexOf > -1) {
replace = replace.substring(0, indexOf);
}
if (str.contains(FrescoController.HTTP_PERFIX)) {
return FrescoController.HTTP_PERFIX + replace;
}
return FrescoController.HTTPS_PERFIX + replace;
}
public static String addGetUrlParameter(String str, String str2) {
if (str.contains(str2)) {
return str;
}
if (str.contains("#")) {
String[] split = str.split("#", 2);
StringBuilder sb = new StringBuilder();
sb.append(split[0]);
sb.append(split[0].contains("?") ? "&" : "?");
sb.append(str2);
sb.append("#");
sb.append(split[1]);
return sb.toString();
}
StringBuilder sb2 = new StringBuilder();
sb2.append(str);
sb2.append(str.contains("?") ? "&" : "?");
sb2.append(str2);
return sb2.toString();
}
public static String deleteGetUrlParameter(String str, String str2) {
return str.replace(str2, "").replace("&&", "&");
}
public static String addUrl(String str, String str2) {
String str3;
String str4 = "";
long currentTimeMillis = System.currentTimeMillis() / 1000;
if (TextUtils.isEmpty(str2)) {
return str;
}
try {
String substring = StrUtil.decryptByPublicKey(str2, MagRsaEncryptUtil.key).replace(API.name1, "").replace(API.name2, "").substring(32);
String substring2 = substring.substring(0, substring.length() - 32);
String[] split = str.split("\\?");
if (split.length > 1) {
str = split[0];
str3 = split[1];
} else {
str3 = "";
}
String encode = MD5Encoder.encode(Uri.parse(str).getPath() + com.xiaomi.mipush.sdk.Constants.ACCEPT_TIME_SEPARATOR_SERVER + currentTimeMillis + "-0-0-" + substring2);
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.append("?auth_key=");
sb.append(currentTimeMillis);
sb.append("-0-0-");
sb.append(encode);
if (!TextUtils.isEmpty(str3)) {
str4 = "&" + str3;
}
sb.append(str4);
return sb.toString();
} catch (Exception unused) {
return str;
}
}
}