Giter Site home page Giter Site logo

dongzzzz / retrace Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lizhangqu/retrace

0.0 1.0 0.0 236 KB

基于mapping.txt文件,根据原始class名或方法名获取混淆后的class名或方法名,根据混淆后的class名或方法名获取原始class名或方法名,堆栈还原等

Java 100.00%

retrace's Introduction

retrace

Maven

<dependency>
	<groupId>io.github.lizhangqu</groupId>
	<artifactId>retrace</artifactId>
	<version>1.0.2</version>
</dependency>

Gradle

implementation 'io.github.lizhangqu:retrace:1.0.2'

Sample

根据原始class名或方法名获取混淆后的class名或方法名

Retrace retrace = Retrace.createRetrace(mappingFile, true);
ClassMapping retraceClass = retrace.getClassMapping("com.google.common.base.CharMatcher$1");
String originalName = retraceClass.getOriginalName();
String obfuscatedName = retraceClass.getObfuscatedName();


Collection<MethodMapping> methods = retraceClass.getMethods("join");
for (MethodMapping methodMapping : methods) {
    String originalMethodName = methodMapping.getOriginalName();
    String obfuscatedMethodName = methodMapping.getObfuscatedName();
    String methodReturn = methodMapping.getReturn();
    String methodArgs = methodMapping.getArgs();
    String methodRange = methodMapping.getRange();
}

根据混淆后的class名或方法名获取原始class名或方法名

Retrace retrace = Retrace.createRetrace(mappingFile, false);
ClassMapping retraceClass = retrace.getClassMapping("a.a.a.b.n");
String obfuscatedName = retraceClass.getObfuscatedName();
String originalName = retraceClass.getOriginalName();


Collection<MethodMapping> methods = retraceClass.getMethods("a");
for (MethodMapping methodMapping : methods) {
    String obfuscatedMethodName = methodMapping.getObfuscatedName();
    String originalMethodName = methodMapping.getOriginalName();
    String methodReturn = methodMapping.getReturn();
    String methodArgs = methodMapping.getArgs();
    String methodRange = methodMapping.getRange();
}

堆栈还原

Retrace retrace = Retrace.createRetrace(mappingFile, false);
String originalStacktrace = retrace.stackTrace(
        "java.lang.RuntimeException: some text\n" +
                "\tat a.a.a.b.av.b(SourceFile:103)\n" +
                "\tat b.a.a.e.a(SourceFile:62)\n" +
                "\tat b.a.a.d.a(SourceFile:105)\n" +
                "Caused by: java.lang.IllegalArgumentException: some text 2\n" +
                "\tat b.a.a.c.a(SourceFile:40)\n" +
                "\tat some.unknown.method(SourceFile:76)\n" +
                "\tat some.unknown.method2(UnknownSource)\n" +
                "\tat b.a.a.a.a(UnknownSource)\n" +
                "Caused by: java.lang.NullPointerException\n" +
                "\tat b.a.a.b.toString(SourceFile:45)\n" +
                "\t... 2 more");

Thanks

retrace's People

Contributors

lizhangqu avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.