手机管家 v6.0.0版本的 MD5 值为:bf0bca2cb03f766137fe9ecf7383a634
以下内容为反编译后的 aip.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 aip {
public static final String cVU = "/system/etc/hosts";
public static final int cVV = 1;
public static final int cVW = 3;
public static final int cVX = 4097;
public static final int cVY = 4098;
public static final int cVZ = 1;
public static final int cWa = 0;
public static final int cWb = -1;
private static final String[] cWc = {"pmir.3g.qq.com", "uploadserver.3g.qq.com"};
private static class a {
public String cWd;
public String cyZ;
public String sY;
public a(String str, String str2, String str3) {
this.cyZ = str;
this.sY = str2;
this.cWd = str3;
}
public String toString() {
return "\n" + this.cyZ + " " + this.sY + "->" + this.cWd;
}
}
public static List<ait> a(qa qaVar) {
ArrayList arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
Map<String, String> Xq = Xq();
LinkedHashMap linkedHashMap = new LinkedHashMap(Xq);
int size = Xq.size();
for (String str : cWc) {
b(Xq, 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(Xq, 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(Xq, next2.ic.toLowerCase()));
}
}
}
if (Xq.size() < size) {
f(Xq);
arrayList.addAll(a(arrayList2, linkedHashMap));
}
return arrayList;
}
public static List<ait> a(List<String> list, Map<String, String> map) {
ArrayList arrayList = new ArrayList();
Map<String, String> Xq = Xq();
int currentTimeMillis = (int) (System.currentTimeMillis() / 1000);
for (String str : list) {
if (Xq.keySet().contains(str)) {
arrayList.add(new ait(str, map.get(str), currentTimeMillis, -1));
} else {
arrayList.add(new ait(str, map.get(str), currentTimeMillis, 0));
}
}
return arrayList;
}
public static List<a> e(Map<String, String> map) {
ArrayList arrayList = new ArrayList();
Map<String, String> Xq = Xq();
for (Map.Entry<String, String> entry : map.entrySet()) {
String lowerCase = entry.getKey().toLowerCase();
String value = entry.getValue();
String str = Xq.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<ait> 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 ait(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> Xq() {
BufferedReader bufferedReader;
LinkedHashMap linkedHashMap = new LinkedHashMap();
File file = new File(cVU);
if (file.exists()) {
ue.b(-1, null, "chmod 755 /system/etc/hosts");
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) {
th = th;
if (bufferedReader != null) {
try {
bufferedReader.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;
bufferedReader = null;
}
}
return linkedHashMap;
}
public static void f(Map<String, String> map) {
File file = new File(TMSDKContext.getApplicaionContext().getFilesDir(), "temp_hosts");
file.delete();
for (Map.Entry<String, String> entry : map.entrySet()) {
b(file, entry.getValue() + " " + entry.getKey() + "\n");
}
w(file);
file.delete();
}
private static void b(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 w(File file) {
ArrayList arrayList = new ArrayList();
arrayList.add("mount -o remount rw /system\n");
arrayList.add("rm /system/etc/hosts\n");
arrayList.add(azo.eeI + file.getAbsolutePath() + " > " + cVU + "\n");
ue.g(-1, arrayList);
}
public static qa b(qa qaVar) {
boolean z;
String lowerCase;
boolean z2;
try {
ArrayList arrayList = new ArrayList();
Map<String, String> Xq = Xq();
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(Xq, 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";
}
Xq.put(lowerCase, lowerCase2);
if (!z3) {
z = true;
z3 = z;
}
}
z = z3;
z3 = z;
}
}
if (z3) {
f(Xq);
Map<String, String> Xq2 = Xq();
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 = Xq2.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 (Xq2.keySet().contains(next4.ic.toLowerCase())) {
next4.f43if = "0";
} else {
next4.f43if = "-1";
}
}
}
}
} catch (Exception e2) {
}
return qaVar;
}
}