Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

renaming of classes and methods done. still need more work, found som…

…e bugs to fix.
  • Loading branch information...
commit a2b407f5419ffaf7dc513d32467ecfa55f33f33e 1 parent 0203959
@contra authored
View
167 .idea/workspace.xml
@@ -3,11 +3,7 @@
<component name="ChangeListManager">
<list default="true" id="5c19ffb3-2980-48ba-a407-712bf5a16688" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/net/contra/jmd/generic/GenericStringDeobfuscator.java" afterPath="$PROJECT_DIR$/src/net/contra/jmd/generic/GenericStringDeobfuscator.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/net/contra/jmd/generic/Renamer.java" afterPath="$PROJECT_DIR$/src/net/contra/jmd/generic/Renamer.java" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/net/contra/jmd/generic/StringFixer.java" afterPath="$PROJECT_DIR$/src/net/contra/jmd/generic/StringFixer.java" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/net/contra/jmd/jshrink/JShrinkTransformer.java" afterPath="$PROJECT_DIR$/src/net/contra/jmd/jshrink/JShrinkTransformer.java" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/net/contra/jmd/smokescreen/SmokeScreenTransformer.java" afterPath="$PROJECT_DIR$/src/net/contra/jmd/smokescreen/SmokeScreenTransformer.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/net/contra/jmd/util/GenericMethods.java" afterPath="$PROJECT_DIR$/src/net/contra/jmd/util/GenericMethods.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/net/contra/jmd/zkm/ZKMTransformer.java" afterPath="$PROJECT_DIR$/src/net/contra/jmd/zkm/ZKMTransformer.java" />
</list>
@@ -99,16 +95,16 @@
<file leaf-file-name="GenericMethods.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/net/contra/jmd/util/GenericMethods.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="20" column="4" selection-start="575" selection-end="575" vertical-scroll-proportion="0.0">
+ <state line="94" column="72" selection-start="2943" selection-end="2943" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="SmokeScreenTransformer.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/src/net/contra/jmd/smokescreen/SmokeScreenTransformer.java">
+ <file leaf-file-name="ZKMTransformer.java" pinned="false" current="true" current-in-tab="true">
+ <entry file="file://$PROJECT_DIR$/src/net/contra/jmd/zkm/ZKMTransformer.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="90" column="48" selection-start="3272" selection-end="3272" vertical-scroll-proportion="0.0">
+ <state line="339" column="147" selection-start="12279" selection-end="12279" vertical-scroll-proportion="0.3596154">
<folding />
</state>
</provider>
@@ -117,34 +113,7 @@
<file leaf-file-name="Renamer.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/net/contra/jmd/generic/Renamer.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="65" column="70" selection-start="1775" selection-end="1775" vertical-scroll-proportion="0.0">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="JShrinkTransformer.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/src/net/contra/jmd/jshrink/JShrinkTransformer.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="71" column="134" selection-start="2339" selection-end="2339" vertical-scroll-proportion="0.0">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="ZKMTransformer.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/src/net/contra/jmd/zkm/ZKMTransformer.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="353" column="50" selection-start="12699" selection-end="12699" vertical-scroll-proportion="0.0">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="StringFixer.java" pinned="false" current="true" current-in-tab="true">
- <entry file="file://$PROJECT_DIR$/src/net/contra/jmd/generic/StringFixer.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="115" column="91" selection-start="4785" selection-end="4785" vertical-scroll-proportion="0.3565737">
+ <state line="15" column="85" selection-start="292" selection-end="292" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
@@ -173,13 +142,13 @@
<option value="$PROJECT_DIR$/src/net/contra/jmd/generic/TransformerTemplate.java" />
<option value="$PROJECT_DIR$/src/net/contra/jmd/jshrink/StoreHandler.java" />
<option value="$PROJECT_DIR$/src/net/contra/jmd/allatori/AllatoriTransformer.java" />
- <option value="$PROJECT_DIR$/src/net/contra/jmd/generic/Renamer.java" />
<option value="$PROJECT_DIR$/src/net/contra/jmd/generic/GenericStringDeobfuscator.java" />
- <option value="$PROJECT_DIR$/src/net/contra/jmd/util/GenericMethods.java" />
<option value="$PROJECT_DIR$/src/net/contra/jmd/smokescreen/SmokeScreenTransformer.java" />
<option value="$PROJECT_DIR$/src/net/contra/jmd/jshrink/JShrinkTransformer.java" />
- <option value="$PROJECT_DIR$/src/net/contra/jmd/zkm/ZKMTransformer.java" />
<option value="$PROJECT_DIR$/src/net/contra/jmd/generic/StringFixer.java" />
+ <option value="$PROJECT_DIR$/src/net/contra/jmd/util/GenericMethods.java" />
+ <option value="$PROJECT_DIR$/src/net/contra/jmd/generic/Renamer.java" />
+ <option value="$PROJECT_DIR$/src/net/contra/jmd/zkm/ZKMTransformer.java" />
</list>
</option>
</component>
@@ -221,8 +190,6 @@
<sortByType />
</navigator>
<panes>
- <pane id="Scope" />
- <pane id="Favorites" />
<pane id="ProjectPane">
<subPane>
<PATH>
@@ -259,9 +226,33 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="JMD" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="JMD" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="src" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="jmd" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="zkm" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
</subPane>
</pane>
<pane id="PackagesPane" />
+ <pane id="Favorites" />
+ <pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
@@ -277,9 +268,9 @@
<property name="GoToClass.toSaveIncludeLibraries" value="false" />
<property name="MemberChooser.showClasses" value="true" />
<property name="GoToClass.includeLibraries" value="false" />
- <property name="options.searchVisible" value="true" />
- <property name="options.splitter.details.proportions" value="0.2" />
<property name="dynamic.classpath" value="false" />
+ <property name="options.splitter.details.proportions" value="0.2" />
+ <property name="options.searchVisible" value="true" />
</component>
<component name="RunManager" selected="Application.JMD">
<configuration default="true" type="Remote" factoryName="Remote">
@@ -294,24 +285,6 @@
<option name="Maven.BeforeRunTask" enabled="false" />
</method>
</configuration>
- <configuration default="true" type="Applet" factoryName="Applet">
- <module name="" />
- <option name="MAIN_CLASS_NAME" />
- <option name="HTML_FILE_NAME" />
- <option name="HTML_USED" value="false" />
- <option name="WIDTH" value="400" />
- <option name="HEIGHT" value="300" />
- <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
- <option name="VM_PARAMETERS" />
- <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
- <option name="ALTERNATIVE_JRE_PATH" />
- <method>
- <option name="AntTarget" enabled="false" />
- <option name="BuildArtifacts" enabled="false" />
- <option name="Make" enabled="true" />
- <option name="Maven.BeforeRunTask" enabled="false" />
- </method>
- </configuration>
<configuration default="true" type="TestNG" factoryName="TestNG">
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@@ -344,6 +317,24 @@
<option name="Maven.BeforeRunTask" enabled="false" />
</method>
</configuration>
+ <configuration default="true" type="Applet" factoryName="Applet">
+ <module name="" />
+ <option name="MAIN_CLASS_NAME" />
+ <option name="HTML_FILE_NAME" />
+ <option name="HTML_USED" value="false" />
+ <option name="WIDTH" value="400" />
+ <option name="HEIGHT" value="300" />
+ <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
+ <option name="VM_PARAMETERS" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <method>
+ <option name="AntTarget" enabled="false" />
+ <option name="BuildArtifacts" enabled="false" />
+ <option name="Make" enabled="true" />
+ <option name="Maven.BeforeRunTask" enabled="false" />
+ </method>
+ </configuration>
<configuration default="true" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
@@ -391,7 +382,7 @@
<configuration default="false" name="JMD" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="net.contra.jmd.Deobfuscator" />
<option name="VM_PARAMETERS" value="" />
- <option name="PROGRAM_PARAMETERS" value="&quot;C:/Contra/nexus.jar&quot; renamer true" />
+ <option name="PROGRAM_PARAMETERS" value="&quot;C:/Contra/ArbiMAGE-deob.jar&quot; renamer true" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" value="" />
@@ -466,7 +457,6 @@
<layout>
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32918397" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
- <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32780084" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32918397" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
@@ -480,6 +470,7 @@
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.22544952" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32780084" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
</layout>
@@ -550,70 +541,60 @@
<state line="20" column="62" selection-start="535" selection-end="535" vertical-scroll-proportion="0.41632652" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/net/contra/jmd/Deobfuscator.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="58" column="29" selection-start="2391" selection-end="2391" vertical-scroll-proportion="0.0" />
- </provider>
- </entry>
<entry file="file://$PROJECT_DIR$/src/net/contra/jmd/util/GenericClassLoader.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="21" column="30" selection-start="500" selection-end="500" vertical-scroll-proportion="0.51293105">
- <folding />
- </state>
+ <state line="21" column="30" selection-start="500" selection-end="500" vertical-scroll-proportion="0.51293105" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/contra/jmd/generic/GenericStringDeobfuscator.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="41" column="13" selection-start="1502" selection-end="1502" vertical-scroll-proportion="0.6222547">
- <folding />
- </state>
+ <state line="41" column="13" selection-start="1502" selection-end="1502" vertical-scroll-proportion="0.6222547" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/contra/jmd/jshrink/StoreHandler.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="16" column="27" selection-start="329" selection-end="329" vertical-scroll-proportion="-0.09770115">
- <folding />
- </state>
+ <state line="16" column="27" selection-start="329" selection-end="329" vertical-scroll-proportion="-0.09770115" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/net/contra/jmd/generic/Renamer.java">
+ <entry file="file://$PROJECT_DIR$/src/net/contra/jmd/generic/StringFixer.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="65" column="70" selection-start="1775" selection-end="1775" vertical-scroll-proportion="0.0">
- <folding />
- </state>
+ <state line="115" column="91" selection-start="4785" selection-end="4785" vertical-scroll-proportion="0.02556391" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/net/contra/jmd/util/GenericMethods.java">
+ <entry file="file://$PROJECT_DIR$/src/net/contra/jmd/jshrink/JShrinkTransformer.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="20" column="4" selection-start="575" selection-end="575" vertical-scroll-proportion="0.0">
- <folding />
- </state>
+ <state line="71" column="134" selection-start="2339" selection-end="2339" vertical-scroll-proportion="0.02489019" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/net/contra/jmd/smokescreen/SmokeScreenTransformer.java">
+ <entry file="file://$PROJECT_DIR$/src/net/contra/jmd/Deobfuscator.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="90" column="48" selection-start="3272" selection-end="3272" vertical-scroll-proportion="0.0">
+ <state line="58" column="29" selection-start="2391" selection-end="2391" vertical-scroll-proportion="0.0" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/net/contra/jmd/generic/Renamer.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="15" column="85" selection-start="292" selection-end="292" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/net/contra/jmd/jshrink/JShrinkTransformer.java">
+ <entry file="file://$PROJECT_DIR$/src/net/contra/jmd/smokescreen/SmokeScreenTransformer.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="71" column="134" selection-start="2339" selection-end="2339" vertical-scroll-proportion="0.0">
+ <state line="195" column="16" selection-start="6822" selection-end="7064" vertical-scroll-proportion="0.26153848">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/net/contra/jmd/zkm/ZKMTransformer.java">
+ <entry file="file://$PROJECT_DIR$/src/net/contra/jmd/util/GenericMethods.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="353" column="50" selection-start="12699" selection-end="12699" vertical-scroll-proportion="0.0">
+ <state line="94" column="72" selection-start="2943" selection-end="2943" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/net/contra/jmd/generic/StringFixer.java">
+ <entry file="file://$PROJECT_DIR$/src/net/contra/jmd/zkm/ZKMTransformer.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="115" column="91" selection-start="4785" selection-end="4785" vertical-scroll-proportion="0.3565737">
+ <state line="339" column="147" selection-start="12279" selection-end="12279" vertical-scroll-proportion="0.3596154">
<folding />
</state>
</provider>
View
BIN  out/artifacts/JMD/JMD.jar
Binary file not shown
View
BIN  out/production/JMD/net/contra/jmd/generic/Renamer.class
Binary file not shown
View
BIN  out/production/JMD/net/contra/jmd/util/GenericMethods.class
Binary file not shown
View
80 src/net/contra/jmd/generic/Renamer.java
@@ -17,7 +17,8 @@
public class Renamer {
private static LogHandler logger = new LogHandler("Renamer");
private Map<String, ClassGen> cgs = new HashMap<String, ClassGen>();
- //ClassName, Type<Number>
+ private Map<String, ClassGen> tempcgs = new HashMap<String, ClassGen>();
+ private Map<String, String> methodNames = new HashMap<String, String>(); //OldName, NewName
String JAR_NAME;
public Renamer(String jarfile) throws Exception {
@@ -25,13 +26,17 @@ public Renamer(String jarfile) throws Exception {
JAR_NAME = jarfile;
JarFile jf = new JarFile(jar);
Enumeration<JarEntry> entries = jf.entries();
+ //TODO: Make it not rename the main class
+ //TODO: Keep it from renaming like, methods that shouldn't be renamed and shit??
+
+ //Manifest jm = jf.getManifest();
+ //if(jm.getAttributes("Main-class") != null &&
+ //logger.debug("Found main class for jar: " + );
while(entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
if(entry == null) {
break;
}
- if(entry.isDirectory()) {
- }
if(entry.getName().endsWith(".class")) {
ClassGen cg = new ClassGen(new ClassParser(jf.getInputStream(entry), entry.getName()).parse());
cgs.put(cg.getClassName(), cg);
@@ -40,19 +45,70 @@ public Renamer(String jarfile) throws Exception {
}
}
}
-
+ public void renameClasses(){
+ int classCount = 1;
+ for(ClassGen cg : cgs.values()){
+ String className = cg.getClassName();
+ String shortClassName = className.substring(className.lastIndexOf(".") + 1, className.length());
+ String newClassName = className.replace(shortClassName, "Class" + classCount);
+ cg.setClassName(newClassName);
+ tempcgs.put(newClassName, cg);
+ classCount++;
+ }
+ if(classCount > 1){
+ logger.debug("Renamed " + classCount + " classes.");
+ cgs = tempcgs;
+ }
+ }
+ public void replaceMethodRefs() {
+ for(ClassGen cg : cgs.values()){
+ for(Method m : cg.getMethods()){
+ int replaced = 0;
+ MethodGen mg = new MethodGen(m, cg.getClassName(), cg.getConstantPool());
+ InstructionList list = mg.getInstructionList();
+ if(list == null){
+ continue;
+ }
+ InstructionHandle[] handles = list.getInstructionHandles();
+ for(int x = 0; x < handles.length; x++) {
+ if(GenericMethods.isCall(handles[x].getInstruction())){
+ String oldClassName = GenericMethods.getCallClassName(handles[x].getInstruction(), cg.getConstantPool());
+ String oldMethodName = GenericMethods.getCallMethodName(handles[x].getInstruction(), cg.getConstantPool());
+ String oldSignature = GenericMethods.getCallSignature(handles[x].getInstruction(), cg.getConstantPool());
+ String mod = oldClassName + "-" + oldMethodName + "-" + oldSignature;
+ if(methodNames.containsKey(mod)){
+ //logger.debug("Accessing " + methodNames.get(mod));
+ String[] args = methodNames.get(mod).split("-");
+ String newClassName = args[0];
+ String newMethodName = args[1];
+ String newSignature = args[2];
+ int newindex = cg.getConstantPool().addMethodref(newClassName, newMethodName, newSignature);
+ Instruction newInvoke = GenericMethods.getNewInvoke(handles[x].getInstruction(), newindex);
+ handles[x].setInstruction(newInvoke);
+ replaced++;
+ }
+ }
+ }
+ mg.setInstructionList(list);
+ mg.setMaxLocals();
+ mg.setMaxStack();
+ if(replaced > 0) {
+ logger.debug("replaced " + replaced + " methodrefs in " + m.getName());
+ cg.replaceMethod(m, mg.getMethod());
+ }
+ }
+ }
+ }
public void renameMethods() {
for(ClassGen cg : cgs.values()) {
if(cg.isAbstract() || cg.isInterface()) {
continue;
}
- int count = 0;
+ int count = 1;
for(Method m : cg.getMethods()) {
if(m.getName().equalsIgnoreCase("<clinit>")
|| m.getName().equalsIgnoreCase("<init>")
- || m.getName().equalsIgnoreCase("main")
- || m.isAbstract()
- || m.isInterface()) {
+ || m.getName().equalsIgnoreCase("main")) {
continue;
}
ConstantPoolGen cpg = cg.getConstantPool();
@@ -66,18 +122,16 @@ public void renameMethods() {
name = name.replace("void", "");
if(name.contains("[]")) {
name = name.replace("[]", "Array");
- //name += "[]";
}
name += "Method" + count;
- //int nameRef = cpg.addNameAndType(name, m.getSignature());
- //cpg.setConstant(m.getNameIndex(), cpg.getConstant(nameRef));
//TODO: Get it to fully change the name (updated methodref name index) and not corrupt the constant pool lol
//TODO: Rename classes first, then methods, then fields.
MethodGen mg = new MethodGen(m, cg.getClassName(), cpg);
mg.setName(name);
-
cg.replaceMethod(m, mg.getMethod());
cg.setConstantPool(cpg);
+ //y.pb.methodsig - Class.Method04.MethodSig
+ methodNames.put(cg.getClassName() + "-" + m.getName() + "-"+ m.getSignature(), cg.getClassName() + "-" + name + "-"+ m.getSignature());
count++;
logger.debug(cg.getClassName() + "." + m.getName() + " -> " + cg.getClassName() + "." + name);
}
@@ -86,7 +140,9 @@ public void renameMethods() {
public void transform() {
logger.log("Generic Renamer");
+ renameClasses();
renameMethods();
+ replaceMethodRefs();
logger.log("Deobfuscation finished! Dumping jar...");
GenericMethods.dumpJar(JAR_NAME, cgs.values());
logger.log("Operation Completed.");
View
22 src/net/contra/jmd/util/GenericMethods.java
@@ -56,7 +56,27 @@ public static String getCallSignature(Instruction ins, ConstantPoolGen cp) {
return null;
}
}
-
+ public static Instruction getNewInvoke(Instruction ins, int index) {
+ if(ins instanceof INVOKESTATIC) {
+ INVOKESTATIC invst = (INVOKESTATIC) ins;
+ invst.setIndex(index);
+ return invst;
+ } else if(ins instanceof INVOKEVIRTUAL) {
+ INVOKEVIRTUAL invst = (INVOKEVIRTUAL) ins;
+ invst.setIndex(index);
+ return invst;
+ } else if(ins instanceof INVOKEINTERFACE) {
+ INVOKEINTERFACE invst = (INVOKEINTERFACE) ins;
+ invst.setIndex(index);
+ return invst;
+ } else if(ins instanceof INVOKESPECIAL) {
+ INVOKESPECIAL invst = (INVOKESPECIAL) ins;
+ invst.setIndex(index);
+ return invst;
+ } else {
+ return null;
+ }
+ }
public static String getCallClassName(Instruction ins, ConstantPoolGen cp) {
if(ins instanceof INVOKESTATIC) {
INVOKESTATIC invst = (INVOKESTATIC) ins;
View
2  src/net/contra/jmd/zkm/ZKMTransformer.java
@@ -337,7 +337,7 @@ public void removeOriginStrings() {
}
}
}
-
+ //TODO: It isn't finding the last string sometimes, so shit gets all fucked up and it ends up leaving a call to static{} and extra instructions
public void getStringsFromZKM() {
for(ClassGen cg : cgs.values()) {
String key = findKey(cg);
Please sign in to comment.
Something went wrong with that request. Please try again.