JieJing Cleaner v1.4.2版本的 MD5 值为:a574eea9fb07160f0bbb08ba0adf1c62

以下内容为反编译后的 e.java 源代码,内容仅作参考


package com.kwad.sdk.api.loader;

import android.text.TextUtils;
import androidx.annotation.Nullable;
import com.baidu.mobads.sdk.internal.ae;
import com.kwad.sdk.api.core.IKsAdSDK;
import com.kwad.sdk.api.core.RequestParamsUtils;
import com.kwad.sdk.api.core.TLSConnectionUtils;
import com.kwad.sdk.api.loader.a;
import com.wolike.ads.utils.PhoneInfoUtil;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
public class e {
    public String a;
    public String b;
    public int c;
    public Map<String, String> d = new HashMap();
    public IKsAdSDK e;

    public interface a {
        void a(a.b bVar);

        void a(Exception exc);
    }

    public e(String str, IKsAdSDK iKsAdSDK) {
        this.b = str;
        this.a = str;
        this.e = iKsAdSDK;
    }

    private String a() {
        int i2;
        String valueOf = String.valueOf(Loader.get().a(Loader.get().getContext()));
        IKsAdSDK ksAdSDKImpl = Loader.get().getKsAdSDKImpl();
        if (ksAdSDKImpl != null) {
            if (TextUtils.isEmpty(valueOf)) {
                valueOf = ksAdSDKImpl.getSDKVersion();
            }
            i2 = ksAdSDKImpl.getSDKVersionCode();
        } else {
            i2 = -1;
        }
        JSONObject appInfo = Loader.get().getKsAdSDKImpl().getAppInfo();
        JSONObject deviceInfo = Loader.get().getKsAdSDKImpl().getDeviceInfo();
        JSONObject networkInfo = Loader.get().getKsAdSDKImpl().getNetworkInfo();
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("sdkApiVersion", "3.3.15");
            jSONObject.put("sdkApiVersionCode", 3031500);
            jSONObject.put("sdkVersion", valueOf);
            jSONObject.put(PhoneInfoUtil.l, i2);
            jSONObject.put("sdkType", 1);
            jSONObject.put("appInfo", appInfo);
            jSONObject.put("deviceInfo", deviceInfo);
            jSONObject.put("networkInfo", networkInfo);
            jSONObject.put("sdkAbi", s.b());
        } catch (JSONException e) {
            e.printStackTrace();
        }
        if (this.e != null) {
            JSONObject jSONObject2 = new JSONObject();
            try {
                jSONObject2.put("version", "3.3.15");
                jSONObject2.put(com.anythink.expressad.videocommon.e.b.u, appInfo.optString(com.anythink.expressad.videocommon.e.b.u));
                jSONObject2.put("message", this.e.getRM(jSONObject.toString()));
            } catch (JSONException e2) {
                e2.printStackTrace();
            }
            this.e.sR(this.b.replace("https://open.e.kuaishou.com", ""), this.d, jSONObject2.toString());
            return jSONObject2.toString();
        }
        return jSONObject.toString();
    }

    public static String a(InputStream inputStream) {
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        byte[] bArr = new byte[1024];
        while (true) {
            try {
                try {
                    int read = inputStream.read(bArr);
                    if (read == -1) {
                        break;
                    }
                    byteArrayOutputStream.write(bArr, 0, read);
                } catch (IOException e) {
                    e.printStackTrace();
                    if (inputStream != null) {
                        try {
                            inputStream.close();
                        } catch (IOException e2) {
                            e2.printStackTrace();
                        }
                    }
                    try {
                        byteArrayOutputStream.close();
                        return null;
                    } catch (IOException e3) {
                        e3.printStackTrace();
                        return null;
                    }
                }
            } catch (Throwable th) {
                if (inputStream != null) {
                    try {
                        inputStream.close();
                    } catch (IOException e4) {
                        e4.printStackTrace();
                    }
                }
                try {
                    byteArrayOutputStream.close();
                } catch (IOException e5) {
                    e5.printStackTrace();
                }
                throw th;
            }
        }
        String str = new String(byteArrayOutputStream.toByteArray());
        try {
            inputStream.close();
        } catch (IOException e6) {
            e6.printStackTrace();
        }
        try {
            byteArrayOutputStream.close();
        } catch (IOException e7) {
            e7.printStackTrace();
        }
        return str;
    }

    private URLConnection a(String str, int i2, int i3, boolean z) {
        URLConnection openConnection = new URL(str).openConnection();
        TLSConnectionUtils.wrapHttpURLConnection(openConnection);
        a("Accept-Language", "zh-CN");
        if (i2 > 0) {
            openConnection.setConnectTimeout(i2);
        }
        if (i3 > 0) {
            openConnection.setReadTimeout(i3);
        }
        openConnection.setUseCaches(z);
        openConnection.setDoInput(true);
        a("Connection", "keep-alive");
        a("Charset", com.anythink.expressad.foundation.f.f.g.c.b);
        return openConnection;
    }

    private void a(String str, String str2) {
        this.d.put(str, str2);
    }

    @Nullable
    private HttpURLConnection b() {
        if (TextUtils.isEmpty(this.a)) {
            return null;
        }
        HttpURLConnection httpURLConnection = (HttpURLConnection) a(this.a, 10000, 30000, false);
        httpURLConnection.setRequestMethod(ae.b);
        httpURLConnection.setDoOutput(true);
        httpURLConnection.setInstanceFollowRedirects(true);
        a(com.anythink.expressad.foundation.f.f.g.c.a, "application/json; charset=UTF-8");
        a(RequestParamsUtils.USER_AGENT_KEY, RequestParamsUtils.getUserAgent());
        IKsAdSDK iKsAdSDK = this.e;
        if (iKsAdSDK != null) {
            iKsAdSDK.addHp(this.d);
        }
        return httpURLConnection;
    }

    public void b(a aVar) {
        HttpURLConnection httpURLConnection = null;
        try {
            try {
                httpURLConnection = b();
                if (httpURLConnection != null) {
                    String a2 = a();
                    if (this.d != null) {
                        for (Map.Entry<String, String> entry : this.d.entrySet()) {
                            httpURLConnection.setRequestProperty(entry.getKey(), entry.getValue());
                        }
                    }
                    httpURLConnection.connect();
                    new DataOutputStream(httpURLConnection.getOutputStream()).write(a2.getBytes());
                    int responseCode = httpURLConnection.getResponseCode();
                    if (responseCode == 200) {
                        String a3 = a(httpURLConnection.getInputStream());
                        a.b bVar = new a.b();
                        JSONObject jSONObject = new JSONObject(a3);
                        if (this.e != null) {
                            jSONObject.put("data", new JSONObject(this.e.getRD(jSONObject.optString("data"))));
                        }
                        bVar.a(jSONObject);
                        aVar.a(bVar);
                    } else if (responseCode / 100 != 3) {
                        throw new RuntimeException("response code = " + responseCode);
                    } else if (this.c < 21) {
                        this.a = httpURLConnection.getHeaderField("Location");
                        this.c++;
                        b(aVar);
                    }
                }
                if (httpURLConnection == null) {
                    return;
                }
            } catch (Exception e) {
                aVar.a(e);
                if (0 == 0) {
                    return;
                }
            }
            try {
                httpURLConnection.disconnect();
            } catch (Exception unused) {
            }
        } catch (Throwable th) {
            if (0 != 0) {
                try {
                    httpURLConnection.disconnect();
                } catch (Exception unused2) {
                }
            }
            throw th;
        }
    }

    public void a(final a aVar) {
        i.a(new Runnable() {
            @Override
            public void run() {
                e.this.b(aVar);
            }
        });
    }
}