Last active
April 9, 2019 18:34
-
-
Save devdilson/c581f7a16f58bed87b36233e98e489c8 to your computer and use it in GitHub Desktop.
Exploiting java security applications using java assist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static void removeLicenseCheck() throws NotFoundException, CannotCompileException { | |
| ClassPool cp = createClassPool(); | |
| CtClass ctClass = cp.get("A.A.A.C.A.M"); | |
| CtMethod[] ms = ctClass.getDeclaredMethods(); | |
| Optional<CtMethod> first = Arrays.asList(ms) | |
| .stream() | |
| .filter(e -> e.getLongName().contains("A.A.A.C.A.M.A(A.A.A.D.T)")) | |
| .findFirst(); | |
| CtMethod m = first.get(); | |
| m.setBody(" { System.out.println(\"Bypassing license check\"); return true; }"); | |
| ctClass.toClass(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment