Skip to content

Body-Alhoha/Remake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Remake

Initializing

 Remake.init();

Adding a transformer

Remake.add(new TestTransformer());

Retransform a class

Remake.remake(Test.class);

Example transformer

import fr.bodyalhoha.remake.transformers.TransformClass;
import fr.bodyalhoha.remake.transformers.Transformer;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.LdcInsnNode;

@TransformClass(
        klass = "fr/bodyalhoha/test/Test"
)
public class TestTransformer extends Transformer {
    @Override
    public void run(ClassNode cn) {
        cn.methods.stream().filter(mn -> mn.name.equalsIgnoreCase("hi")).forEach((mn) -> {
            mn.instructions.forEach((insn) -> {
                if(insn.getOpcode() == Opcodes.LDC){
                    LdcInsnNode ldc = (LdcInsnNode)insn;
                    if(ldc.cst.equals("Hello World!"))
                        ldc.cst = "Hooked!";

                }
            });
        });
    }
}

Warning

This is in beta, it only currently supports Windows.

Credits

Thanks to NyanCatForEver for some help

About

Library to modify java classes bytecode

Resources

License

Stars

Watchers

Forks

Packages

No packages published