导航菜单

页面标题

页面副标题

管控平台 v5.2.3.0. - c.java 源代码

正在查看: 管控平台 v5.2.3.0. 应用的 c.java JAVA 源代码文件

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


package com.iflytek.pushclient.d.g.a;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.text.TextUtils;
import android.util.Log;
import com.iflytek.pushclient.b.k;
import com.iflytek.pushclient.b.n;
import com.igexin.push.f.p;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Random;
import javax.net.ssl.SSLHandshakeException;
import net.sqlcipher.BuildConfig;
import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.HttpVersion;
import org.apache.http.NameValuePair;
import org.apache.http.NoHttpResponseException;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.HttpRequestRetryHandler;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
import org.apache.log4j.Priority;
import org.apache.log4j.spi.LocationInfo;

public class c {

    private static DefaultHttpClient f899a;

    private static HttpRequestRetryHandler f900b = new a();

    private static ResponseHandler<String> f901c;

    static class a implements HttpRequestRetryHandler {
        a() {
        }

        @Override
        public boolean retryRequest(IOException iOException, int i, HttpContext httpContext) {
            if (i >= 3) {
                return false;
            }
            if (iOException instanceof NoHttpResponseException) {
                return true;
            }
            return ((iOException instanceof SSLHandshakeException) || (((HttpRequest) httpContext.getAttribute("http.request")) instanceof HttpEntityEnclosingRequest)) ? false : true;
        }
    }

    static class b implements ResponseHandler<String> {
        b() {
        }

        @Override
        public String handleResponse(HttpResponse httpResponse) throws ClientProtocolException, IOException {
            d dVar = new d(httpResponse);
            int statusCode = httpResponse.getStatusLine().getStatusCode();
            try {
                c.m(statusCode, dVar);
            } catch (com.iflytek.pushclient.a.g.a e) {
                n.b("HttpUtil", BuildConfig.FLAVOR, e);
            }
            if (statusCode != 200) {
                return null;
            }
            try {
                return dVar.a();
            } catch (com.iflytek.pushclient.a.g.d e2) {
                n.b("HttpUtil", BuildConfig.FLAVOR, e2);
                return null;
            }
        }
    }

    static {
        new BasicHttpContext();
        f901c = new b();
    }

    private static String a(int i) {
        return i + ":" + (i != 304 ? i != 406 ? i != 500 ? i != 400 ? i != 401 ? i != 403 ? i != 404 ? i != 502 ? i != 503 ? BuildConfig.FLAVOR : "Service Unavailable: The Weibo servers are up, but overloaded with requests. Try again later. The search and trend methods use this to indicate when you are being rate limited." : "Weibo is down or being upgraded." : "The URI requested is invalid or the resource requested, such as a user, does not exists." : "The request is understood, but it has been refused.  An accompanying error message will explain why." : "Authentication credentials were missing or incorrect." : "The request was invalid.  An accompanying error message will explain why. This is the status code will be returned during rate limiting." : "Something is broken.  Please post to the group so the Weibo team can investigate." : "Returned by the Search API when an invalid format is specified in the request." : null);
    }

