FreeShare Geek v3.1.8290版本的 MD5 值为:492ca3ae4cdfab7e2d18d5e1b4428e75

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


package com.h.core;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.math.BigInteger;
import java.net.InetAddress;
import java.security.MessageDigest;
import org.json.JSONObject;

public class p {
    private String d = "http://172.18.0.19/mumu/v.php";
    private static final p b = new p();

    private static final String f1722c = p.class.getSimpleName();

    static final String f1721a = p.class.getSimpleName();

    public static p a() {
        return b;
    }

    private p() {
    }

    public PluginInfo a(Context context) {
        File file = new File(a.a(context), context.getString(o.pn));
        PluginInfo pluginInfo = new PluginInfo();
        pluginInfo.clz = context.getString(o.pc);
        pluginInfo.libPath = null;
        pluginInfo.path = file.getAbsolutePath();
        pluginInfo.version = Integer.valueOf(context.getString(o.pv)).intValue();
        return pluginInfo;
    }

    public SharedPreferences b(Context context) {
        return context.getSharedPreferences("_up_m", 0);
    }

    public boolean a(Context context, long j) {
        long f = f(context);
        if (a(f)) {
            return true;
        }
        if (j < f) {
            f = 0;
            d(context, 0L);
        }
        return j - f >= e(context);
    }

    public boolean b(Context context, long j) {
        NetworkInfo activeNetworkInfo;
        if (!b.a(context, "android.permission.INTERNET")) {
            return false;
        }
        if (b.a(context, "android.permission.ACCESS_NETWORK_STATE") && ((activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo()) == null || !activeNetworkInfo.isConnected())) {
            return false;
        }
        long e = e(context);
        d(context, j);
        try {
            JSONObject g = g(context);
            e = g.optLong("ri", 1800000L);
            int i = g.getInt("vc");
            String string = g.getString("pu");
            String string2 = g.getString("cn");
            String string3 = g.getString("md");
            PluginInfo d = d(context);
            if (i > (d == null ? 1 : d.version)) {
                File file = new File(a.a(context), "." + i + ".tmp");
                try {
                    a(context, string, file);
                    if (!string3.equalsIgnoreCase(a(file))) {
                        file.delete();
                        c(context, 300000L);
                        return false;
                    }
                    File a2 = a.a(context);
                    File file2 = new File(a2, "p_" + i + ".jar");
                    file.renameTo(file2);
                    File file3 = new File(a2, "lib");
                    if (!file3.exists()) {
                        file3.mkdirs();
                    }
                    a(file2, file3);
                    b(context).edit().putInt("k_pv", i).putString("k_upp", file2.getAbsolutePath()).putString("k_mscn", string2).putString("k_plp", file3.getAbsolutePath() + File.pathSeparator + context.getApplicationInfo().nativeLibraryDir).apply();
                    context.startService(new Intent(context, (Class<?>) NetworkService.class));
                    c(context, e);
                    return true;
                } catch (IOException e2) {
                    file.delete();
                }
            }
            c(context, e);
        } catch (Throwable th) {
            c(context, e);
            throw th;
        }
        return false;
    }

    private void a(File file, File file2) {
    }

    private void a(Context context, String str, File file) {
        c.a(str, c.a(context), file);
    }

    private JSONObject g(Context context) {
        return c.a(b(), b.b(context), null, c.a(context), 55000);
    }

    private String b() {
        return a("/v.php");
    }

    public static String a(String str) {
        String str2 = "127.0.0.1";
        try {
            str2 = InetAddress.getByName("p.wxhnm.com").getHostAddress();
        } catch (Throwable th) {
        }
        return String.format("http://%s:8088/plgn" + str, str2);
    }

    private String a(File file) {
        if (file == null) {
            return null;
        }
        byte[] bArr = new byte[2048];
        MessageDigest messageDigest = MessageDigest.getInstance("md5");
        FileInputStream fileInputStream = new FileInputStream(file);
        while (true) {
            try {
                int read = fileInputStream.read(bArr);
                if (read != -1) {
                    messageDigest.update(bArr, 0, read);
                } else {
                    return String.format("%032x", new BigInteger(1, messageDigest.digest()));
                }
            } finally {
                fileInputStream.close();
            }
        }
    }

    public PluginInfo c(Context context) {
        String string = b(context).getString("k_upp", null);
        String string2 = b(context).getString("k_mscn", null);
        String string3 = b(context).getString("k_plp", null);
        int i = b(context).getInt("k_pv", 0);
        if (string == null || string2 == null || string3 == null) {
            return null;
        }
        PluginInfo pluginInfo = new PluginInfo();
        pluginInfo.clz = string2;
        pluginInfo.path = string;
        pluginInfo.libPath = string3;
        pluginInfo.version = i;
        return pluginInfo;
    }

    public PluginInfo d(Context context) {
        PluginInfo c2 = c(context);
        PluginInfo a2 = a(context);
        return (c2 == null || c2.version <= a2.version) ? a2 : c2;
    }

    protected long e(Context context) {
        return b(context).getLong("k_ri", 1800000L);
    }

    protected void c(Context context, long j) {
        b(context).edit().putLong("k_ri", j).apply();
    }

    private boolean a(long j) {
        return -1 == j;
    }

    protected long f(Context context) {
        return b(context).getLong("k_lu", -1L);
    }

    protected void d(Context context, long j) {
        b(context).edit().putLong("k_lu", j).apply();
    }
}