手机管家 v6.0.0版本的 MD5 值为:bf0bca2cb03f766137fe9ecf7383a634

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


package tcs;

import android.content.Context;
import android.net.Proxy;
import com.tencent.kingkong.database.SQLiteDatabase;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.io.Serializable;
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.Socket;
import java.net.URL;
import java.security.MessageDigest;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;

public class bfy {
    private static bfy eNe;
    private String OT;
    private String Rb;
    private String Rc;
    private String Ri;
    private String a;

    static class a {
        public String a = SQLiteDatabase.KeyEmpty;
        public int b = -1;
    }

    public static class b {
        public long a = -1;
        public long b = -1;
        public long c = -1;
        public long d = -1;
        public long e = -1;
        public String Rm = SQLiteDatabase.KeyEmpty;
    }

    private bfy(Context context) {
        this.a = SQLiteDatabase.KeyEmpty;
        this.OT = SQLiteDatabase.KeyEmpty;
        this.Rb = SQLiteDatabase.KeyEmpty;
        this.Rc = SQLiteDatabase.KeyEmpty;
        this.Ri = SQLiteDatabase.KeyEmpty;
        this.OT = com.tencent.beacon.a.e.KY().ed();
        com.tencent.beacon.a.g.cL(context);
        this.Rb = com.tencent.beacon.a.g.ac(context);
        this.Rc = com.tencent.beacon.a.g.F(context);
        this.Ri = com.tencent.beacon.a.g.bq(context);
        try {
            String f = com.tencent.beacon.a.a.f(context, "QIMEI_DENGTA", SQLiteDatabase.KeyEmpty);
            if (f != null && !SQLiteDatabase.KeyEmpty.equals(f)) {
                this.a = f;
            }
        } catch (Exception e) {
        }
    }

    public static bfy dd(Context context) {
        if (eNe == null) {
            eNe = new bfy(context);
        }
        return eNe;
    }

    public static long Y(String str, int i) {
        long j;
        Socket socket;
        if (str == null || i <= 0) {
            return -1L;
        }
        ?? r1 = 0;
        Socket socket2 = null;
        long currentTimeMillis = System.currentTimeMillis();
        InetSocketAddress inetSocketAddress = new InetSocketAddress(str, i);
        try {
            try {
                socket = new Socket();
                r1 = 30000;
                r1 = 30000;
            } catch (Throwable th) {
                th = th;
            }
        } catch (Throwable th2) {
            th = th2;
        }
        try {
            socket.connect(inetSocketAddress, ke.YP);
            j = System.currentTimeMillis() - currentTimeMillis;
            bgu.f(" s conn:" + j, new Object[0]);
            try {
                socket.close();
            } catch (IOException e) {
                e.printStackTrace();
                bgu.i(e.getMessage(), new Object[0]);
            }
        } catch (Throwable th3) {
            th = th3;
            r1 = socket;
            if (r1 != 0) {
                try {
                    r1.close();
                } catch (IOException e2) {
                    e2.printStackTrace();
                    bgu.i(e2.getMessage(), new Object[0]);
                }
            }
            throw th;
        }
        return j;
    }

    public String a() {
        return (this.a == null || SQLiteDatabase.KeyEmpty.equals(this.a)) ? this.OT : this.a;
    }

    public void a(String str) {
        this.a = str;
    }

    public String b() {
        return this.OT;
    }

    public String bx() {
        return this.Rb;
    }

    public String db() {
        return this.Rc;
    }

    public String dZ() {
        return this.Ri;
    }

