安全中心 v4.9.2版本的 MD5 值为:d64c0ec7920c532fa6e6d9bb001cf9bf

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


package tcs;

import com.tencent.kingkong.database.SQLiteDatabase;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import tmsdk.common.TMSDKContext;

public class pc {
    public static final String ckA = "/system/etc/hosts";
    public static final int ckB = 1;
    public static final int ckC = 3;
    public static final int ckD = 4097;
    public static final int ckE = 4098;
    public static final int ckG = 1;
    public static final int ckH = 0;
    public static final int ckI = -1;
    private static final String[] ckJ = {"pmir.3g.qq.com", "uploadserver.3g.qq.com"};

    private static class a {
        public String ckK;
        public String ckL;
        public String ckM;

        public a(String str, String str2, String str3) {
            this.ckK = str;
            this.ckL = str2;
            this.ckM = str3;
        }

        public String toString() {
            return "\n" + this.ckK + " " + this.ckL + "->" + this.ckM;
        }
    }

    public static List<bhl> a(qa qaVar) {
        ArrayList arrayList = new ArrayList();
        ArrayList arrayList2 = new ArrayList();
        Map<String, String> Bs = Bs();
        LinkedHashMap linkedHashMap = new LinkedHashMap(Bs);
        int size = Bs.size();
        for (String str : ckJ) {
            b(Bs, str.toLowerCase(), arrayList2);
        }
        if (qaVar != null && qaVar.ig != null) {
            Iterator<pz> it = qaVar.ig.iterator();
            while (it.hasNext()) {
                pz next = it.next();
                if (Integer.parseInt(next.ib) == 3) {
                    a(Bs, next.ic.toLowerCase(), arrayList2);
                }
            }
            Iterator<pz> it2 = qaVar.ig.iterator();
            while (it2.hasNext()) {
                pz next2 = it2.next();
                if (Integer.parseInt(next2.ib) == 1) {
                    arrayList.addAll(b(Bs, next2.ic.toLowerCase()));
                }
            }
        }
        if (Bs.size() < size) {
            e(Bs);
            arrayList.addAll(a(arrayList2, linkedHashMap));
        }
        return arrayList;
    }

    public static List<bhl> a(List<String> list, Map<String, String> map) {
        ArrayList arrayList = new ArrayList();
        Map<String, String> Bs = Bs();
        int currentTimeMillis = (int) (System.currentTimeMillis() / 1000);
        for (String str : list) {
            if (Bs.keySet().contains(str)) {
                arrayList.add(new bhl(str, map.get(str), currentTimeMillis, -1));
            } else {
                arrayList.add(new bhl(str, map.get(str), currentTimeMillis, 0));
            }
        }
        return arrayList;
    }

    public static List<a> d(Map<String, String> map) {
        ArrayList arrayList = new ArrayList();
        Map<String, String> Bs = Bs();
        for (Map.Entry<String, String> entry : map.entrySet()) {
            String lowerCase = entry.getKey().toLowerCase();
            String value = entry.getValue();
            String str = Bs.get(lowerCase);
            if (str != null && !str.equals(value)) {
                arrayList.add(new a(lowerCase, value, str));
            }
        }
        return arrayList;
    }

    public static void a(Map<String, String> map, String str, List<String> list) {
        for (String str2 : new HashSet(map.keySet())) {
            try {
                if (str2.matches(str)) {
                    map.remove(str2);
                    list.add(str2);
                }
            } catch (Exception e) {
            }
        }
    }

    public static List<bhl> b(Map<String, String> map, String str) {
        ArrayList arrayList = new ArrayList();
        int currentTimeMillis = (int) (System.currentTimeMillis() / 1000);
        for (Map.Entry<String, String> entry : map.entrySet()) {
            try {
                String key = entry.getKey();
                if (key.matches(str)) {
                    arrayList.add(new bhl(key, entry.getValue(), currentTimeMillis, 1));
                }
            } catch (Exception e) {
            }
        }
        return arrayList;
    }

    public static void b(Map<String, String> map, String str, List<String> list) {
        for (String str2 : new HashSet(map.keySet())) {
            if (str2.contains(str)) {
                map.remove(str2);
                list.add(str2);
            }
        }
    }

