mirror of
https://github.com/SuspiciousActivity/ByteEdit.git
synced 2026-08-13 17:56:17 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a73814a81 | ||
|
|
08af91a3f7 | ||
|
|
ad975e67db | ||
|
|
4beaab1283 | ||
|
|
cfa278cd3b | ||
|
|
46c0596768 | ||
|
|
74e9491fcf | ||
|
|
198c76823b |
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"));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user