9 Commits
Author SHA1 Message Date
SuspiciousActivity 1a73814a81 update ASM 9.2 2021-12-03 23:04:55 +01:00
SuspiciousActivity 08af91a3f7 added deobfuscation: noop remover 2021-11-25 22:02:43 +01:00
SuspiciousActivity ad975e67db Merge pull request #2 from EvilCodeZ/master
Fixed POP2 instruction in StackBasedCalculator.
2021-09-05 15:51:11 +02:00
EvilCodeZ 4beaab1283 Fixed POP2 instruction in StackBasedCalculator. 2021-09-05 15:02:55 +02:00
SuspiciousActivity cfa278cd3b Annotations fix 2021-05-02 23:22:43 +02:00
SuspiciousActivity 46c0596768 Fix global search 2021-04-20 20:59:16 +02:00
SuspiciousActivity 74e9491fcf Easier Types 2021-04-20 20:56:00 +02:00
SuspiciousActivity 198c76823b Fixed delete 2021-04-19 11:04:16 +02:00
SuspiciousActivity 1c6a72d951 Bug fix 2021-03-28 22:55:09 +02:00
7 changed files with 41 additions and 61 deletions

No files matched your search

@@ -37,12 +37,10 @@ public class GlobalSearchOpenBox extends JFrame {
JList<Info> list = new JList(model);
list.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
SingleThreadedExecutor.submit(() -> {
Info val = list.getSelectedValue();
if (val != null && !val.owner.equals(Main.currentNodeName)) {
Main.selectFile(val.owner);
if (!e.getValueIsAdjusting() && val != null && !val.owner.equals(Main.currentNodeName)) {
SingleThreadedExecutor.submit(() -> Main.selectFile(val.owner + ".class"));
}
});
}
});
+9 -9
View File
@@ -43,8 +43,8 @@ public class TypeOpenBox extends JFrame {
@Override
public void valueChanged(ListSelectionEvent e) {
String val = list.getSelectedValue();
if (val != null && !val.equals(Main.currentNodeName)) {
SingleThreadedExecutor.submit(() -> Main.selectFile(val));
if (!e.getValueIsAdjusting() && val != null && !val.equals(Main.currentNodeName)) {
SingleThreadedExecutor.submit(() -> Main.selectFile(val + ".class"));
}
}
});
@@ -79,17 +79,17 @@ public class TypeOpenBox extends JFrame {
}
String search = UnicodeUtils.unescape(null, txtSearch.getText(), true).toLowerCase();
if (search.contains("/")) {
for (String className : Main.classNodes.keySet()) {
if (!className.contains("$") && className.toLowerCase().startsWith(search)) {
model.addElement(className);
for (String fullName : Main.classNodes.keySet()) {
if (!fullName.contains("$") && fullName.toLowerCase().startsWith(search)) {
model.addElement(fullName);
}
}
} else {
for (String className : Main.classNodes.keySet()) {
String[] split = className.split("/");
className = split[split.length - 1];
for (String fullName : Main.classNodes.keySet()) {
String[] split = fullName.split("/");
String className = split[split.length - 1];
if (!className.contains("$") && className.toLowerCase().startsWith(search)) {
model.addElement(className);
model.addElement(fullName);
}
}
}
+9 -25
View File
@@ -4,6 +4,7 @@ import java.io.BufferedReader;
import java.io.StringReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@@ -573,7 +574,9 @@ public class Assembler {
String value = split2[1];
if (value.endsWith("]"))
value = value.substring(0, value.length() - 1);
if (value.startsWith("{ ")) {
if (value.equals("{ }")) {
node.values.add(Collections.EMPTY_LIST);
} else if (value.startsWith("{ ")) {
String split3[] = splitWithStrings(value.substring(2, value.length() - 2));
List<Object> list = new ArrayList<>();
for (String rofl : split3) {
@@ -771,14 +774,8 @@ public class Assembler {
String str = consolidateStrings(split, 1);
Object val;
try {
if (str.startsWith("Type: ")) {
str = str.substring(8, str.length() - 2);
String[] split2 = str.split("\n\t");
String type = split2[0].substring(7);
// Reflection
val = new Type(ClassUtil.getIDFromClassNameForType(type),
UnicodeUtils.unescape(hsr, split2[3].substring(6, split2[3].length() - 1)),
Integer.parseInt(split2[1].substring(7)), Integer.parseInt(split2[2].substring(5)));
if (str.startsWith("Type ")) {
val = Type.getType(UnicodeUtils.unescape(hsr, str.substring(6, str.length() - 1), true));
} else if (str.startsWith("\"") && str.endsWith("\"")) {
val = UnicodeUtils.unescape(hsr, str.substring(1, str.length() - 1), true);
} else if (str.startsWith("#")) {
@@ -1456,17 +1453,7 @@ public class Assembler {
for (int i = 10; i < sp.length - 1; i++) {
String st = sp[i].substring(1);
if (st.equals("]")) {
if (stage == 1) {
try {
// Reflection
args.add(new Type(ClassUtil.getIDFromClassNameForType(vals.get(0).substring(6)),
UnicodeUtils.unescape(hsr, vals.get(3).substring(6, vals.get(3).length() - 1)),
Integer.parseInt(vals.get(1).substring(7)),
Integer.parseInt(vals.get(2).substring(5))));
} catch (Exception e) {
throw e;
}
} else if (stage == 2) {
if (stage == 2) {
args.add(new Handle(OpcodesReverse.getHandleOpcode(vals.get(4).substring(5)),
UnicodeUtils.unescape(hsr, vals.get(1).substring(7)),
UnicodeUtils.unescape(hsr, vals.get(0).substring(6)),
@@ -1475,11 +1462,8 @@ public class Assembler {
vals.clear();
}
stage = 0;
} else if (st.equals("Type: [")) {
stage = 1;
} else if (stage == 1) {
st = st.substring(1);
vals.add(st);
} else if (st.startsWith("Type ")) {
args.add(Type.getType(UnicodeUtils.unescape(hsr, st.substring(6, st.length() - 1), true)));
} else if (st.equals("Handle: [")) {
vals.clear();
stage = 2;
+10 -19
View File
@@ -202,8 +202,12 @@ public class Disassembler implements IDecompiler {
}
s += ", ";
}
if (s.endsWith(", ")) {
s = s.substring(0, s.length() - 2);
s += " }], ";
} else {
s += "}], ";
}
} else if (o instanceof String) {
s += "\"" + UnicodeUtils.escapeWithSpaces(hs, (String) o) + "\"], ";
} else {
@@ -307,6 +311,7 @@ public class Disassembler implements IDecompiler {
InsnList insnList = mn.instructions;
boolean deobfNumbers = Main.INSTANCE.mntmNumbers.isSelected();
boolean deobfNops = Main.INSTANCE.mntmNops.isSelected();
ArrayList<Label> labelsReversed = deobfNumbers ? new ArrayList<>() : null;
@@ -358,6 +363,8 @@ public class Disassembler implements IDecompiler {
StringContext ctx = new StringContext(insnList.size());
for (AbstractInsnNode n = insnList.getFirst(); n != null; n = n.getNext()) {
if (deobfNops && n.getOpcode() == Opcodes.NOP)
continue;
ctx.next(disassembleInstruction(n, labels, hs));
}
return new String[] { ctx.finish(), localVarTable, tryCatchTable };
@@ -409,15 +416,7 @@ public class Disassembler implements IDecompiler {
+ "\n\t\t\t]\n\t\t\targs: [\n";
for (Object l : node.bsmArgs) {
if (l instanceof Type) {
Type type = (Type) l;
int valueBegin = type.valueBegin;
int valueEnd = type.valueEnd;
String buf = type.valueBuffer;
// Reflection
s += "\t\t\t\tType: [\n\t\t\t\t\ttype: " + ClassUtil.getClassNameFromType(type)
+ "\n\t\t\t\t\tstart: " + valueBegin + "\n\t\t\t\t\tend: " + valueEnd + "\n\t\t\t\t\tbuf: "
+ ClassUtil.getDecompiledValue(buf, "", hs);
s += "\n\t\t\t\t]\n";
s += "\t\t\t\tType " + ClassUtil.getDecompiledValue(((Type) l).getDescriptor(), "", hs) + "\n";
} else if (l instanceof Handle) {
Handle h = (Handle) l;
s += "\t\t\t\tHandle: [\n\t\t\t\t\tname: "
@@ -446,16 +445,8 @@ public class Disassembler implements IDecompiler {
case LDC_INSN: {
LdcInsnNode node = (LdcInsnNode) n;
if (node.cst instanceof Type) {
Type type = (Type) node.cst;
int valueBegin = type.valueBegin;
int valueEnd = type.valueEnd;
String buf = type.valueBuffer;
// Reflection
String s = "\t\t" + OpcodesReverse.reverseOpcode(n.getOpcode()) + " Type: [\n\t\t\ttype: "
+ ClassUtil.getClassNameFromType(type) + "\n\t\t\tstart: " + valueBegin + "\n\t\t\tend: "
+ valueEnd + "\n\t\t\tbuf: " + ClassUtil.getDecompiledValue(buf, "", hs);
s += "\n\t\t]\n";
return s;
return "\t\t" + OpcodesReverse.reverseOpcode(n.getOpcode()) + " Type "
+ ClassUtil.getDecompiledValue(((Type) node.cst).getDescriptor(), "", hs) + "\n";
}
String decomp = ClassUtil.getDecompiledValue(node.cst, "", hs);
if (node.cst instanceof String) {
@@ -580,8 +580,10 @@ public class StackBasedCalculator implements Opcodes, Runnable {
change(node);
return false;
case POP2:
Number val = stack.pop();
if (!(val instanceof Long) && !(val instanceof Double)) {
stack.pop();
stack.pop();
}
change(node);
return false;
case SWAP: {
+1 -1
View File
@@ -40,7 +40,7 @@ public class ArchiveTreeModel extends DefaultTreeModel {
super(new ByteEditTreeNode(jar.getName().split(File.separator.equals("\\") ? "\\\\"
: File.separator)[jar.getName().split(File.separator.equals("\\") ? "\\\\" : File.separator).length
- 1]));
this.newCreated = true;
this.newCreated = false;
this.jar = jar;
this.classNodes = classNodes;
this.otherFiles = otherFiles;
+7 -2
View File
@@ -89,6 +89,7 @@ import me.ByteEdit.utils.ClassUtil;
import me.ByteEdit.utils.OpcodesReverse;
import me.ByteEdit.utils.UnicodeUtils;
// ASM 9.2
public class Main extends JFrame {
public static Main INSTANCE;
@@ -142,7 +143,7 @@ public class Main extends JFrame {
private JMenuItem rdbtnmntm10000;
public JCheckBoxMenuItem mntmMultithreaded;
private JMenu mnDeobfuscation;
public JCheckBoxMenuItem mntmNumbers;
public JCheckBoxMenuItem mntmNumbers, mntmNops;
public static final Object treeLock = new Object();
@@ -425,6 +426,9 @@ public class Main extends JFrame {
mntmNumbers = new JCheckBoxMenuItem("Numbers");
mnDeobfuscation.add(mntmNumbers);
mntmNops = new JCheckBoxMenuItem("Nops");
mnDeobfuscation.add(mntmNops);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
@@ -483,6 +487,7 @@ public class Main extends JFrame {
String s = ((ByteEditTreeNode) tree.getSelectionPath().getLastPathComponent()).path;
if (JOptionPane.showConfirmDialog(INSTANCE, "Do you want to delete\n\"" + s + "\"?", "Delete",
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
s = s.substring(0, s.length() - 6);
ArrayList<String> toRemove = new ArrayList<>();
for (String key : Main.classNodes.keySet()) {
if (key.contains("$")) {
@@ -494,7 +499,7 @@ public class Main extends JFrame {
}
ArchiveTreeModel model = (ArchiveTreeModel) tree.getModel();
classNodes.remove(s);
model.paths.remove(s);
model.paths.remove(s + ".class");
for (String rem : toRemove) {
classNodes.remove(rem);
}