    public static b q(String str, boolean z) {
        OutputStream outputStream;
        Socket socket;
        InputStream inputStream;
        Throwable th;
        String str2;
        InputStream inputStream2 = null;
        if (str == null || str.equals(SQLiteDatabase.KeyEmpty)) {
            return null;
        }
        b bVar = new b();
        try {
            URL url = new URL(str);
            String host = url.getHost();
            long currentTimeMillis = System.currentTimeMillis();
            InetAddress byName = InetAddress.getByName(host);
            bVar.a = System.currentTimeMillis() - currentTimeMillis;
            bgu.f(" dns: " + bVar.a, new Object[0]);
            StringBuffer stringBuffer = new StringBuffer();
            byte[] address = byName.getAddress();
            for (int i = 0; i < address.length; i++) {
                stringBuffer.append("." + (address[i] < 0 ? address[i] + 256 : address[i]));
            }
            bVar.Rm = stringBuffer.substring(1);
            stringBuffer.setLength(0);
            if (z) {
                return bVar;
            }
            int port = url.getPort();
            if (port < 0) {
                port = 80;
            }
            InetSocketAddress inetSocketAddress = new InetSocketAddress(byName, port);
            long currentTimeMillis2 = System.currentTimeMillis();
            socket = new Socket();
            try {
                socket.connect(inetSocketAddress, ke.YP);
                bVar.b = System.currentTimeMillis() - currentTimeMillis2;
                bgu.f(" conn: " + bVar.b, new Object[0]);
                str2 = "HEAD " + (url.getPath() + (url.getQuery() != null ? "?" + url.getQuery() : SQLiteDatabase.KeyEmpty)) + " HTTP/1.1 \r\nHost: " + host + "\r\nConnection: close\r\n\r\n";
                outputStream = socket.getOutputStream();
            } catch (Throwable th2) {
                th = th2;
                outputStream = null;
            }
            try {
                inputStream = socket.getInputStream();
                try {
                    try {
                        long currentTimeMillis3 = System.currentTimeMillis();
                        outputStream.write(str2.getBytes("UTF-8"));
                        outputStream.flush();
                        bVar.c = System.currentTimeMillis() - currentTimeMillis3;
                        bgu.f(" re: " + bVar.c, new Object[0]);
                        long currentTimeMillis4 = System.currentTimeMillis();
                        inputStream.read();
                        bVar.d = System.currentTimeMillis() - currentTimeMillis4;
                        bgu.f(" wait: " + bVar.d, new Object[0]);
                        long currentTimeMillis5 = System.currentTimeMillis();
                        int read = inputStream.read(new byte[500]);
                        bVar.e = System.currentTimeMillis() - currentTimeMillis5;
                        bgu.f(" readp: " + bVar.e, new Object[0]);
                        bgu.f(" datasize: " + read, new Object[0]);
                        if (outputStream != null) {
                            try {
                                outputStream.close();
                            } catch (IOException e) {
                                e.printStackTrace();
                            }
                        }
                        if (inputStream != null) {
                            try {
                                inputStream.close();
                            } catch (IOException e2) {
                                e2.printStackTrace();
                            }
                        }
                        try {
                            socket.close();
                            return bVar;
                        } catch (IOException e3) {
                            e3.printStackTrace();
                            bgu.i(e3.getMessage(), new Object[0]);
                            return bVar;
                        }
                    } catch (Throwable th3) {
                        th = th3;
                        th.printStackTrace();
                        bgu.i(th.getMessage(), new Object[0]);
                        if (outputStream != null) {
                            try {
                                outputStream.close();
                            } catch (IOException e4) {
                                e4.printStackTrace();
                            }
                        }
                        if (inputStream != null) {
                            try {
                                inputStream.close();
                            } catch (IOException e5) {
                                e5.printStackTrace();
                            }
                        }
                        if (socket == null) {
                            return bVar;
                        }
                        try {
                            socket.close();
                            return bVar;
                        } catch (IOException e6) {
                            e6.printStackTrace();
                            bgu.i(e6.getMessage(), new Object[0]);
                            return bVar;
                        }
                    }
                } catch (Throwable th4) {
                    th = th4;
                    inputStream2 = inputStream;
                    if (outputStream != null) {
                        try {
                            outputStream.close();
                        } catch (IOException e7) {
                            e7.printStackTrace();
                        }
                    }
                    if (inputStream2 != null) {
                        try {
                            inputStream2.close();
                        } catch (IOException e8) {
                            e8.printStackTrace();
                        }
                    }
                    if (socket != null) {
                        throw th;
                    }
                    try {
                        socket.close();
                        throw th;
                    } catch (IOException e9) {
                        e9.printStackTrace();
                        bgu.i(e9.getMessage(), new Object[0]);
                        throw th;
                    }
                }
            } catch (Throwable th5) {
                th = th5;
                if (outputStream != null) {
                }
                if (inputStream2 != null) {
                }
                if (socket != null) {
                }
            }
        } catch (Throwable th6) {
            outputStream = null;
            socket = null;
            inputStream = null;
            th = th6;
        }
    }