    private static String b(Context context) {
        String str = BuildConfig.FLAVOR;
        try {
            ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), 128);
            if (applicationInfo != null && applicationInfo.metaData != null) {
                String obj = applicationInfo.metaData.get("IFLYTEK_APPKEY").toString();
                if (!TextUtils.isEmpty(obj)) {
                    String trim = obj.trim();
                    try {
                        if (trim.contains("'")) {
                            trim = trim.replace("'", BuildConfig.FLAVOR);
                        }
                        str = trim;
                    } catch (Exception e) {
                        e = e;
                        str = trim;
                        Log.e("HttpUtil", "Can not find IFLYTEK_APPKEY meta-data from AndroidManifest.xml.", e);
                        return str;
                    }
                }
            }
            if (TextUtils.isEmpty(str)) {
                Log.e("HttpUtil", "Can not find IFLYTEK_APPKEY meta-data from AndroidManifest.xml.");
            }
        } catch (Exception e2) {
            e = e2;
        }
        return str;
    }

    private static String c(Context context, String str, String str2) {
        String b2 = b(context);
        StringBuilder sb = new StringBuilder();
        sb.append("ver=1.3");
        sb.append("&appid=" + b2);
        if (l(context) != null) {
            sb.append("&operator=" + l(context).f902a);
            sb.append("&nettype=" + l(context).f903b);
        }
        sb.append("&cver=1049");
        sb.append("&svc=xpush");
        sb.append("&host=" + str);
        String a2 = k.a(sb.toString() + str2 + b2);
        StringBuilder sb2 = new StringBuilder();
        sb2.append("&sign=");
        sb2.append(a2);
        sb.append(sb2.toString());
        System.out.println(sb.toString());
        return sb.toString();
    }

    public static String d(String str, Context context) {
        System.out.println("ver:1.3");
        String str2 = new SimpleDateFormat("yyyy-MM-dd    hh:mm:ss").format(new Date()).toString().substring(4).replace("-", BuildConfig.FLAVOR).replace(" ", BuildConfig.FLAVOR).replace(":", BuildConfig.FLAVOR) + ".";
        Random random = new Random();
        for (int i = 0; i < 2; i++) {
            str2 = str2 + random.nextInt(9);
        }
        String str3 = str.split("/")[2];
        System.out.println("host:" + str3);
        if (TextUtils.isEmpty(str3)) {
            return null;
        }
        DefaultHttpClient i2 = i(p.f1691b);
        StringBuilder sb = new StringBuilder();
        sb.append("http://hdns.openspeech.cn/sip/resolver&srand=");
        sb.append(str2);
        System.out.println(sb.toString());
        HttpGet httpGet = new HttpGet(sb.toString());
        httpGet.setHeader("Connection", "close");
        httpGet.setHeader("X-Par", c(context, str3, str2));
        httpGet.setHeader("User-Agent", "Dalvik/1.6.0 (Linux; U; Android 7.0;)");
        httpGet.setHeader("Host", "hdns.openspeech.cn");
        httpGet.setHeader("Accept-Encoding", "gzip");
        try {
            return (String) i2.execute(httpGet, f901c);
        } catch (ClientProtocolException | IOException unused) {
            return null;
        } finally {
            k(httpGet, i2);
        }
    }

    public static String e(String str, String str2) throws com.iflytek.pushclient.a.g.a {
        DefaultHttpClient defaultHttpClient;
        HttpPost httpPost;
        HttpPost httpPost2 = null;
        try {
            try {
                defaultHttpClient = i("UTF-8");
                try {
                    defaultHttpClient.getParams().setParameter("http.protocol.allow-circular-redirects", Boolean.TRUE);
                    httpPost = new HttpPost(str);
                } catch (UnsupportedEncodingException e) {
                    e = e;
                } catch (ClientProtocolException e2) {
                    e = e2;
                } catch (IOException e3) {
                    e = e3;
                }
            } catch (Throwable th) {
                th = th;
            }
            try {
                httpPost.setEntity(new StringEntity(new String(str2.getBytes(), "UTF-8"), "UTF-8"));
                httpPost.addHeader("Host", httpPost.getURI().getHost());
                httpPost.addHeader("Content-Type", "text/html;charset=UTF-8");
                String str3 = (String) defaultHttpClient.execute(httpPost, f901c);
                k(httpPost, defaultHttpClient);
                return str3;
            } catch (UnsupportedEncodingException e4) {
                e = e4;
                n.a("HttpUtil", "post | throw UnsupportedEncodingException!!!");
                throw new com.iflytek.pushclient.a.g.a("不支持的编码集", e);
            } catch (ClientProtocolException e5) {
                e = e5;
                throw new com.iflytek.pushclient.a.g.a("客户端连接协议错误", e);
            } catch (IOException e6) {
                e = e6;
                n.g("HttpUtil", "post | throw IOException!!! & " + e.getCause());
                throw new com.iflytek.pushclient.a.g.a("IO操作异常", e);
            } catch (Throwable th2) {
                th = th2;
                httpPost2 = httpPost;
                k(httpPost2, defaultHttpClient);
                throw th;
            }
        } catch (UnsupportedEncodingException e7) {
            e = e7;
        } catch (ClientProtocolException e8) {
            e = e8;
        } catch (IOException e9) {
            e = e9;
        } catch (Throwable th3) {
            th = th3;
            defaultHttpClient = null;
        }
    }

    public static String f(String str, Map<String, String> map) throws com.iflytek.pushclient.a.g.a {
        return g(str, map, null);
    }

    public static String g(String str, Map<String, String> map, String str2) throws com.iflytek.pushclient.a.g.a {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        List<NameValuePair> h = h(map);
        if (h != null && h.size() > 0) {
            if (str2 == null) {
                str2 = "UTF-8";
            }
            String format = URLEncodedUtils.format(h, str2);
            if (str.indexOf(LocationInfo.NA) < 0) {
                str = str + LocationInfo.NA + format;
            } else {
                str = str.substring(0, str.indexOf(LocationInfo.NA) + 1) + format;
            }
        }
        DefaultHttpClient i = i(str2);
        i.getParams().setParameter("http.protocol.allow-circular-redirects", Boolean.TRUE);
        HttpGet httpGet = new HttpGet(str);
        try {
            try {
                try {
                    return (String) i.execute(httpGet, f901c);
                } catch (IOException e) {
                    throw new com.iflytek.pushclient.a.g.a("IO操作异常", e);
                }
            } catch (ClientProtocolException e2) {
                throw new com.iflytek.pushclient.a.g.a("客户端连接协议错误", e2);
            }
        } finally {
            k(httpGet, i);
        }
    }

    private static List<NameValuePair> h(Map<String, String> map) {
        if (map == null || map.size() == 0) {
            return null;
        }
        ArrayList arrayList = new ArrayList();
        for (Map.Entry<String, String> entry : map.entrySet()) {
            arrayList.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
        }
        return arrayList;
    }

    public static DefaultHttpClient i(String str) {
        if (f899a == null) {
            BasicHttpParams basicHttpParams = new BasicHttpParams();
            basicHttpParams.setParameter("http.protocol.version", HttpVersion.HTTP_1_1);
            basicHttpParams.setParameter("http.protocol.expect-continue", Boolean.FALSE);
            if (str == null) {
                str = "UTF-8";
            }
            basicHttpParams.setParameter("http.protocol.content-charset", str);
            SchemeRegistry schemeRegistry = new SchemeRegistry();
            schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
            schemeRegistry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
            DefaultHttpClient defaultHttpClient = new DefaultHttpClient(new ThreadSafeClientConnManager(basicHttpParams, schemeRegistry), basicHttpParams);
            f899a = defaultHttpClient;
            defaultHttpClient.setHttpRequestRetryHandler(f900b);
            HttpConnectionParams.setConnectionTimeout(basicHttpParams, Priority.WARN_INT);
            HttpConnectionParams.setSoTimeout(basicHttpParams, Priority.WARN_INT);
        }
        return f899a;
    }

    public static void k(HttpRequestBase httpRequestBase, HttpClient httpClient) {
        if (httpRequestBase != null) {
            httpRequestBase.abort();
        }
    }

    private static C0029c l(Context context) {
        NetworkInfo activeNetworkInfo;
        C0029c c0029c = new C0029c(null);
        ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
        if (connectivityManager != null && (activeNetworkInfo = connectivityManager.getActiveNetworkInfo()) != null && activeNetworkInfo.isAvailable()) {
            if (activeNetworkInfo.getTypeName().equals("WIFI")) {
                c0029c.f903b = "wifi";
                c0029c.f902a = "UNKONW";
                return c0029c;
            }
            String extraInfo = activeNetworkInfo.getExtraInfo();
            if (extraInfo == null) {
                return c0029c;
            }
            if (extraInfo.equals("3gwap")) {
                c0029c.f903b = "3gwap";
                c0029c.f902a = "CUCC";
                return c0029c;
            }
            if (extraInfo.equals("uniwap")) {
                c0029c.f903b = "uniwap";
                c0029c.f902a = "CUCC";
                return c0029c;
            }
            if (extraInfo.equals("3gnet")) {
                c0029c.f903b = "3gnet";
                c0029c.f902a = "CUCC";
                return c0029c;
            }
            if (extraInfo.equals("uninet")) {
                c0029c.f903b = "uninet";
                c0029c.f902a = "CUCC";
                return c0029c;
            }
            if (extraInfo.equals("cmnet")) {
                c0029c.f903b = "cmnet";
                c0029c.f902a = "CMCC";
                return c0029c;
            }
            if (extraInfo.equals("cmwap")) {
                c0029c.f903b = "cmwap";
                c0029c.f902a = "CMCC";
                return c0029c;
            }
            if (extraInfo.equals("ctnwt")) {
                c0029c.f903b = "ctnwt";
                c0029c.f902a = "CTCC";
                return c0029c;
            }
            if (extraInfo.equals("ctwap")) {
                c0029c.f903b = "ctwap";
                c0029c.f902a = "CTCC";
            }
        }
        return c0029c;
    }

    public static void m(int i, d dVar) throws com.iflytek.pushclient.a.g.a {
        String str = a(i) + "\n";
        n.a("HttpUtil", "statusCode == " + i);
        if (i == 200) {
            return;
        }
        throw new com.iflytek.pushclient.a.g.a(str + dVar.a(), i);
    }

    private static class C0029c {

        String f902a;

        String f903b;

        private C0029c() {
            this.f902a = null;
            this.f903b = null;
        }

        C0029c(a aVar) {
            this();
        }
    }
}