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