    public static byte[] d(Object obj) {
        ObjectOutputStream objectOutputStream;
        Throwable th;
        byte[] bArr = null;
        bgu.g("en obj 2 bytes ", new Object[0]);
        if (obj == null || !Serializable.class.isInstance(obj)) {
            bgu.h("not serial obj ", new Object[0]);
        } else {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            try {
                objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
                try {
                    try {
                        objectOutputStream.writeObject(obj);
                        objectOutputStream.flush();
                        bArr = byteArrayOutputStream.toByteArray();
                        try {
                            objectOutputStream.close();
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                        try {
                            byteArrayOutputStream.close();
                        } catch (IOException e2) {
                            e2.printStackTrace();
                        }
                    } catch (Throwable th2) {
                        th = th2;
                        th.printStackTrace();
                        bgu.i(th.getMessage(), new Object[0]);
                        if (objectOutputStream != null) {
                            try {
                                objectOutputStream.close();
                            } catch (IOException e3) {
                                e3.printStackTrace();
                            }
                        }
                        try {
                            byteArrayOutputStream.close();
                        } catch (IOException e4) {
                            e4.printStackTrace();
                        }
                        return bArr;
                    }
                } catch (Throwable th3) {
                    th = th3;
                    if (objectOutputStream != null) {
                        try {
                            objectOutputStream.close();
                        } catch (IOException e5) {
                            e5.printStackTrace();
                        }
                    }
                    try {
                        byteArrayOutputStream.close();
                    } catch (IOException e6) {
                        e6.printStackTrace();
                    }
                    throw th;
                }
            } catch (Throwable th4) {
                th = th4;
                objectOutputStream = null;
            }
        }
        return bArr;
    }

    public static Object U(byte[] bArr) {
        ObjectInputStream objectInputStream;
        Throwable th;
        Object obj = null;
        ObjectInputStream objectInputStream2 = new Object[0];
        bgu.g("de byte 2 obj ", objectInputStream2);
        if (bArr != null && bArr.length >= 0) {
            ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bArr);
            try {
                try {
                    objectInputStream = new ObjectInputStream(byteArrayInputStream);
                    try {
                        obj = objectInputStream.readObject();
                        try {
                            objectInputStream.close();
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                        try {
                            byteArrayInputStream.close();
                            objectInputStream2 = objectInputStream;
                        } catch (IOException e2) {
                            e2.printStackTrace();
                            objectInputStream2 = objectInputStream;
                        }
                    } catch (Throwable th2) {
                        th = th2;
                        th.printStackTrace();
                        bgu.i(th.getMessage(), new Object[0]);
                        if (objectInputStream != null) {
                            try {
                                objectInputStream.close();
                            } catch (IOException e3) {
                                e3.printStackTrace();
                            }
                        }
                        try {
                            byteArrayInputStream.close();
                            objectInputStream2 = objectInputStream;
                        } catch (IOException e4) {
                            e4.printStackTrace();
                            objectInputStream2 = objectInputStream;
                        }
                        return obj;
                    }
                } catch (Throwable th3) {
                    th = th3;
                    if (objectInputStream2 != 0) {
                        try {
                            objectInputStream2.close();
                        } catch (IOException e5) {
                            e5.printStackTrace();
                        }
                    }
                    try {
                        byteArrayInputStream.close();
                    } catch (IOException e6) {
                        e6.printStackTrace();
                    }
                    throw th;
                }
            } catch (Throwable th4) {
                th = th4;
                objectInputStream = null;
            }
        }
        return obj;
    }

    public static b g(String str, String str2, String str3) {
        Socket socket;
        Throwable th;
        InetAddress inetAddress;
        byte[] address;
        int i;
        InputStream inputStream = null;
        if (str == null || str.equals(SQLiteDatabase.KeyEmpty) || str2 == null || str2.equals(SQLiteDatabase.KeyEmpty) || str3 == null || str3.equals(SQLiteDatabase.KeyEmpty)) {
            return null;
        }
        b bVar = new b();
        ?? r3 = "http://";
        ?? r2 = "http://" + str2 + str3;
        try {
            try {
                URL url = new URL(r2);
                long currentTimeMillis = System.currentTimeMillis();
                try {
                    inetAddress = InetAddress.getByName(str2);
                    try {
                        bVar.a = System.currentTimeMillis() - currentTimeMillis;
                    } catch (Exception e) {
                        bVar.a = -1L;
                        bgu.f(" dns: }" + bVar.a, new Object[0]);
                        StringBuffer stringBuffer = new StringBuffer();
                        address = inetAddress.getAddress();
                        while (i < address.length) {
                        }
                        bVar.Rm = stringBuffer.substring(1);
                        stringBuffer.setLength(0);
                        String[] split = str.split(":");
                        InetSocketAddress inetSocketAddress = new InetSocketAddress(split[0], Integer.parseInt(split[1]));
                        long currentTimeMillis2 = System.currentTimeMillis();
                        socket = new Socket();
                        socket.connect(inetSocketAddress, ke.YP);
                        bVar.b = System.currentTimeMillis() - currentTimeMillis2;
                        bgu.f(" conn: " + bVar.b, new Object[0]);
                        String str4 = "HEAD " + (url.getPath() + (url.getQuery() == null ? "?" + url.getQuery() : SQLiteDatabase.KeyEmpty)) + " HTTP/1.1 \r\nHost: " + str2 + "\r\nConnection: close\r\n\r\n";
                        String str5 = "host test: " + str4;
                        r3 = socket.getOutputStream();
                        try {
                            r2 = socket.getInputStream();
                            try {
                                long currentTimeMillis3 = System.currentTimeMillis();
                                r3.write(str4.getBytes("UTF-8"));
                                r3.flush();
                                bVar.c = System.currentTimeMillis() - currentTimeMillis3;
                                bgu.f(" re: " + bVar.c, new Object[0]);
                                long currentTimeMillis4 = System.currentTimeMillis();
                                r2.read();
                                bVar.d = System.currentTimeMillis() - currentTimeMillis4;
                                bgu.f(" wait: " + bVar.d, new Object[0]);
                                long currentTimeMillis5 = System.currentTimeMillis();
                                r2.read(new byte[500]);
                                bVar.e = System.currentTimeMillis() - currentTimeMillis5;
                                bgu.f(" readp: " + bVar.e, new Object[0]);
                                if (r3 != 0) {
                                }
                                if (r2 != 0) {
                                }
                                try {
                                    socket.close();
                                } catch (IOException e2) {
                                    e2.printStackTrace();
                                    r2 = new Object[0];
                                    bgu.i(e2.getMessage(), r2);
                                }
                            } catch (Throwable th2) {
                                th = th2;
                                th.printStackTrace();
                                bgu.i(th.getMessage(), new Object[0]);
                                if (r3 != 0) {
                                    try {
                                        r3.close();
                                    } catch (IOException e3) {
                                        e3.printStackTrace();
                                    }
                                }
                                if (r2 != 0) {
                                    try {
                                        r2.close();
                                    } catch (IOException e4) {
                                        e4.printStackTrace();
                                    }
                                }
                                if (socket != null) {
                                    try {
                                        socket.close();
                                    } catch (IOException e5) {
                                        e5.printStackTrace();
                                        r2 = new Object[0];
                                        bgu.i(e5.getMessage(), r2);
                                    }
                                }
                                return bVar;
                            }
                        } catch (Throwable th3) {
                            r2 = 0;
                            th = th3;
                        }
                        return bVar;
                    }
                } catch (Exception e6) {
                    inetAddress = null;
                }
                bgu.f(" dns: }" + bVar.a, new Object[0]);
                StringBuffer stringBuffer2 = new StringBuffer();
                address = inetAddress.getAddress();
                for (i = 0; i < address.length; i++) {
                    stringBuffer2.append("." + (address[i] < 0 ? address[i] + 256 : address[i]));
                }
                bVar.Rm = stringBuffer2.substring(1);
                stringBuffer2.setLength(0);
                String[] split2 = str.split(":");
                InetSocketAddress inetSocketAddress2 = new InetSocketAddress(split2[0], Integer.parseInt(split2[1]));
                long currentTimeMillis22 = System.currentTimeMillis();
                socket = new Socket();
                try {
                    socket.connect(inetSocketAddress2, ke.YP);
                    bVar.b = System.currentTimeMillis() - currentTimeMillis22;
                    bgu.f(" conn: " + bVar.b, new Object[0]);
                    String str42 = "HEAD " + (url.getPath() + (url.getQuery() == null ? "?" + url.getQuery() : SQLiteDatabase.KeyEmpty)) + " HTTP/1.1 \r\nHost: " + str2 + "\r\nConnection: close\r\n\r\n";
                    String str52 = "host test: " + str42;
                    r3 = socket.getOutputStream();
                    r2 = socket.getInputStream();
                    long currentTimeMillis32 = System.currentTimeMillis();
                    r3.write(str42.getBytes("UTF-8"));
                    r3.flush();
                    bVar.c = System.currentTimeMillis() - currentTimeMillis32;
                    bgu.f(" re: " + bVar.c, new Object[0]);
                    long currentTimeMillis42 = System.currentTimeMillis();
                    r2.read();
                    bVar.d = System.currentTimeMillis() - currentTimeMillis42;
                    bgu.f(" wait: " + bVar.d, new Object[0]);
                    long currentTimeMillis52 = System.currentTimeMillis();
                    r2.read(new byte[500]);
                    bVar.e = System.currentTimeMillis() - currentTimeMillis52;
                    bgu.f(" readp: " + bVar.e, new Object[0]);
                    if (r3 != 0) {
                        try {
                            r3.close();
                        } catch (IOException e7) {
                            e7.printStackTrace();
                        }
                    }
                    if (r2 != 0) {
                        try {
                            r2.close();
                        } catch (IOException e8) {
                            e8.printStackTrace();
                        }
                    }
                    socket.close();
                } catch (Throwable th4) {
                    th = th4;
                    r3 = 0;
                }
            } catch (Throwable th5) {
                th = th5;
                inputStream = r2;
            }
        } catch (Throwable th6) {
            r3 = 0;
            socket = null;
            r2 = 0;
            th = th6;
        }
        return bVar;
    }

    public static byte[] a(byte[] bArr, int i, String str) {
        if (bArr != null && i != -1) {
            bgu.g("enD:} %d %d", Integer.valueOf(bArr.length), Integer.valueOf(i));
            try {
                return com.tencent.beacon.a.g.c(i, str, bArr);
            } catch (Throwable th) {
                th.printStackTrace();
                bgu.i("err enD: %s", th.toString());
                return null;
            }
        }
        return bArr;
    }

    public static byte[] b(byte[] bArr, int i, String str) {
        if (bArr != null && i != -1) {
            try {
                return com.tencent.beacon.a.g.b(i, str, bArr);
            } catch (Throwable th) {
                th.printStackTrace();
                bgu.i("err unD: %s", th.toString());
                return null;
            }
        }
        return bArr;
    }

    public static byte[] a_(byte[] bArr, int i) {
        if (bArr != null && i != -1) {
            bgu.g("zp: %s len: %s", Integer.valueOf(i), Integer.valueOf(bArr.length));
            try {
                return com.tencent.beacon.a.g.g(i, bArr);
            } catch (Throwable th) {
                th.printStackTrace();
                bgu.i("err zp : %s", th.toString());
                return null;
            }
        }
        return bArr;
    }

    public static byte[] d(byte[] bArr, int i) {
        if (bArr != null && i != -1) {
            bgu.g("unzp: %s len: %s", Integer.valueOf(i), Integer.valueOf(bArr.length));
            try {
                return com.tencent.beacon.a.g.h(i, bArr);
            } catch (Throwable th) {
                th.printStackTrace();
                bgu.i("err unzp}" + th.toString(), new Object[0]);
                return null;
            }
        }
        return bArr;
    }

    public static b ao(String str, String str2) {
        URL url;
        InetSocketAddress inetSocketAddress;
        String defaultHost;
        int defaultPort;
        a aVar;
        if (str == null || str.equals(SQLiteDatabase.KeyEmpty)) {
            return null;
        }
        b bVar = new b();
        HttpURLConnection httpURLConnection = null;
        InputStream inputStream = null;
        OutputStream outputStream = null;
        try {
            try {
                url = new URL(str);
                inetSocketAddress = null;
                defaultHost = Proxy.getDefaultHost();
                defaultPort = Proxy.getDefaultPort();
            } catch (Throwable th) {
                th.printStackTrace();
                bgu.i(th.getMessage(), new Object[0]);
                if (outputStream != null) {
                    try {
                        outputStream.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
                if (inputStream != null) {
                    try {
                        inputStream.close();
                    } catch (IOException e2) {
                        e2.printStackTrace();
                    }
                }
                if (httpURLConnection != null) {
                    httpURLConnection.disconnect();
                }
            }
            if (defaultHost == null || defaultHost.trim().length() == 0 || defaultPort <= 0) {
                bgu.f(" no default proxy!", new Object[0]);
                if (str2 == null || str2.trim().length() <= 0) {
                    aVar = null;
                } else {
                    aVar = new a();
                    String lowerCase = str2.toLowerCase();
                    if (lowerCase.contains(tmsdk.common.internal.utils.y.cud)) {
                        bgu.f(" search ctwap", new Object[0]);
                        aVar.a = "10.0.0.200";
                        aVar.b = 80;
                    } else if (lowerCase.contains(tmsdk.common.internal.utils.y.ctX)) {
                        bgu.f(" search cmwap", new Object[0]);
                        aVar.a = "10.0.0.172";
                        aVar.b = 80;
                    } else if (lowerCase.contains(tmsdk.common.internal.utils.y.cub)) {
                        bgu.f(" search uniwap", new Object[0]);
                        aVar.a = "10.0.0.172";
                        aVar.b = 80;
                    }
                }
                if (aVar == null) {
                    inetSocketAddress = null;
                    httpURLConnection = inetSocketAddress != null ? (HttpURLConnection) url.openConnection() : (HttpURLConnection) url.openConnection(new java.net.Proxy(Proxy.Type.HTTP, inetSocketAddress));
                    httpURLConnection.setDoInput(true);
                    httpURLConnection.setDoOutput(true);
                    httpURLConnection.setConnectTimeout(ke.YP);
                    httpURLConnection.setReadTimeout(ke.YP);
                    long currentTimeMillis = System.currentTimeMillis();
                    httpURLConnection.connect();
                    long currentTimeMillis2 = System.currentTimeMillis();
                    outputStream = httpURLConnection.getOutputStream();
                    long currentTimeMillis3 = System.currentTimeMillis();
                    inputStream = httpURLConnection.getInputStream();
                    long currentTimeMillis4 = System.currentTimeMillis();
                    do {
                    } while (inputStream.read() != -1);
                    long currentTimeMillis5 = System.currentTimeMillis();
                    bVar.a = -1L;
                    bVar.Rm = SQLiteDatabase.KeyEmpty;
                    bVar.b = currentTimeMillis2 - currentTimeMillis;
                    bVar.c = currentTimeMillis3 - currentTimeMillis2;
                    bVar.d = currentTimeMillis4 - currentTimeMillis3;
                    bVar.e = currentTimeMillis5 - currentTimeMillis4;
                    bgu.f(" dns:" + bVar.a, new Object[0]);
                    bgu.f(" connetionElapse:" + bVar.b, new Object[0]);
                    bgu.f(" requestElapse:" + bVar.c, new Object[0]);
                    bgu.f(" waitElapse:" + bVar.d, new Object[0]);
                    bgu.f(" readResponeElapse:" + bVar.e, new Object[0]);
                    if (outputStream != null) {
                        try {
                            outputStream.close();
                        } catch (IOException e3) {
                            e3.printStackTrace();
                        }
                    }
                    if (inputStream != null) {
                        try {
                            inputStream.close();
                        } catch (IOException e4) {
                            e4.printStackTrace();
                        }
                    }
                    if (httpURLConnection != null) {
                        httpURLConnection.disconnect();
                    }
                    return bVar;
                }
                defaultHost = aVar.a;
                defaultPort = aVar.b;
            }
            if (defaultHost != null && defaultHost.trim().length() > 0) {
                inetSocketAddress = new InetSocketAddress(defaultHost, defaultPort);
                bgu.f(" apn }" + str2 + "  find proxy [}" + defaultHost + ":" + defaultPort + "]", new Object[0]);
            }
            if (inetSocketAddress != null) {
            }
            httpURLConnection.setDoInput(true);
            httpURLConnection.setDoOutput(true);
            httpURLConnection.setConnectTimeout(ke.YP);
            httpURLConnection.setReadTimeout(ke.YP);
            long currentTimeMillis6 = System.currentTimeMillis();
            httpURLConnection.connect();
            long currentTimeMillis22 = System.currentTimeMillis();
            outputStream = httpURLConnection.getOutputStream();
            long currentTimeMillis32 = System.currentTimeMillis();
            inputStream = httpURLConnection.getInputStream();
            long currentTimeMillis42 = System.currentTimeMillis();
            do {
            } while (inputStream.read() != -1);
            long currentTimeMillis52 = System.currentTimeMillis();
            bVar.a = -1L;
            bVar.Rm = SQLiteDatabase.KeyEmpty;
            bVar.b = currentTimeMillis22 - currentTimeMillis6;
            bVar.c = currentTimeMillis32 - currentTimeMillis22;
            bVar.d = currentTimeMillis42 - currentTimeMillis32;
            bVar.e = currentTimeMillis52 - currentTimeMillis42;
            bgu.f(" dns:" + bVar.a, new Object[0]);
            bgu.f(" connetionElapse:" + bVar.b, new Object[0]);
            bgu.f(" requestElapse:" + bVar.c, new Object[0]);
            bgu.f(" waitElapse:" + bVar.d, new Object[0]);
            bgu.f(" readResponeElapse:" + bVar.e, new Object[0]);
            if (outputStream != null) {
            }
            if (inputStream != null) {
            }
            if (httpURLConnection != null) {
            }
            return bVar;
        } finally {
        }
    }

    public static bge a(int i, com.tencent.beacon.a.e eVar, byte[] bArr, int i2, int i3) {
        bgu.g("en2Req", new Object[0]);
        if (eVar == null) {
            bgu.i("error no com info! ", new Object[0]);
            return null;
        }
        try {
            bge bgeVar = new bge();
            synchronized (eVar) {
                bgeVar.cpu = eVar.a();
                bgeVar.ahd = eVar.b();
                bgeVar.cvc = eVar.Ib();
                bgeVar.OT = eVar.KB();
                bgeVar.Rb = eVar.db();
                bgeVar.Rc = eVar.dZ();
                bgeVar.Ri = eVar.lW();
                bgeVar.l = SQLiteDatabase.KeyEmpty;
                if (i == 100) {
                    HashMap hashMap = new HashMap();
                    hashMap.put("A1", bgx.Lk());
                    hashMap.put("A2", eVar.ed());
                    bhb de = bhb.de(eVar.KX());
                    hashMap.put("A4", de.bx());
                    hashMap.put("A6", de.b());
                    hashMap.put("A7", de.db());
                    StringBuilder sb = new StringBuilder();
                    Context KX = eVar.KX();
                    if (eNe == null) {
                        eNe = new bfy(KX);
                    }
                    hashMap.put("A3", sb.append(eNe.a()).toString());
                    hashMap.put("A23", de.dZ());
                    com.tencent.beacon.a.g.cL(eVar.KX());
                    hashMap.put("A33", com.tencent.beacon.a.g.cP(eVar.KX()));
                    if (com.tencent.beacon.a.a.bs(eVar.KX())) {
                        hashMap.put("A66", "F");
                    } else {
                        hashMap.put("A66", "B");
                    }
                    hashMap.put("A67", com.tencent.beacon.a.a.K(eVar.KX()));
                    hashMap.put("A68", new StringBuilder().append(com.tencent.beacon.a.a.cH(eVar.KX())).toString());
                    bgeVar.l = com.tencent.beacon.a.g.j(hashMap);
                }
            }
            bgeVar.f = i;
            bgeVar.eNk = (byte) i3;
            bgeVar.dfL = (byte) i2;
            if (bArr == null) {
                bArr = SQLiteDatabase.KeyEmpty.getBytes();
            }
            bgeVar.eNj = bArr;
            return bgeVar;
        } catch (Throwable th) {
            th.printStackTrace();
            return null;
        }
    }

    public static byte[] a(byte[] bArr, int i, int i2, String str) {
        if (bArr == null) {
            return null;
        }
        try {
            return a(a_(bArr, i), i2, str);
        } catch (Throwable th) {
            th.printStackTrace();
            return null;
        }
    }

    public static byte[] b(byte[] bArr, int i, int i2, String str) {
        try {
            return d(b(bArr, i2, str), i);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public static long kl() {
        try {
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
            return simpleDateFormat.parse(simpleDateFormat.format(new Date())).getTime();
        } catch (Throwable th) {
            th.printStackTrace();
            return -1L;
        }
    }

    public static String ir() {
        try {
            return new SimpleDateFormat("yyyy-MM-dd", Locale.US).format(new Date());
        } catch (Throwable th) {
            th.printStackTrace();
            return SQLiteDatabase.KeyEmpty;
        }
    }

    public static String aa(String str) {
        try {
            RandomAccessFile randomAccessFile = new RandomAccessFile(str, "r");
            String readLine = randomAccessFile.readLine();
            if (readLine != null) {
                randomAccessFile.close();
                return readLine;
            }
        } catch (Exception e) {
        }
        return null;
    }

    public static ArrayList<String> l(String[] strArr) {
        BufferedReader bufferedReader;
        BufferedReader bufferedReader2;
        BufferedReader bufferedReader3 = null;
        ArrayList<String> arrayList = new ArrayList<>();
        try {
            Process exec = Runtime.getRuntime().exec(strArr);
            bufferedReader2 = new BufferedReader(new InputStreamReader(exec.getInputStream()));
            while (true) {
                try {
                    String readLine = bufferedReader2.readLine();
                    if (readLine == null) {
                        break;
                    }
                    arrayList.add(readLine);
                } catch (Throwable th) {
                    th = th;
                    bufferedReader = null;
                }
            }
            bufferedReader = new BufferedReader(new InputStreamReader(exec.getErrorStream()));
            while (true) {
                try {
                    try {
                        String readLine2 = bufferedReader.readLine();
                        if (readLine2 != null) {
                            arrayList.add(readLine2);
                        } else {
                            try {
                                break;
                            } catch (IOException e) {
                                e.printStackTrace();
                            }
                        }
                    } catch (Throwable th2) {
                        th = th2;
                        th.printStackTrace();
                        if (bufferedReader2 != null) {
                            try {
                                bufferedReader2.close();
                            } catch (IOException e2) {
                                e2.printStackTrace();
                            }
                        }
                        if (bufferedReader != null) {
                            try {
                                bufferedReader.close();
                            } catch (IOException e3) {
                                e3.printStackTrace();
                            }
                        }
                        return null;
                    }
                } catch (Throwable th3) {
                    th = th3;
                    bufferedReader3 = bufferedReader;
                    if (bufferedReader2 != null) {
                        try {
                            bufferedReader2.close();
                        } catch (IOException e4) {
                            e4.printStackTrace();
                        }
                    }
                    if (bufferedReader3 != null) {
                        try {
                            bufferedReader3.close();
                        } catch (IOException e5) {
                            e5.printStackTrace();
                        }
                    }
                    throw th;
                }
            }
            bufferedReader2.close();
            try {
                bufferedReader.close();
                return arrayList;
            } catch (IOException e6) {
                e6.printStackTrace();
                return arrayList;
            }
        } catch (Throwable th4) {
            th = th4;
            bufferedReader = null;
            bufferedReader2 = null;
        }
    }

    public static String hn(String str) {
        try {
            byte[] digest = MessageDigest.getInstance("MD5").digest(str.getBytes());
            StringBuffer stringBuffer = new StringBuffer();
            for (byte b2 : digest) {
                int i = b2 & 255;
                if (i < 16) {
                    stringBuffer.append(0);
                }
                stringBuffer.append(Integer.toHexString(i));
            }
            return stringBuffer.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return str;
        }
    }

    public static String ho(String str) {
        String hn = hn(str);
        if (hn != null) {
            try {
                return hn.substring(8, 24);
            } catch (Exception e) {
                return hn;
            }
        }
        return hn;
    }

    public static String V(Context context, int i) {
        try {
            bhb de = bhb.de(context);
            return ho(de.a() + "_" + de.b() + "_" + new Date().getTime() + "_" + i);
        } catch (Exception e) {
            return null;
        }
    }

    public static HashSet<String> Z(ArrayList<String> arrayList) {
        int size = arrayList.size();
        if (arrayList == null || size <= 0) {
            return null;
        }
        HashSet<String> hashSet = new HashSet<>(size);
        Iterator<String> it = arrayList.iterator();
        while (it.hasNext()) {
            hashSet.add(it.next());
        }
        return hashSet;
    }
}