    public static Map<String, String> Bs() {
        BufferedReader bufferedReader;
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        File file = new File(ckA);
        if (!file.exists()) {
            return linkedHashMap;
        }
        ((qq) bgm.nL(11)).T(-1, "chmod 755 /system/etc/hosts");
        BufferedReader bufferedReader2 = null;
        try {
            bufferedReader = new BufferedReader(new FileReader(file));
            while (true) {
                try {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    }
                    String trim = readLine.trim();
                    if (!SQLiteDatabase.KeyEmpty.equals(trim) && !trim.startsWith("#")) {
                        int indexOf = trim.indexOf("#");
                        if (indexOf > 0) {
                            trim = trim.substring(0, indexOf).trim();
                        }
                        String[] split = trim.toLowerCase().split("\\s+");
                        if (split.length == 2 || split.length == 3) {
                            linkedHashMap.put(split[1], split[0]);
                        }
                    }
                } catch (Exception e) {
                    if (bufferedReader != null) {
                        try {
                            bufferedReader.close();
                        } catch (Exception e2) {
                        }
                    }
                    return linkedHashMap;
                } catch (Throwable th) {
                    bufferedReader2 = bufferedReader;
                    th = th;
                    if (bufferedReader2 != null) {
                        try {
                            bufferedReader2.close();
                        } catch (Exception e3) {
                        }
                    }
                    throw th;
                }
            }
            if (bufferedReader != null) {
                try {
                    bufferedReader.close();
                } catch (Exception e4) {
                }
            }
        } catch (Exception e5) {
            bufferedReader = null;
        } catch (Throwable th2) {
            th = th2;
        }
        return linkedHashMap;
    }

    public static void e(Map<String, String> map) {
        File file = new File(TMSDKContext.getApplicaionContext().getFilesDir(), "temp_hosts");
        file.delete();
        for (Map.Entry<String, String> entry : map.entrySet()) {
            d(file, entry.getValue() + " " + entry.getKey() + "\n");
        }
        y(file);
        file.delete();
    }

    private static void d(File file, String str) {
        FileOutputStream fileOutputStream;
        FileOutputStream fileOutputStream2 = null;
        try {
            fileOutputStream = new FileOutputStream(file, true);
            try {
                fileOutputStream.write(str.getBytes());
                if (fileOutputStream != null) {
                    try {
                        fileOutputStream.close();
                    } catch (IOException e) {
                    }
                }
            } catch (Exception e2) {
                if (fileOutputStream != null) {
                    try {
                        fileOutputStream.close();
                    } catch (IOException e3) {
                    }
                }
            } catch (Throwable th) {
                fileOutputStream2 = fileOutputStream;
                th = th;
                if (fileOutputStream2 != null) {
                    try {
                        fileOutputStream2.close();
                    } catch (IOException e4) {
                    }
                }
                throw th;
            }
        } catch (Exception e5) {
            fileOutputStream = null;
        } catch (Throwable th2) {
            th = th2;
        }
    }

    private static void y(File file) {
        qq qqVar = (qq) bgm.nL(11);
        ArrayList arrayList = new ArrayList();
        arrayList.add("mount -o remount rw /system\n");
        arrayList.add("rm /system/etc/hosts\n");
        arrayList.add("cat " + file.getAbsolutePath() + " > " + ckA + "\n");
        qqVar.g(-1, arrayList);
    }

    public static qa b(qa qaVar) {
        boolean z;
        String lowerCase;
        boolean z2;
        try {
            ArrayList arrayList = new ArrayList();
            Map<String, String> Bs = Bs();
            boolean z3 = false;
            if (qaVar != null && qaVar.ig != null) {
                Iterator<pz> it = qaVar.ig.iterator();
                while (it.hasNext()) {
                    pz next = it.next();
                    if (Integer.parseInt(next.ib) == 4098) {
                        a(Bs, next.ic.toLowerCase(), arrayList);
                        if (!z3) {
                            z2 = true;
                            z3 = z2;
                        }
                    }
                    z2 = z3;
                    z3 = z2;
                }
                Iterator<pz> it2 = qaVar.ig.iterator();
                while (it2.hasNext()) {
                    pz next2 = it2.next();
                    if (Integer.parseInt(next2.ib) == 4097 && (lowerCase = next2.ic.toLowerCase()) != null && lowerCase.length() > 0) {
                        String lowerCase2 = next2.ie.toLowerCase();
                        if (lowerCase2 == null || lowerCase2.length() == 0) {
                            lowerCase2 = "127.0.0.1";
                            next2.ie = "127.0.0.1";
                        }
                        Bs.put(lowerCase, lowerCase2);
                        if (!z3) {
                            z = true;
                            z3 = z;
                        }
                    }
                    z = z3;
                    z3 = z;
                }
            }
            if (z3) {
                e(Bs);
                Map<String, String> Bs2 = Bs();
                Iterator<pz> it3 = qaVar.ig.iterator();
                while (it3.hasNext()) {
                    pz next3 = it3.next();
                    if (Integer.parseInt(next3.ib) == 4098) {
                        String lowerCase3 = next3.ic.toLowerCase();
                        Iterator<String> it4 = Bs2.keySet().iterator();
                        while (it4.hasNext()) {
                            try {
                                if (it4.next().matches(lowerCase3)) {
                                    next3.f43if = "-1";
                                } else {
                                    next3.f43if = "0";
                                }
                            } catch (Exception e) {
                            }
                        }
                    }
                }
                Iterator<pz> it5 = qaVar.ig.iterator();
                while (it5.hasNext()) {
                    pz next4 = it5.next();
                    if (Integer.parseInt(next4.ib) == 4097) {
                        if (Bs2.keySet().contains(next4.ic.toLowerCase())) {
                            next4.f43if = "0";
                        } else {
                            next4.f43if = "-1";
                        }
                    }
                }
            }
        } catch (Exception e2) {
        }
        return qaVar;
    }
}