Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Sloaix/ec14fce54a5ae88bfc697caa9235434e to your computer and use it in GitHub Desktop.
Save Sloaix/ec14fce54a5ae88bfc697caa9235434e to your computer and use it in GitHub Desktop.
com.ss.sys.ces.gg.tt from tiktok apk
package com.ss.sys.ces.gg;
import com.bytedance.frameworks.baselib.network.http.e.a;
import com.bytedance.frameworks.baselib.network.http.e;
import com.ss.a.b.b;
import com.ss.sys.ces.c;
import com.ss.sys.ces.out.StcSDKFactory;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.Map;
import org.json.JSONObject;
public class tt {
private static int a;
private static boolean b;
static {
}
static int a(int arg0) {
tt.a = arg0;
return arg0;
}
static boolean a() {
return tt.b;
}
static boolean a(String arg1) {
return tt.f(arg1);
}
static boolean a(boolean arg0) {
tt.b = arg0;
return arg0;
}
static int b() {
return tt.a;
}
static String b(String arg1) {
return tt.d(arg1);
}
static String c(String arg1) {
return tt.e(arg1);
}
private static String d(String arg4) {
int v1 = arg4.indexOf("?");
int v2 = arg4.indexOf("#");
if(v1 == -1) {
return null;
}
if(v2 == -1) {
return arg4.substring(v1 + 1);
}
return v2 < v1 ? null : arg4.substring(v1 + 1, v2);
}
private static String e(String arg6) {
String[] v1 = arg6.replace(" ", "").split(",");
int v0;
for(v0 = 0; v0 < v1.length; ++v0) {
String v3 = v1[v0];
int v4 = v3.indexOf("sessionid=");
if(v4 != -1) {
return v3.substring(v4 + 10);
}
}
return null;
}
private static boolean f(String arg1) {
return 0;
}
public static void init_gorgon() {
e.j = new a() {
@Override // com.bytedance.frameworks.baselib.network.http.e$a
public final Map a(String arg16, Map arg17) {
int v4_3;
StackTraceElement[] v5_1;
String v3_5;
String v2_9;
String v2_8;
String v2_5;
String v5;
String v6;
int v8;
String v7;
String v4;
String v2 = null;
HashMap v9 = new HashMap();
long v10 = Calendar.getInstance().getTimeInMillis();
int v12 = (int)(System.currentTimeMillis() / 1000L);
try {
if(!arg16.toLowerCase().contains("http") && !arg16.toLowerCase().contains("https")) {
throw new NullPointerException("nein http/https");
}
if((arg16.toLowerCase().contains("x-khronos")) && (arg16.toLowerCase().contains("x-gorgon"))) {
throw new NullPointerException("it had");
}
if(tt.a(arg16)) {
throw new NullPointerException("filter_1");
}
String v2_2 = tt.b(arg16);
v4 = null;
v7 = v2_2 == null || v2_2.length() <= 0 ? null : b.a(v2_2);
Iterator v13 = arg17.entrySet().iterator();
v8 = -1;
v6 = null;
v5 = null;
while(v13.hasNext()) {
Object v2_3 = v13.next();
Map.Entry v3 = (Map.Entry)v2_3;
if(((String)v3.getKey()).toUpperCase().contains("X-SS-STUB")) {
v4 = (String)((List)v3.getValue()).get(0);
}
if(((String)v3.getKey()).toUpperCase().contains("COOKIE")) {
String v2_4 = (String)((List)v3.getValue()).get(0);
if(v2_4 != null && v2_4.length() > 0) {
v6 = b.a(v2_4);
String v14 = tt.c(v2_4);
if(v14 != null && v14.length() > 0) {
v2_5 = b.a(v14);
StcSDKFactory.getInstance().setSession(v14);
}
else {
v2_5 = v5;
}
v5 = v2_5;
}
}
if(!((String)v3.getKey()).toUpperCase().contains("META-SHADOWMAZE")) {
continue;
}
String v2_6 = (String)((List)v3.getValue()).get(0);
if(v2_6 == null || v2_6.length() <= 0 || Integer.parseInt(v2_6) != 1) {
continue;
}
v8 = 1;
}
if(v7 == null) {
goto label_116;
}
else {
int v2_7 = v7.length();
goto label_110;
}
goto label_117;
}
catch(Throwable v2_1) {
goto label_205;
}
label_110:
if(v2_7 <= 0) {
v2_8 = "00000000000000000000000000000000";
}
else {
v2_8 = v7;
goto label_117;
label_116:
v2_8 = "00000000000000000000000000000000";
}
label_117:
if(v4 == null) {
v4 = "00000000000000000000000000000000";
}
else {
try {
int v3_1 = v4.length();
}
catch(Throwable v2_1) {
goto label_205;
}
if(v3_1 <= 0) {
v4 = "00000000000000000000000000000000";
}
}
if(v6 == null) {
v6 = "00000000000000000000000000000000";
}
else {
try {
int v3_2 = v6.length();
}
catch(Throwable v2_1) {
goto label_205;
}
if(v3_2 <= 0) {
v6 = "00000000000000000000000000000000";
}
}
if(v5 == null) {
v5 = "00000000000000000000000000000000";
}
else {
try {
int v3_3 = v5.length();
}
catch(Throwable v2_1) {
goto label_205;
}
if(v3_3 <= 0) {
v5 = "00000000000000000000000000000000";
}
}
try {
v2_9 = com.ss.a.b.a.a(com.ss.sys.ces.a.leviathan(v8, v12, com.ss.a.b.a.a(v2_8 + v4 + v6 + v5)));
}
catch(Throwable v2_1) {
goto label_205;
}
v9.put("X-Khronos", v12);
v9.put("X-Gorgon", v2_9);
long v4_1 = Calendar.getInstance().getTimeInMillis() - v10;
if(c.a().i) {
if(v4_1 > 10L && (tt.b() == 0 || v12 - tt.b() >= 20)) {
JSONObject v3_4 = new JSONObject();
try {
v3_4.put("url", arg16);
v3_4.put("consume", v4_1);
}
catch(Throwable v4_2) {
}
com.ss.sys.ces.e.a(1, "cus_req_sig", v3_4);
tt.a(v12);
}
if(v2_9 == null || v2_9.length() <= 0) {
com.ss.sys.ces.e.a(1, "sig_gorgon_null", "");
}
}
return v9;
try {
throw new NullPointerException("filter_1");
}
catch(Throwable v2_1) {
}
label_205:
if(arg16 != null) {
try {
if(arg16.length() > 0 && !arg16.contains("/c/m?os=")) {
v3_5 = "" + v2_1.toString();
if(!v3_5.contains("UnsatisfiedLinkError") || !tt.a()) {
if(v3_5.contains("UnsatisfiedLinkError")) {
tt.a(true);
}
goto label_229;
}
}
else {
goto label_272;
}
goto label_276;
}
catch(Throwable v2_10) {
goto label_290;
}
try {
label_229:
v5_1 = v2_1.getStackTrace();
v4_3 = 0;
v2 = v3_5;
while(true) {
label_232:
int v3_7 = v5_1.length;
break;
}
}
catch(Throwable v3_6) {
v3_5 = v2 + "\n[-]double error";
goto label_276;
}
if(v4_3 < v3_7) {
StackTraceElement v3_8 = v5_1[v4_3];
try {
v2 = v2 + "at " + v3_8.getClassName() + "." + v3_8.getMethodName() + "(" + v3_8.getFileName() + ":" + v3_8.getLineNumber() + ")\n";
++v4_3;
goto label_232;
}
catch(Throwable v3_6) {
}
try {
v3_5 = v2 + "\n[-]double error";
}
catch(Throwable v2_10) {
goto label_290;
}
goto label_276;
}
v3_5 = v2;
goto label_276;
}
label_272:
v3_5 = "";
try {
label_276:
com.ss.sys.ces.e.a(1, "sig_gorgon_throwable", v3_5);
goto label_299;
}
catch(Throwable v2_10) {
}
label_290:
v9.put("X-Khronos", v12);
v9.put("X-Gorgon", "");
Calendar.getInstance().getTimeInMillis();
c.a();
throw v2_10;
label_299:
v9.put("X-Khronos", v12);
v9.put("X-Gorgon", "");
Calendar.getInstance().getTimeInMillis();
return v9;
}
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment