博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
replace java.lang.String.equals by Xbootclasspath
阅读量:6367 次
发布时间:2019-06-23

本文共 4056 字,大约阅读时间需要 13 分钟。

env:

os:ubuntu 16.04 x64
openjdk8u

//java.lang.Stringpackage java.lang;import java.lang.StringDebugHelper;//...public final class String{final char value[];//remove private    public boolean equals(Object anObject) {        if (this == anObject) {            return true;        }        if (anObject instanceof String) {         // {replace begin            String anotherString = (String)anObject;            if(StringDebugHelper.Equals.isInAttention(this) || StringDebugHelper.Equals.isInAttention(anotherString)){                //new Throwable().getStackTrace();//not crash                //System.out.println("xxxxx");//not crash                new Throwable("attention:"+this).printStackTrace();            }            //Thread.currentThread().getStackTrace();//crash            //new Throwable().getStackTrace();//crash            //new Exception("uuuuuuuuuu");//crash            //new String("dddxx");//not crash            //System.out.println("xxxxx");//crash            int n = value.length;            return StringDebugHelper.Equals.equals(this.value, anotherString.value);        //replace end}        }        return false;    }}
package java.lang;//import java.util.Set;public class StringDebugHelper{    public static class Equals{        public static String[] attention;                        public static boolean isInAttention(final String str){            if(attention==null) return false;            for(int i = 0; i < attention.length; i++){                if(null != attention[i] && StringDebugHelper.Equals.equals(attention[i].value, str.value))                    return true;            }            return false;        }        public static boolean equals(final char [] thiz,final char [] anotherString) {            int n = thiz.length;            if (n == anotherString.length) {                char v1[] = thiz;                char v2[] = anotherString;                int i = 0;                while (n-- != 0) {                    if (v1[i] != v2[i])                        return false;                    i++;                }                return true;            }            return false;        }        }}
import java.util.HashSet;import java.util.Set;public class StringDebugHelperTest{    public static void main(String[] args){                // to this before boot app {        String[] st = new String[5];        st[0] = "java";        st[1] =  "tsogvilin";        StringDebugHelper.Equals.attention = st;                // }                // app content:        //"java".equals(new String("java"));        "tsogvilin".equals(new String("tsogvilin"));            }}
#compilejavac -sourcepath main/src/ -d main/classes/ main/src/*.java  javac -Xbootclasspath/p:main/classes -d test/classes/ test/src/*.java  #runjava -Xbootclasspath/p:main/classes -cp test/classes T   java -Xbootclasspath/p:main/classes -cp test/classes StringDebugHelperTest

real exmaple :apktool:

#replace javac cmd:mv /usr/lib/jvm/java-8-openjdk-amd64/bin/javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac.realcat  /usr/lib/jvm/java-8-openjdk-amd64/bin/javac#!/bin/sh/usr/lib/jvm/java-8-openjdk-amd64/bin/javac.real -Xbootclasspath/p:/home/z/hg_openjdk_java_net/jdk8u_jdk8u/str.eq.dbg/main/classes/ "$@"
Apktool/build.gradle:    tasks.withType(JavaCompile) {        options.compilerArgs += ["-Xlint:-options"]        // add this:        options.bootClasspath = "/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar:/home/z/hg_openjdk_java_net/jdk8u_jdk8u/str.eq.dbg/main/classes/"  //add this    }
//Apktool/brut.apktool/apktool-cli/src/main/java/brut/apktool/Main.java:        // to this before boot app {        String[] st = new String[1];        st[0] = "resources.arsc";        //st[1] =  "tsogvilin";        StringDebugHelper.Equals.attention = st;        System.out.println("rrrrrrrrrrrrrrrrrr");                // }
java -Xbootclasspath/p:main/classes -cp /home/z/a/Apktool/brut.apktool/apktool-cli/build/libs/apktool-cli-all.jar  -Duser.language=en -Dfile.encoding=UTF8  brut.apktool.Main d  ~/a/game.v182815.apk -o ~/a/myoutdir

图片描述

转载地址:http://cirma.baihongyu.com/

你可能感兴趣的文章
swift - 网络请求数据处理 - 协议处理
查看>>
[BZOJ1588]营业额统计(Splay)
查看>>
[BZOJ 4869][SHOI&SXOI2017]相逢是问候(扩展欧拉定理+线段树)
查看>>
2017-08-13
查看>>
条件语句优化面面观
查看>>
集成友盟微信登录没有回调
查看>>
在CentOS Linux系统上,添加新的端口,启用ssh服务
查看>>
dbcp数据库连接池简单使用
查看>>
leetcode-38-Count and Say
查看>>
从零开始写一个node爬虫(上)—— 数据采集篇
查看>>
java调用远程服务器shell脚本
查看>>
贪吃蛇
查看>>
前端MVC学习总结(四)——NodeJS+MongoDB+AngularJS+Bootstrap书店示例
查看>>
Myeclipse快捷键集合
查看>>
linux安装ftp
查看>>
[转]解读ASP.NET 5 & MVC6系列(8):Session与Caching
查看>>
js正则匹配中文
查看>>
中介者模式(Mediator)
查看>>
Entity Framework 数据生成选项DatabaseGenerated
查看>>
jquery 兼容的滚轮事件
查看>>