Skip to content

Commit

Permalink
support for strong allatori string obfuscation
Browse files Browse the repository at this point in the history
  • Loading branch information
Contra committed Apr 11, 2011
1 parent c57361d commit 55030c7
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 52 deletions.
88 changes: 40 additions & 48 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified out/artifacts/JMD/JMD.jar
Binary file not shown.
Binary file modified out/production/JMD/net/contra/jmd/Deobfuscator.class
Binary file not shown.
Binary file not shown.
5 changes: 4 additions & 1 deletion src/net/contra/jmd/Deobfuscator.java
Expand Up @@ -43,7 +43,10 @@ public static void main(String[] argv) throws Exception {
ZKMTransformer zt = new ZKMTransformer(argv[0]);
zt.transform();
} else if (argv[1].toLowerCase().equals("allatori")) {
AllatoriTransformer at = new AllatoriTransformer(argv[0]);
AllatoriTransformer at = new AllatoriTransformer(argv[0], false);
at.transform();
} else if (argv[1].toLowerCase().equals("allatori-strong")) {
AllatoriTransformer at = new AllatoriTransformer(argv[0], true);
at.transform();
} else if (argv[1].toLowerCase().equals("jshrink")) {
JShrinkTransformer jt = new JShrinkTransformer(argv[0]);
Expand Down
Expand Up @@ -26,9 +26,11 @@ public class AllatoriTransformer {
Map<String, ClassGen> cgs = new HashMap<String, ClassGen>();
ClassGen ALLATORI_CLASS;
String JAR_NAME;
boolean isStrong = false;

public AllatoriTransformer(String jarfile) throws Exception {
public AllatoriTransformer(String jarfile, boolean strong) throws Exception {
logger.log("Allatori Deobfuscator");
isStrong = strong;
File jar = new File(jarfile);
JAR_NAME = jarfile;
JarFile jf = new JarFile(jar);
Expand Down Expand Up @@ -138,8 +140,12 @@ public void replaceStrings() throws TargetLostException {
if (methodCall.getClassName(cg.getConstantPool()).contains(ALLATORI_CLASS.getClassName())) {
LDC encryptedLDC = (LDC) handles[i - 1].getInstruction();
String encryptedString = encryptedLDC.getValue(cg.getConstantPool()).toString();
String decryptedString = decodeContext(encryptedString, cg.getClassName(), method.getName());
//String decryptedString = decode(encryptedString);
String decryptedString;
if(isStrong){
decryptedString = decodeContext(encryptedString, cg.getClassName(), method.getName());
} else {
decryptedString = decode(encryptedString);
}
logger.debug(encryptedString + " -> " + decryptedString + " in " + cg.getClassName() + "." + method.getName());
int stringRef = cg.getConstantPool().addString(decryptedString);
LDC lc = new LDC(stringRef);
Expand Down

0 comments on commit 55030c7

Please sign in to comment.