导航菜单

页面标题

页面副标题

哔哩哔哩 v1.6.6 - avm.java 源代码

正在查看: 哔哩哔哩 v1.6.6 应用的 avm.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package bl;

import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.EntityUtils;

public class avm {
    private HttpHost a;
    private DefaultHttpClient b;
    private String c;
    private Map<String, String> d;
    private awj e;
    private int f = 30000;

    public avo a(String str, byte[] bArr, String str2, int i) {
        String str3;
        String a = a(str);
        this.e.b("[" + a + "]Send request(" + bArr.length + "bytes):" + bArr);
        HttpPost httpPost = new HttpPost(a);
        httpPost.setHeader("Connection", "Keep-Alive");
        httpPost.removeHeaders("Cache-Control");
        httpPost.removeHeaders("User-Agent");
        if (this.a != null) {
            httpPost.addHeader("X-Online-Host", this.c);
            httpPost.addHeader("Accept", "*/*");
            httpPost.addHeader("Content-Type", "json");
        } else {
            this.b.getParams().removeParameter("http.route.default-proxy");
        }
        if (this.a == null) {
            httpPost.addHeader("Content-Encoding", str2);
        } else {
            httpPost.addHeader("X-Content-Encoding", str2);
        }
        httpPost.setEntity(new ByteArrayEntity(bArr));
        HttpResponse execute = this.b.execute(httpPost);
        HttpEntity entity = execute.getEntity();
        int statusCode = execute.getStatusLine().getStatusCode();
        long contentLength = entity.getContentLength();
        this.e.b("recv response status code:" + statusCode + ", content length:" + contentLength);
        byte[] byteArray = EntityUtils.toByteArray(entity);
        str3 = "";
        Header firstHeader = execute.getFirstHeader("Content-Encoding");
        if (firstHeader != null) {
            str3 = firstHeader.getValue().toUpperCase().contains("AES") ? new String(avn.a(avn.a()).a(i).b(byteArray), "UTF-8") : "";
            if (firstHeader.getValue().toUpperCase().contains("RSA")) {
                str3 = awl.b(byteArray);
            }
            if (firstHeader.getValue().toUpperCase().contains("IDENTITY")) {
                str3 = new String(byteArray, "UTF-8");
            }
        }
        this.e.b("recv response status code:" + statusCode + ", content :" + str3);
        return new avo(statusCode, str3);
    }

    public avm(String str, Map<String, String> map) {
        this.a = null;
        this.b = null;
        this.c = null;
        this.d = null;
        this.e = null;
        this.e = awf.a();
        this.a = awf.b();
        BasicHttpParams basicHttpParams = new BasicHttpParams();
        HttpConnectionParams.setConnectionTimeout(basicHttpParams, this.f);
        HttpConnectionParams.setSoTimeout(basicHttpParams, this.f);
        this.b = new DefaultHttpClient(basicHttpParams);
        awj awjVar = this.e;
        StringBuilder sb = new StringBuilder();
        sb.append("proxy==");
        sb.append(this.a == null ? "null" : this.a.getHostName());
        awjVar.b(sb.toString());
        if (this.a != null) {
            this.b.getParams().setParameter("http.route.default-proxy", this.a);
        }
        if (this.a != null && this.a.getHostName().equals("10.0.0.200")) {
            this.b.getCredentialsProvider().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("[email protected]", "vnet.mobi"));
        }
        Logger.getLogger("org.apache.http.wire").setLevel(Level.FINEST);
        Logger.getLogger("org.apache.http.headers").setLevel(Level.FINEST);
        System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
        System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
        System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "debug");
        System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http", "debug");
        System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.headers", "debug");
        this.b.setKeepAliveStrategy(new DefaultConnectionKeepAliveStrategy() {
            @Override
            public long getKeepAliveDuration(HttpResponse httpResponse, HttpContext httpContext) {
                long keepAliveDuration = super.getKeepAliveDuration(httpResponse, httpContext);
                if (keepAliveDuration == -1) {
                    return 20000L;
                }
                return keepAliveDuration;
            }
        });
        this.c = str;
        this.d = map;
    }

    public void a() {
        if (this.b != null) {
            this.b.getConnectionManager().shutdown();
            this.b = null;
            this.c = null;
            this.d = null;
            this.a = null;
        }
    }

    private String b() {
        StringBuilder sb = new StringBuilder();
        if (this.d != null && this.d.size() != 0) {
            int i = 0;
            for (Map.Entry<String, String> entry : this.d.entrySet()) {
                String str = i == 0 ? "?" : "&";
                i++;
                sb.append(str);
                sb.append(entry.getKey());
                sb.append("=");
                sb.append(entry.getValue());
            }
        }
        return sb.toString();
    }

    public String a(String str) {
        return this.c + str + b();
    }
}