Skip to content

Commit

Permalink
added deobfuscation: noop remover
Browse files Browse the repository at this point in the history
  • Loading branch information
SuspiciousActivity committed Nov 25, 2021
1 parent ad975e6 commit 08af91a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/me/ByteEdit/edit/Disassembler.java
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ private static String[] disassembleMethod(MethodNode mn, HugeStrings hs) {

InsnList insnList = mn.instructions;
boolean deobfNumbers = Main.INSTANCE.mntmNumbers.isSelected();
boolean deobfNops = Main.INSTANCE.mntmNops.isSelected();

ArrayList<Label> labelsReversed = deobfNumbers ? new ArrayList<>() : null;

Expand Down Expand Up @@ -362,6 +363,8 @@ private static String[] disassembleMethod(MethodNode mn, HugeStrings hs) {

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 };
Expand Down
5 changes: 4 additions & 1 deletion src/me/ByteEdit/main/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,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();

Expand Down Expand Up @@ -424,6 +424,9 @@ public void run() {

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));
Expand Down

0 comments on commit 08af91a

Please sign in to comment.