2.3.0 Release
12/16/2014 - Started updating the class viewer. 12/18/2014 - Finished a basic concept of the new class viewer. 12/18/2014 - Fixed an error with importing some jars. 12/18/2014 - Fixed the about window. 12/18/2014 - Finished the final concept for the new class viewer. 12/18/2014 - Threaded save Java files as zip, it now runs in a background thread. 12/18/2014 - Save Java files as zip now prompts you to select a decompiler. 12/18/2014 - Removed the cursor waiting for save Java files as zip. 12/18/2014 - Wrapped the save Java files as zip around an exception handler, it will now safely show the exception if any is thrown. 12/18/2014 - Fixed not escaping the Java strings by default for the Bytecode decompiler. - http://i.imgur.com/YrRnZA7.png 12/18/2014 - Used Eclipse's code formatting tool and formatted the code 12/19/2014 - Priav03 fixed the quick class searcher.
This commit is contained in:
parent
a8220ecb61
commit
4e6647be19
67 changed files with 6467 additions and 5406 deletions
Binary file not shown.
22
README.txt
22
README.txt
|
@ -15,6 +15,15 @@ Code from various projects has been used, including but not limited to:
|
||||||
CFR by Lee Benfield
|
CFR by Lee Benfield
|
||||||
CFIDE by Bibl
|
CFIDE by Bibl
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
Konloch
|
||||||
|
Bibl
|
||||||
|
Fluke
|
||||||
|
Righteous
|
||||||
|
sahitya-pavurala
|
||||||
|
priav03
|
||||||
|
If I missed you, please feel free to contact me @Konloch or konloch@gmail.com
|
||||||
|
|
||||||
Video: http://the.bytecode.club/bytecodeviewer-video/
|
Video: http://the.bytecode.club/bytecodeviewer-video/
|
||||||
Source Code: https://github.com/konloch/bytecode-viewer
|
Source Code: https://github.com/konloch/bytecode-viewer
|
||||||
Bin/Archive: https://github.com/konloch/bytecode-viewer/releases
|
Bin/Archive: https://github.com/konloch/bytecode-viewer/releases
|
||||||
|
@ -182,3 +191,16 @@ Changelog:
|
||||||
12/13/2014 - Search results are now clickable.
|
12/13/2014 - Search results are now clickable.
|
||||||
--- 2.2.1 ---:
|
--- 2.2.1 ---:
|
||||||
12/13/2014 - Fixed an issue with the Bytecode Decompiler. - Thanks bibl
|
12/13/2014 - Fixed an issue with the Bytecode Decompiler. - Thanks bibl
|
||||||
|
--- 2.3.0 ---:
|
||||||
|
12/16/2014 - Started updating the class viewer.
|
||||||
|
12/18/2014 - Finished a basic concept of the new class viewer.
|
||||||
|
12/18/2014 - Fixed an error with importing some jars.
|
||||||
|
12/18/2014 - Fixed the about window.
|
||||||
|
12/18/2014 - Finished the final concept for the new class viewer.
|
||||||
|
12/18/2014 - Threaded save Java files as zip, it now runs in a background thread.
|
||||||
|
12/18/2014 - Save Java files as zip now prompts you to select a decompiler.
|
||||||
|
12/18/2014 - Removed the cursor waiting for save Java files as zip.
|
||||||
|
12/18/2014 - Wrapped the save Java files as zip around an exception handler, it will now safely show the exception if any is thrown.
|
||||||
|
12/18/2014 - Fixed not escaping the Java strings by default for the Bytecode decompiler. - http://i.imgur.com/YrRnZA7.png
|
||||||
|
12/18/2014 - Used Eclipse's code formatting tool and formatted the code
|
||||||
|
12/19/2014 - Priav03 fixed the quick class searcher.
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
2.2.1
|
2.3.0
|
|
@ -5,13 +5,10 @@ import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by IntelliJ IDEA.
|
* Created by IntelliJ IDEA. User: laullon Date: 08-abr-2003 Time: 13:21:09
|
||||||
* User: laullon
|
|
||||||
* Date: 08-abr-2003
|
|
||||||
* Time: 13:21:09
|
|
||||||
*/
|
*/
|
||||||
public class JHexEditor extends JPanel implements FocusListener,AdjustmentListener,MouseWheelListener
|
public class JHexEditor extends JPanel implements FocusListener,
|
||||||
{
|
AdjustmentListener, MouseWheelListener {
|
||||||
private static final long serialVersionUID = 2289328616534802372L;
|
private static final long serialVersionUID = 2289328616534802372L;
|
||||||
byte[] buff;
|
byte[] buff;
|
||||||
public int cursor;
|
public int cursor;
|
||||||
|
@ -23,8 +20,7 @@ public class JHexEditor extends JPanel implements FocusListener,AdjustmentListen
|
||||||
private int inicio = 0;
|
private int inicio = 0;
|
||||||
private int lineas = 10;
|
private int lineas = 10;
|
||||||
|
|
||||||
public JHexEditor(byte[] buff)
|
public JHexEditor(byte[] buff) {
|
||||||
{
|
|
||||||
super();
|
super();
|
||||||
this.buff = buff;
|
this.buff = buff;
|
||||||
|
|
||||||
|
@ -62,159 +58,136 @@ public class JHexEditor extends JPanel implements FocusListener,AdjustmentListen
|
||||||
this.add(panel, BorderLayout.CENTER);
|
this.add(panel, BorderLayout.CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void paint(Graphics g)
|
public void paint(Graphics g) {
|
||||||
{
|
|
||||||
FontMetrics fn = getFontMetrics(font);
|
FontMetrics fn = getFontMetrics(font);
|
||||||
Rectangle rec = this.getBounds();
|
Rectangle rec = this.getBounds();
|
||||||
lineas = (rec.height / fn.getHeight()) - 1;
|
lineas = (rec.height / fn.getHeight()) - 1;
|
||||||
int n = (buff.length / 16) - 1;
|
int n = (buff.length / 16) - 1;
|
||||||
if(lineas>n) { lineas=n; inicio=0; }
|
if (lineas > n) {
|
||||||
|
lineas = n;
|
||||||
|
inicio = 0;
|
||||||
|
}
|
||||||
|
|
||||||
sb.setValues(getInicio(), +getLineas(), 0, buff.length / 16);
|
sb.setValues(getInicio(), +getLineas(), 0, buff.length / 16);
|
||||||
sb.setValueIsAdjusting(true);
|
sb.setValueIsAdjusting(true);
|
||||||
super.paint(g);
|
super.paint(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void actualizaCursor()
|
protected void actualizaCursor() {
|
||||||
{
|
|
||||||
int n = (cursor / 16);
|
int n = (cursor / 16);
|
||||||
|
|
||||||
System.out.print("- "+inicio+"<"+n+"<"+(lineas+inicio)+"("+lineas+")");
|
System.out.print("- " + inicio + "<" + n + "<" + (lineas + inicio)
|
||||||
|
+ "(" + lineas + ")");
|
||||||
|
|
||||||
if(n<inicio) inicio=n;
|
if (n < inicio)
|
||||||
else if(n>=inicio+lineas) inicio=n-(lineas-1);
|
inicio = n;
|
||||||
|
else if (n >= inicio + lineas)
|
||||||
|
inicio = n - (lineas - 1);
|
||||||
|
|
||||||
System.out.println(" - "+inicio+"<"+n+"<"+(lineas+inicio)+"("+lineas+")");
|
System.out.println(" - " + inicio + "<" + n + "<" + (lineas + inicio)
|
||||||
|
+ "(" + lineas + ")");
|
||||||
|
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getInicio()
|
protected int getInicio() {
|
||||||
{
|
|
||||||
return inicio;
|
return inicio;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getLineas()
|
protected int getLineas() {
|
||||||
{
|
|
||||||
return lineas;
|
return lineas;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void fondo(Graphics g,int x,int y,int s)
|
protected void fondo(Graphics g, int x, int y, int s) {
|
||||||
{
|
|
||||||
FontMetrics fn = getFontMetrics(font);
|
FontMetrics fn = getFontMetrics(font);
|
||||||
g.fillRect(((fn.stringWidth(" ")+1)*x)+border,(fn.getHeight()*y)+border,((fn.stringWidth(" ")+1)*s),fn.getHeight()+1);
|
g.fillRect(((fn.stringWidth(" ") + 1) * x) + border,
|
||||||
|
(fn.getHeight() * y) + border, ((fn.stringWidth(" ") + 1) * s),
|
||||||
|
fn.getHeight() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void cuadro(Graphics g,int x,int y,int s)
|
protected void cuadro(Graphics g, int x, int y, int s) {
|
||||||
{
|
|
||||||
FontMetrics fn = getFontMetrics(font);
|
FontMetrics fn = getFontMetrics(font);
|
||||||
g.drawRect(((fn.stringWidth(" ")+1)*x)+border,(fn.getHeight()*y)+border,((fn.stringWidth(" ")+1)*s),fn.getHeight()+1);
|
g.drawRect(((fn.stringWidth(" ") + 1) * x) + border,
|
||||||
|
(fn.getHeight() * y) + border, ((fn.stringWidth(" ") + 1) * s),
|
||||||
|
fn.getHeight() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void printString(Graphics g,String s,int x,int y)
|
protected void printString(Graphics g, String s, int x, int y) {
|
||||||
{
|
|
||||||
FontMetrics fn = getFontMetrics(font);
|
FontMetrics fn = getFontMetrics(font);
|
||||||
g.drawString(s,((fn.stringWidth(" ")+1)*x)+border,((fn.getHeight()*(y+1))-fn.getMaxDescent())+border);
|
g.drawString(s, ((fn.stringWidth(" ") + 1) * x) + border,
|
||||||
|
((fn.getHeight() * (y + 1)) - fn.getMaxDescent()) + border);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void focusGained(FocusEvent e)
|
public void focusGained(FocusEvent e) {
|
||||||
{
|
|
||||||
this.repaint();
|
this.repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void focusLost(FocusEvent e)
|
public void focusLost(FocusEvent e) {
|
||||||
{
|
|
||||||
this.repaint();
|
this.repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void adjustmentValueChanged(AdjustmentEvent e)
|
public void adjustmentValueChanged(AdjustmentEvent e) {
|
||||||
{
|
|
||||||
inicio = e.getValue();
|
inicio = e.getValue();
|
||||||
if(inicio<0) inicio=0;
|
if (inicio < 0)
|
||||||
|
inicio = 0;
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mouseWheelMoved(MouseWheelEvent e)
|
public void mouseWheelMoved(MouseWheelEvent e) {
|
||||||
{
|
|
||||||
inicio += (e.getUnitsToScroll());
|
inicio += (e.getUnitsToScroll());
|
||||||
if((inicio+lineas)>=buff.length/16) inicio=(buff.length/16)-lineas;
|
if ((inicio + lineas) >= buff.length / 16)
|
||||||
if(inicio<0) inicio=0;
|
inicio = (buff.length / 16) - lineas;
|
||||||
|
if (inicio < 0)
|
||||||
|
inicio = 0;
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void keyPressed(KeyEvent e)
|
public void keyPressed(KeyEvent e) {
|
||||||
{
|
/*
|
||||||
/*switch(e.getKeyCode())
|
* switch(e.getKeyCode()) { case 33: // rep if(cursor>=(16*lineas))
|
||||||
{
|
* cursor-=(16*lineas); actualizaCursor(); break; case 34: // fin
|
||||||
case 33: // rep
|
* if(cursor<(buff.length-(16*lineas))) cursor+=(16*lineas);
|
||||||
if(cursor>=(16*lineas)) cursor-=(16*lineas);
|
* actualizaCursor(); break; case 35: // fin cursor=buff.length-1;
|
||||||
actualizaCursor();
|
* actualizaCursor(); break; case 36: // ini cursor=0;
|
||||||
break;
|
* actualizaCursor(); break; case 37: // <-- if(cursor!=0) cursor--;
|
||||||
case 34: // fin
|
* actualizaCursor(); break; case 38: // <-- if(cursor>15) cursor-=16;
|
||||||
if(cursor<(buff.length-(16*lineas))) cursor+=(16*lineas);
|
* actualizaCursor(); break; case 39: // --> if(cursor!=(buff.length-1))
|
||||||
actualizaCursor();
|
* cursor++; actualizaCursor(); break; case 40: // -->
|
||||||
break;
|
* if(cursor<(buff.length-16)) cursor+=16; actualizaCursor(); break; }
|
||||||
case 35: // fin
|
*/
|
||||||
cursor=buff.length-1;
|
|
||||||
actualizaCursor();
|
|
||||||
break;
|
|
||||||
case 36: // ini
|
|
||||||
cursor=0;
|
|
||||||
actualizaCursor();
|
|
||||||
break;
|
|
||||||
case 37: // <--
|
|
||||||
if(cursor!=0) cursor--;
|
|
||||||
actualizaCursor();
|
|
||||||
break;
|
|
||||||
case 38: // <--
|
|
||||||
if(cursor>15) cursor-=16;
|
|
||||||
actualizaCursor();
|
|
||||||
break;
|
|
||||||
case 39: // -->
|
|
||||||
if(cursor!=(buff.length-1)) cursor++;
|
|
||||||
actualizaCursor();
|
|
||||||
break;
|
|
||||||
case 40: // -->
|
|
||||||
if(cursor<(buff.length-16)) cursor+=16;
|
|
||||||
actualizaCursor();
|
|
||||||
break;
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Columnas extends JPanel
|
private class Columnas extends JPanel {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = -1734199617526339842L;
|
private static final long serialVersionUID = -1734199617526339842L;
|
||||||
|
|
||||||
public Columnas()
|
public Columnas() {
|
||||||
{
|
|
||||||
this.setLayout(new BorderLayout(1, 1));
|
this.setLayout(new BorderLayout(1, 1));
|
||||||
}
|
}
|
||||||
public Dimension getPreferredSize()
|
|
||||||
{
|
public Dimension getPreferredSize() {
|
||||||
return getMinimumSize();
|
return getMinimumSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dimension getMinimumSize()
|
public Dimension getMinimumSize() {
|
||||||
{
|
|
||||||
Dimension d = new Dimension();
|
Dimension d = new Dimension();
|
||||||
FontMetrics fn = getFontMetrics(font);
|
FontMetrics fn = getFontMetrics(font);
|
||||||
int h = fn.getHeight();
|
int h = fn.getHeight();
|
||||||
int nl = 1;
|
int nl = 1;
|
||||||
d.setSize(((fn.stringWidth(" ")+1)*+((16*3)-1))+(border*2)+1,h*nl+(border*2)+1);
|
d.setSize(((fn.stringWidth(" ") + 1) * +((16 * 3) - 1))
|
||||||
|
+ (border * 2) + 1, h * nl + (border * 2) + 1);
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void paint(Graphics g)
|
public void paint(Graphics g) {
|
||||||
{
|
|
||||||
Dimension d = getMinimumSize();
|
Dimension d = getMinimumSize();
|
||||||
g.setColor(Color.white);
|
g.setColor(Color.white);
|
||||||
g.fillRect(0, 0, d.width, d.height);
|
g.fillRect(0, 0, d.width, d.height);
|
||||||
g.setColor(Color.black);
|
g.setColor(Color.black);
|
||||||
g.setFont(font);
|
g.setFont(font);
|
||||||
|
|
||||||
for(int n=0;n<16;n++)
|
for (int n = 0; n < 16; n++) {
|
||||||
{
|
if (n == (cursor % 16))
|
||||||
if(n==(cursor%16)) cuadro(g,n*3,0,2);
|
cuadro(g, n * 3, 0, 2);
|
||||||
String s = "00" + Integer.toHexString(n);
|
String s = "00" + Integer.toHexString(n);
|
||||||
s = s.substring(s.length() - 2);
|
s = s.substring(s.length() - 2);
|
||||||
printString(g, s, n * 3, 0);
|
printString(g, s, n * 3, 0);
|
||||||
|
@ -222,51 +195,46 @@ public class JHexEditor extends JPanel implements FocusListener,AdjustmentListen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Caja extends JPanel
|
private class Caja extends JPanel {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = -6124062720565016834L;
|
private static final long serialVersionUID = -6124062720565016834L;
|
||||||
|
|
||||||
public Dimension getPreferredSize()
|
public Dimension getPreferredSize() {
|
||||||
{
|
|
||||||
return getMinimumSize();
|
return getMinimumSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dimension getMinimumSize()
|
public Dimension getMinimumSize() {
|
||||||
{
|
|
||||||
Dimension d = new Dimension();
|
Dimension d = new Dimension();
|
||||||
FontMetrics fn = getFontMetrics(font);
|
FontMetrics fn = getFontMetrics(font);
|
||||||
int h = fn.getHeight();
|
int h = fn.getHeight();
|
||||||
d.setSize((fn.stringWidth(" ")+1)+(border*2)+1,h+(border*2)+1);
|
d.setSize((fn.stringWidth(" ") + 1) + (border * 2) + 1, h
|
||||||
|
+ (border * 2) + 1);
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Filas extends JPanel
|
private class Filas extends JPanel {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 8797347523486018051L;
|
private static final long serialVersionUID = 8797347523486018051L;
|
||||||
|
|
||||||
public Filas()
|
public Filas() {
|
||||||
{
|
|
||||||
this.setLayout(new BorderLayout(1, 1));
|
this.setLayout(new BorderLayout(1, 1));
|
||||||
}
|
}
|
||||||
public Dimension getPreferredSize()
|
|
||||||
{
|
public Dimension getPreferredSize() {
|
||||||
return getMinimumSize();
|
return getMinimumSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dimension getMinimumSize()
|
public Dimension getMinimumSize() {
|
||||||
{
|
|
||||||
Dimension d = new Dimension();
|
Dimension d = new Dimension();
|
||||||
FontMetrics fn = getFontMetrics(font);
|
FontMetrics fn = getFontMetrics(font);
|
||||||
int h = fn.getHeight();
|
int h = fn.getHeight();
|
||||||
int nl = getLineas();
|
int nl = getLineas();
|
||||||
d.setSize((fn.stringWidth(" ")+1)*(8)+(border*2)+1,h*nl+(border*2)+1);
|
d.setSize((fn.stringWidth(" ") + 1) * (8) + (border * 2) + 1, h
|
||||||
|
* nl + (border * 2) + 1);
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void paint(Graphics g)
|
public void paint(Graphics g) {
|
||||||
{
|
|
||||||
Dimension d = getMinimumSize();
|
Dimension d = getMinimumSize();
|
||||||
g.setColor(Color.white);
|
g.setColor(Color.white);
|
||||||
g.fillRect(0, 0, d.width, d.height);
|
g.fillRect(0, 0, d.width, d.height);
|
||||||
|
@ -276,9 +244,9 @@ public class JHexEditor extends JPanel implements FocusListener,AdjustmentListen
|
||||||
int ini = getInicio();
|
int ini = getInicio();
|
||||||
int fin = ini + getLineas();
|
int fin = ini + getLineas();
|
||||||
int y = 0;
|
int y = 0;
|
||||||
for(int n=ini;n<fin;n++)
|
for (int n = ini; n < fin; n++) {
|
||||||
{
|
if (n == (cursor / 16))
|
||||||
if(n==(cursor/16)) cuadro(g,0,y,8);
|
cuadro(g, 0, y, 8);
|
||||||
String s = "0000000000000" + Integer.toHexString(n);
|
String s = "0000000000000" + Integer.toHexString(n);
|
||||||
s = s.substring(s.length() - 8);
|
s = s.substring(s.length() - 8);
|
||||||
printString(g, s, 0, y++);
|
printString(g, s, 0, y++);
|
||||||
|
|
|
@ -5,44 +5,38 @@ import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by IntelliJ IDEA.
|
* Created by IntelliJ IDEA. User: laullon Date: 09-abr-2003 Time: 12:47:18
|
||||||
* User: laullon
|
|
||||||
* Date: 09-abr-2003
|
|
||||||
* Time: 12:47:18
|
|
||||||
*/
|
*/
|
||||||
public class JHexEditorASCII extends JComponent implements MouseListener,KeyListener
|
public class JHexEditorASCII extends JComponent implements MouseListener,
|
||||||
{
|
KeyListener {
|
||||||
private static final long serialVersionUID = 5505374841731053461L;
|
private static final long serialVersionUID = 5505374841731053461L;
|
||||||
private JHexEditor he;
|
private JHexEditor he;
|
||||||
|
|
||||||
public JHexEditorASCII(JHexEditor he)
|
public JHexEditorASCII(JHexEditor he) {
|
||||||
{
|
|
||||||
this.he = he;
|
this.he = he;
|
||||||
addMouseListener(this);
|
addMouseListener(this);
|
||||||
addKeyListener(this);
|
addKeyListener(this);
|
||||||
addFocusListener(he);
|
addFocusListener(he);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dimension getPreferredSize()
|
public Dimension getPreferredSize() {
|
||||||
{
|
|
||||||
debug("getPreferredSize()");
|
debug("getPreferredSize()");
|
||||||
return getMinimumSize();
|
return getMinimumSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dimension getMinimumSize()
|
public Dimension getMinimumSize() {
|
||||||
{
|
|
||||||
debug("getMinimumSize()");
|
debug("getMinimumSize()");
|
||||||
|
|
||||||
Dimension d = new Dimension();
|
Dimension d = new Dimension();
|
||||||
FontMetrics fn = getFontMetrics(JHexEditor.font);
|
FontMetrics fn = getFontMetrics(JHexEditor.font);
|
||||||
int h = fn.getHeight();
|
int h = fn.getHeight();
|
||||||
int nl = he.getLineas();
|
int nl = he.getLineas();
|
||||||
d.setSize((fn.stringWidth(" ")+1)*(16)+(he.border*2)+1,h*nl+(he.border*2)+1);
|
d.setSize((fn.stringWidth(" ") + 1) * (16) + (he.border * 2) + 1, h
|
||||||
|
* nl + (he.border * 2) + 1);
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void paint(Graphics g)
|
public void paint(Graphics g) {
|
||||||
{
|
|
||||||
debug("paint(" + g + ")");
|
debug("paint(" + g + ")");
|
||||||
debug("cursor=" + he.cursor + " buff.length=" + he.buff.length);
|
debug("cursor=" + he.cursor + " buff.length=" + he.buff.length);
|
||||||
Dimension d = getMinimumSize();
|
Dimension d = getMinimumSize();
|
||||||
|
@ -55,27 +49,31 @@ public class JHexEditorASCII extends JComponent implements MouseListener,KeyList
|
||||||
// datos ascii
|
// datos ascii
|
||||||
int ini = he.getInicio() * 16;
|
int ini = he.getInicio() * 16;
|
||||||
int fin = ini + (he.getLineas() * 16);
|
int fin = ini + (he.getLineas() * 16);
|
||||||
if(fin>he.buff.length) fin=he.buff.length;
|
if (fin > he.buff.length)
|
||||||
|
fin = he.buff.length;
|
||||||
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
for(int n=ini;n<fin;n++)
|
for (int n = ini; n < fin; n++) {
|
||||||
{
|
if (n == he.cursor) {
|
||||||
if(n==he.cursor)
|
|
||||||
{
|
|
||||||
g.setColor(Color.blue);
|
g.setColor(Color.blue);
|
||||||
if(hasFocus()) he.fondo(g,x,y,1); else he.cuadro(g,x,y,1);
|
if (hasFocus())
|
||||||
if(hasFocus()) g.setColor(Color.white); else g.setColor(Color.black);
|
he.fondo(g, x, y, 1);
|
||||||
} else
|
else
|
||||||
{
|
he.cuadro(g, x, y, 1);
|
||||||
|
if (hasFocus())
|
||||||
|
g.setColor(Color.white);
|
||||||
|
else
|
||||||
|
g.setColor(Color.black);
|
||||||
|
} else {
|
||||||
g.setColor(Color.black);
|
g.setColor(Color.black);
|
||||||
}
|
}
|
||||||
|
|
||||||
String s = "" + new Character((char) he.buff[n]);
|
String s = "" + new Character((char) he.buff[n]);
|
||||||
if((he.buff[n]<20)||(he.buff[n]>126)) s=""+(char)16;
|
if ((he.buff[n] < 20) || (he.buff[n] > 126))
|
||||||
|
s = "" + (char) 16;
|
||||||
he.printString(g, s, (x++), y);
|
he.printString(g, s, (x++), y);
|
||||||
if(x==16)
|
if (x == 16) {
|
||||||
{
|
|
||||||
x = 0;
|
x = 0;
|
||||||
y++;
|
y++;
|
||||||
}
|
}
|
||||||
|
@ -83,14 +81,13 @@ public class JHexEditorASCII extends JComponent implements MouseListener,KeyList
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void debug(String s)
|
private void debug(String s) {
|
||||||
{
|
if (he.DEBUG)
|
||||||
if(he.DEBUG) System.out.println("JHexEditorASCII ==> "+s);
|
System.out.println("JHexEditorASCII ==> " + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
// calcular la posicion del raton
|
// calcular la posicion del raton
|
||||||
public int calcularPosicionRaton(int x,int y)
|
public int calcularPosicionRaton(int x, int y) {
|
||||||
{
|
|
||||||
FontMetrics fn = getFontMetrics(JHexEditor.font);
|
FontMetrics fn = getFontMetrics(JHexEditor.font);
|
||||||
x = x / (fn.stringWidth(" ") + 1);
|
x = x / (fn.stringWidth(" ") + 1);
|
||||||
y = y / fn.getHeight();
|
y = y / fn.getHeight();
|
||||||
|
@ -99,54 +96,46 @@ public class JHexEditorASCII extends JComponent implements MouseListener,KeyList
|
||||||
}
|
}
|
||||||
|
|
||||||
// mouselistener
|
// mouselistener
|
||||||
public void mouseClicked(MouseEvent e)
|
public void mouseClicked(MouseEvent e) {
|
||||||
{
|
|
||||||
debug("mouseClicked(" + e + ")");
|
debug("mouseClicked(" + e + ")");
|
||||||
he.cursor = calcularPosicionRaton(e.getX(), e.getY());
|
he.cursor = calcularPosicionRaton(e.getX(), e.getY());
|
||||||
this.requestFocus();
|
this.requestFocus();
|
||||||
he.repaint();
|
he.repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mousePressed(MouseEvent e)
|
public void mousePressed(MouseEvent e) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mouseReleased(MouseEvent e)
|
public void mouseReleased(MouseEvent e) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mouseEntered(MouseEvent e)
|
public void mouseEntered(MouseEvent e) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mouseExited(MouseEvent e)
|
public void mouseExited(MouseEvent e) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// KeyListener
|
// KeyListener
|
||||||
public void keyTyped(KeyEvent e)
|
public void keyTyped(KeyEvent e) {
|
||||||
{
|
/*
|
||||||
/*debug("keyTyped("+e+")");
|
* debug("keyTyped("+e+")");
|
||||||
|
*
|
||||||
he.buff[he.cursor]=(byte)e.getKeyChar();
|
* he.buff[he.cursor]=(byte)e.getKeyChar();
|
||||||
|
*
|
||||||
if(he.cursor!=(he.buff.length-1)) he.cursor++;
|
* if(he.cursor!=(he.buff.length-1)) he.cursor++; he.repaint();
|
||||||
he.repaint();*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public void keyPressed(KeyEvent e)
|
public void keyPressed(KeyEvent e) {
|
||||||
{
|
|
||||||
debug("keyPressed(" + e + ")");
|
debug("keyPressed(" + e + ")");
|
||||||
he.keyPressed(e);
|
he.keyPressed(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void keyReleased(KeyEvent e)
|
public void keyReleased(KeyEvent e) {
|
||||||
{
|
|
||||||
debug("keyReleased(" + e + ")");
|
debug("keyReleased(" + e + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFocusTraversable()
|
public boolean isFocusTraversable() {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,51 +5,41 @@ import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by IntelliJ IDEA.
|
* Created by IntelliJ IDEA. User: laullon Date: 09-abr-2003 Time: 12:47:32
|
||||||
* User: laullon
|
|
||||||
* Date: 09-abr-2003
|
|
||||||
* Time: 12:47:32
|
|
||||||
*/
|
*/
|
||||||
public class JHexEditorHEX extends JComponent implements MouseListener,KeyListener
|
public class JHexEditorHEX extends JComponent implements MouseListener,
|
||||||
{
|
KeyListener {
|
||||||
private static final long serialVersionUID = 1481995655372014571L;
|
private static final long serialVersionUID = 1481995655372014571L;
|
||||||
private JHexEditor he;
|
private JHexEditor he;
|
||||||
private int cursor = 0;
|
private int cursor = 0;
|
||||||
|
|
||||||
public JHexEditorHEX(JHexEditor he)
|
public JHexEditorHEX(JHexEditor he) {
|
||||||
{
|
|
||||||
this.he = he;
|
this.he = he;
|
||||||
addMouseListener(this);
|
addMouseListener(this);
|
||||||
addKeyListener(this);
|
addKeyListener(this);
|
||||||
addFocusListener(he);
|
addFocusListener(he);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public Dimension getPreferredSize()
|
/*
|
||||||
{
|
* public Dimension getPreferredSize() { debug("getPreferredSize()"); return
|
||||||
debug("getPreferredSize()");
|
* getMinimumSize(); }
|
||||||
return getMinimumSize();
|
*/
|
||||||
}*/
|
|
||||||
|
|
||||||
public Dimension getMaximumSize()
|
public Dimension getMaximumSize() {
|
||||||
{
|
|
||||||
debug("getMaximumSize()");
|
debug("getMaximumSize()");
|
||||||
return getMinimumSize();
|
return getMinimumSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public Dimension getMinimumSize()
|
/*
|
||||||
{
|
* public Dimension getMinimumSize() { debug("getMinimumSize()");
|
||||||
debug("getMinimumSize()");
|
*
|
||||||
|
* Dimension d=new Dimension(); FontMetrics fn=getFontMetrics(he.font); int
|
||||||
|
* h=fn.getHeight(); int nl=he.getLineas();
|
||||||
|
* d.setSize(((fn.stringWidth(" ")+1
|
||||||
|
* )*+((16*3)-1))+(he.border*2)+1,h*nl+(he.border*2)+1); return d; }
|
||||||
|
*/
|
||||||
|
|
||||||
Dimension d=new Dimension();
|
public void paint(Graphics g) {
|
||||||
FontMetrics fn=getFontMetrics(he.font);
|
|
||||||
int h=fn.getHeight();
|
|
||||||
int nl=he.getLineas();
|
|
||||||
d.setSize(((fn.stringWidth(" ")+1)*+((16*3)-1))+(he.border*2)+1,h*nl+(he.border*2)+1);
|
|
||||||
return d;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public void paint(Graphics g)
|
|
||||||
{
|
|
||||||
debug("paint(" + g + ")");
|
debug("paint(" + g + ")");
|
||||||
debug("cursor=" + he.cursor + " buff.length=" + he.buff.length);
|
debug("cursor=" + he.cursor + " buff.length=" + he.buff.length);
|
||||||
Dimension d = getMinimumSize();
|
Dimension d = getMinimumSize();
|
||||||
|
@ -61,52 +51,49 @@ public class JHexEditorHEX extends JComponent implements MouseListener,KeyListen
|
||||||
|
|
||||||
int ini = he.getInicio() * 16;
|
int ini = he.getInicio() * 16;
|
||||||
int fin = ini + (he.getLineas() * 16);
|
int fin = ini + (he.getLineas() * 16);
|
||||||
if(fin>he.buff.length) fin=he.buff.length;
|
if (fin > he.buff.length)
|
||||||
|
fin = he.buff.length;
|
||||||
|
|
||||||
// datos hex
|
// datos hex
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
for(int n=ini;n<fin;n++)
|
for (int n = ini; n < fin; n++) {
|
||||||
{
|
if (n == he.cursor) {
|
||||||
if(n==he.cursor)
|
if (hasFocus()) {
|
||||||
{
|
|
||||||
if(hasFocus())
|
|
||||||
{
|
|
||||||
g.setColor(Color.black);
|
g.setColor(Color.black);
|
||||||
he.fondo(g, (x * 3), y, 2);
|
he.fondo(g, (x * 3), y, 2);
|
||||||
g.setColor(Color.blue);
|
g.setColor(Color.blue);
|
||||||
he.fondo(g, (x * 3) + cursor, y, 1);
|
he.fondo(g, (x * 3) + cursor, y, 1);
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
g.setColor(Color.blue);
|
g.setColor(Color.blue);
|
||||||
he.cuadro(g, (x * 3), y, 2);
|
he.cuadro(g, (x * 3), y, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasFocus()) g.setColor(Color.white); else g.setColor(Color.black);
|
if (hasFocus())
|
||||||
} else
|
g.setColor(Color.white);
|
||||||
{
|
else
|
||||||
|
g.setColor(Color.black);
|
||||||
|
} else {
|
||||||
g.setColor(Color.black);
|
g.setColor(Color.black);
|
||||||
}
|
}
|
||||||
|
|
||||||
String s = ("0" + Integer.toHexString(he.buff[n]));
|
String s = ("0" + Integer.toHexString(he.buff[n]));
|
||||||
s = s.substring(s.length() - 2);
|
s = s.substring(s.length() - 2);
|
||||||
he.printString(g, s, ((x++) * 3), y);
|
he.printString(g, s, ((x++) * 3), y);
|
||||||
if(x==16)
|
if (x == 16) {
|
||||||
{
|
|
||||||
x = 0;
|
x = 0;
|
||||||
y++;
|
y++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void debug(String s)
|
private void debug(String s) {
|
||||||
{
|
if (he.DEBUG)
|
||||||
if(he.DEBUG) System.out.println("JHexEditorHEX ==> "+s);
|
System.out.println("JHexEditorHEX ==> " + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
// calcular la posicion del raton
|
// calcular la posicion del raton
|
||||||
public int calcularPosicionRaton(int x,int y)
|
public int calcularPosicionRaton(int x, int y) {
|
||||||
{
|
|
||||||
FontMetrics fn = getFontMetrics(JHexEditor.font);
|
FontMetrics fn = getFontMetrics(JHexEditor.font);
|
||||||
x = x / ((fn.stringWidth(" ") + 1) * 3);
|
x = x / ((fn.stringWidth(" ") + 1) * 3);
|
||||||
y = y / fn.getHeight();
|
y = y / fn.getHeight();
|
||||||
|
@ -115,64 +102,53 @@ public class JHexEditorHEX extends JComponent implements MouseListener,KeyListen
|
||||||
}
|
}
|
||||||
|
|
||||||
// mouselistener
|
// mouselistener
|
||||||
public void mouseClicked(MouseEvent e)
|
public void mouseClicked(MouseEvent e) {
|
||||||
{
|
|
||||||
debug("mouseClicked(" + e + ")");
|
debug("mouseClicked(" + e + ")");
|
||||||
he.cursor = calcularPosicionRaton(e.getX(), e.getY());
|
he.cursor = calcularPosicionRaton(e.getX(), e.getY());
|
||||||
this.requestFocus();
|
this.requestFocus();
|
||||||
he.repaint();
|
he.repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mousePressed(MouseEvent e)
|
public void mousePressed(MouseEvent e) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mouseReleased(MouseEvent e)
|
public void mouseReleased(MouseEvent e) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mouseEntered(MouseEvent e)
|
public void mouseEntered(MouseEvent e) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mouseExited(MouseEvent e)
|
public void mouseExited(MouseEvent e) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// KeyListener
|
// KeyListener
|
||||||
public void keyTyped(KeyEvent e)
|
public void keyTyped(KeyEvent e) {
|
||||||
{
|
|
||||||
debug("keyTyped(" + e + ")");
|
debug("keyTyped(" + e + ")");
|
||||||
|
|
||||||
/*char c=e.getKeyChar();
|
/*
|
||||||
if(((c>='0')&&(c<='9'))||((c>='A')&&(c<='F'))||((c>='a')&&(c<='f')))
|
* char c=e.getKeyChar();
|
||||||
{
|
* if(((c>='0')&&(c<='9'))||((c>='A')&&(c<='F'))||((c>='a')&&(c<='f')))
|
||||||
char[] str=new char[2];
|
* { char[] str=new char[2]; String
|
||||||
String n="00"+Integer.toHexString((int)he.buff[he.cursor]);
|
* n="00"+Integer.toHexString((int)he.buff[he.cursor]); if(n.length()>2)
|
||||||
if(n.length()>2) n=n.substring(n.length()-2);
|
* n=n.substring(n.length()-2); str[1-cursor]=n.charAt(1-cursor);
|
||||||
str[1-cursor]=n.charAt(1-cursor);
|
* str[cursor]=e.getKeyChar();
|
||||||
str[cursor]=e.getKeyChar();
|
* he.buff[he.cursor]=(byte)Integer.parseInt(new String(str),16);
|
||||||
he.buff[he.cursor]=(byte)Integer.parseInt(new String(str),16);
|
*
|
||||||
|
* if(cursor!=1) cursor=1; else if(he.cursor!=(he.buff.length-1)){
|
||||||
if(cursor!=1) cursor=1;
|
* he.cursor++; cursor=0;} he.actualizaCursor(); }
|
||||||
else if(he.cursor!=(he.buff.length-1)){ he.cursor++; cursor=0;}
|
*/
|
||||||
he.actualizaCursor();
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void keyPressed(KeyEvent e)
|
public void keyPressed(KeyEvent e) {
|
||||||
{
|
|
||||||
debug("keyPressed(" + e + ")");
|
debug("keyPressed(" + e + ")");
|
||||||
he.keyPressed(e);
|
he.keyPressed(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void keyReleased(KeyEvent e)
|
public void keyReleased(KeyEvent e) {
|
||||||
{
|
|
||||||
debug("keyReleased(" + e + ")");
|
debug("keyReleased(" + e + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFocusTraversable()
|
public boolean isFocusTraversable() {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,8 @@ public class DiskReader {
|
||||||
/**
|
/**
|
||||||
* Used to load from file, allows caching
|
* Used to load from file, allows caching
|
||||||
*/
|
*/
|
||||||
public synchronized static ArrayList<String> loadArrayList(String fileName, boolean cache) {
|
public synchronized static ArrayList<String> loadArrayList(String fileName,
|
||||||
|
boolean cache) {
|
||||||
ArrayList<String> array = new ArrayList<String>();
|
ArrayList<String> array = new ArrayList<String>();
|
||||||
if (!map.containsKey(fileName)) {
|
if (!map.containsKey(fileName)) {
|
||||||
try {
|
try {
|
||||||
|
@ -54,10 +55,12 @@ public class DiskReader {
|
||||||
/**
|
/**
|
||||||
* Used to load from file
|
* Used to load from file
|
||||||
*/
|
*/
|
||||||
public synchronized static String loadAsString(String fileName) throws Exception {
|
public synchronized static String loadAsString(String fileName)
|
||||||
|
throws Exception {
|
||||||
String s = "";
|
String s = "";
|
||||||
|
|
||||||
BufferedReader reader = new BufferedReader(new FileReader(new File(fileName)));
|
BufferedReader reader = new BufferedReader(new FileReader(new File(
|
||||||
|
fileName)));
|
||||||
String add;
|
String add;
|
||||||
|
|
||||||
while ((add = reader.readLine()) != null)
|
while ((add = reader.readLine()) != null)
|
||||||
|
@ -69,10 +72,10 @@ public class DiskReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to load a string via line number
|
* Used to load a string via line number lineNumber = -1 means random.
|
||||||
* lineNumber = -1 means random.
|
|
||||||
*/
|
*/
|
||||||
public static String loadString(String fileName, int lineNumber, boolean cache) throws Exception {
|
public static String loadString(String fileName, int lineNumber,
|
||||||
|
boolean cache) throws Exception {
|
||||||
|
|
||||||
ArrayList<String> array;
|
ArrayList<String> array;
|
||||||
if (!map.containsKey(fileName)) {
|
if (!map.containsKey(fileName)) {
|
||||||
|
|
|
@ -16,9 +16,13 @@ public class DiskWriter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to insert a difference string with preserving the file extension
|
* Used to insert a difference string with preserving the file extension
|
||||||
* @param fileName The file name
|
*
|
||||||
* @param difference Normally an integer
|
* @param fileName
|
||||||
* @return The filename with the difference inserted and the file extension preserved
|
* The file name
|
||||||
|
* @param difference
|
||||||
|
* Normally an integer
|
||||||
|
* @return The filename with the difference inserted and the file extension
|
||||||
|
* preserved
|
||||||
*/
|
*/
|
||||||
public static String insertFileName(String fileName, String difference) {
|
public static String insertFileName(String fileName, String difference) {
|
||||||
String[] babe = fileName.split("\\.");
|
String[] babe = fileName.split("\\.");
|
||||||
|
@ -39,12 +43,15 @@ public class DiskWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a new line to the file, if it doesn't exist it will automatically create it.
|
* Writes a new line to the file, if it doesn't exist it will automatically
|
||||||
|
* create it.
|
||||||
|
*
|
||||||
* @param filename
|
* @param filename
|
||||||
* @param fileContents
|
* @param fileContents
|
||||||
* @param debug
|
* @param debug
|
||||||
*/
|
*/
|
||||||
public static synchronized void writeNewLine(String filename, byte[] fileContents, boolean debug) {
|
public static synchronized void writeNewLine(String filename,
|
||||||
|
byte[] fileContents, boolean debug) {
|
||||||
PrintWriter writer = null;
|
PrintWriter writer = null;
|
||||||
String original = filename;
|
String original = filename;
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
|
@ -52,14 +59,16 @@ public class DiskWriter {
|
||||||
boolean saved = false;
|
boolean saved = false;
|
||||||
while (!saved) {
|
while (!saved) {
|
||||||
try {
|
try {
|
||||||
writer = new PrintWriter(new BufferedWriter(new FileWriter(filename, true)));
|
writer = new PrintWriter(new BufferedWriter(new FileWriter(
|
||||||
|
filename, true)));
|
||||||
writer.println(fileContents);
|
writer.println(fileContents);
|
||||||
if (debug)
|
if (debug)
|
||||||
System.out.println("Saved " + filename + " to disk");
|
System.out.println("Saved " + filename + " to disk");
|
||||||
saved = true;
|
saved = true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (debug)
|
if (debug)
|
||||||
System.out.println("Failed saving, trying to save as " + filename);
|
System.out.println("Failed saving, trying to save as "
|
||||||
|
+ filename);
|
||||||
if (original.contains(".")) {
|
if (original.contains(".")) {
|
||||||
filename = insertFileName(original, "" + counter);
|
filename = insertFileName(original, "" + counter);
|
||||||
} else
|
} else
|
||||||
|
@ -72,11 +81,13 @@ public class DiskWriter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a string to the file
|
* Writes a string to the file
|
||||||
|
*
|
||||||
* @param filename
|
* @param filename
|
||||||
* @param lineToWrite
|
* @param lineToWrite
|
||||||
* @param debug
|
* @param debug
|
||||||
*/
|
*/
|
||||||
public static synchronized void writeNewLine(String filename, String lineToWrite, boolean debug) {
|
public static synchronized void writeNewLine(String filename,
|
||||||
|
String lineToWrite, boolean debug) {
|
||||||
PrintWriter writer = null;
|
PrintWriter writer = null;
|
||||||
String original = filename;
|
String original = filename;
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
|
@ -84,14 +95,17 @@ public class DiskWriter {
|
||||||
boolean saved = false;
|
boolean saved = false;
|
||||||
while (!saved) {
|
while (!saved) {
|
||||||
try {
|
try {
|
||||||
writer = new PrintWriter(new BufferedWriter(new FileWriter(filename, true)));
|
writer = new PrintWriter(new BufferedWriter(new FileWriter(
|
||||||
|
filename, true)));
|
||||||
writer.println(lineToWrite);
|
writer.println(lineToWrite);
|
||||||
if (debug)
|
if (debug)
|
||||||
System.out.println("Saved " + filename+">"+lineToWrite + " to disk");
|
System.out.println("Saved " + filename + ">" + lineToWrite
|
||||||
|
+ " to disk");
|
||||||
saved = true;
|
saved = true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (debug)
|
if (debug)
|
||||||
System.out.println("Failed saving, trying to save as " + filename);
|
System.out.println("Failed saving, trying to save as "
|
||||||
|
+ filename);
|
||||||
if (original.contains(".")) {
|
if (original.contains(".")) {
|
||||||
filename = insertFileName(original, "" + counter);
|
filename = insertFileName(original, "" + counter);
|
||||||
} else
|
} else
|
||||||
|
@ -103,12 +117,15 @@ public class DiskWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the original file if it exists, then writes the fileContents[] to the file.
|
* Deletes the original file if it exists, then writes the fileContents[] to
|
||||||
|
* the file.
|
||||||
|
*
|
||||||
* @param filename
|
* @param filename
|
||||||
* @param fileContents
|
* @param fileContents
|
||||||
* @param debug
|
* @param debug
|
||||||
*/
|
*/
|
||||||
public static synchronized void replaceFile(String filename, byte[] fileContents, boolean debug) {
|
public static synchronized void replaceFile(String filename,
|
||||||
|
byte[] fileContents, boolean debug) {
|
||||||
File f = new File(filename);
|
File f = new File(filename);
|
||||||
if (f.exists())
|
if (f.exists())
|
||||||
f.delete();
|
f.delete();
|
||||||
|
@ -119,14 +136,16 @@ public class DiskWriter {
|
||||||
boolean saved = false;
|
boolean saved = false;
|
||||||
while (!saved) {
|
while (!saved) {
|
||||||
try {
|
try {
|
||||||
writer = new PrintWriter(new BufferedWriter(new FileWriter(filename, true)));
|
writer = new PrintWriter(new BufferedWriter(new FileWriter(
|
||||||
|
filename, true)));
|
||||||
writer.println(fileContents);
|
writer.println(fileContents);
|
||||||
if (debug)
|
if (debug)
|
||||||
System.out.println("Saved " + filename + " to disk");
|
System.out.println("Saved " + filename + " to disk");
|
||||||
saved = true;
|
saved = true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (debug)
|
if (debug)
|
||||||
System.out.println("Failed saving, trying to save as " + filename);
|
System.out.println("Failed saving, trying to save as "
|
||||||
|
+ filename);
|
||||||
if (original.contains(".")) {
|
if (original.contains(".")) {
|
||||||
filename = insertFileName(original, "" + counter);
|
filename = insertFileName(original, "" + counter);
|
||||||
} else
|
} else
|
||||||
|
@ -138,12 +157,15 @@ public class DiskWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the original file if it exists, then writes the lineToWrite to the file.
|
* Deletes the original file if it exists, then writes the lineToWrite to
|
||||||
|
* the file.
|
||||||
|
*
|
||||||
* @param filename
|
* @param filename
|
||||||
* @param lineToWrite
|
* @param lineToWrite
|
||||||
* @param debug
|
* @param debug
|
||||||
*/
|
*/
|
||||||
public static synchronized void replaceFile(String filename, String lineToWrite, boolean debug) {
|
public static synchronized void replaceFile(String filename,
|
||||||
|
String lineToWrite, boolean debug) {
|
||||||
File f = new File(filename);
|
File f = new File(filename);
|
||||||
if (f.exists())
|
if (f.exists())
|
||||||
f.delete();
|
f.delete();
|
||||||
|
@ -154,14 +176,17 @@ public class DiskWriter {
|
||||||
boolean saved = false;
|
boolean saved = false;
|
||||||
while (!saved) {
|
while (!saved) {
|
||||||
try {
|
try {
|
||||||
writer = new PrintWriter(new BufferedWriter(new FileWriter(filename, true)));
|
writer = new PrintWriter(new BufferedWriter(new FileWriter(
|
||||||
|
filename, true)));
|
||||||
writer.println(lineToWrite);
|
writer.println(lineToWrite);
|
||||||
if (debug)
|
if (debug)
|
||||||
System.out.println("Saved " + filename+">"+lineToWrite + " to disk");
|
System.out.println("Saved " + filename + ">" + lineToWrite
|
||||||
|
+ " to disk");
|
||||||
saved = true;
|
saved = true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (debug)
|
if (debug)
|
||||||
System.out.println("Failed saving, trying to save as " + filename + "_");
|
System.out.println("Failed saving, trying to save as "
|
||||||
|
+ filename + "_");
|
||||||
if (original.contains(".")) {
|
if (original.contains(".")) {
|
||||||
filename = insertFileName(original, "" + counter);
|
filename = insertFileName(original, "" + counter);
|
||||||
} else
|
} else
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -70,8 +70,10 @@ public class FileDrop {
|
||||||
* elements contained within as drop targets, though only the top level
|
* elements contained within as drop targets, though only the top level
|
||||||
* container will change borders.
|
* container will change borders.
|
||||||
*
|
*
|
||||||
* @param c Component on which files will be dropped.
|
* @param c
|
||||||
* @param listener Listens for <tt>filesDropped</tt>.
|
* Component on which files will be dropped.
|
||||||
|
* @param listener
|
||||||
|
* Listens for <tt>filesDropped</tt>.
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public FileDrop(final java.awt.Component c, final Listener listener) {
|
public FileDrop(final java.awt.Component c, final Listener listener) {
|
||||||
|
@ -89,9 +91,12 @@ public class FileDrop {
|
||||||
* its children components will also listen for drops, though only the
|
* its children components will also listen for drops, though only the
|
||||||
* parent will change borders.
|
* parent will change borders.
|
||||||
*
|
*
|
||||||
* @param c Component on which files will be dropped.
|
* @param c
|
||||||
* @param recursive Recursively set children as drop targets.
|
* Component on which files will be dropped.
|
||||||
* @param listener Listens for <tt>filesDropped</tt>.
|
* @param recursive
|
||||||
|
* Recursively set children as drop targets.
|
||||||
|
* @param listener
|
||||||
|
* Listens for <tt>filesDropped</tt>.
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public FileDrop(final java.awt.Component c, final boolean recursive,
|
public FileDrop(final java.awt.Component c, final boolean recursive,
|
||||||
|
@ -111,10 +116,13 @@ public class FileDrop {
|
||||||
* <tt>System.out</tt> or <tt>System.err</tt>. A <tt>null</tt> value for the
|
* <tt>System.out</tt> or <tt>System.err</tt>. A <tt>null</tt> value for the
|
||||||
* parameter <tt>out</tt> will result in no debugging output.
|
* parameter <tt>out</tt> will result in no debugging output.
|
||||||
*
|
*
|
||||||
* @param out PrintStream to record debugging info or null for no debugging.
|
|
||||||
* @param out
|
* @param out
|
||||||
* @param c Component on which files will be dropped.
|
* PrintStream to record debugging info or null for no debugging.
|
||||||
* @param listener Listens for <tt>filesDropped</tt>.
|
* @param out
|
||||||
|
* @param c
|
||||||
|
* Component on which files will be dropped.
|
||||||
|
* @param listener
|
||||||
|
* Listens for <tt>filesDropped</tt>.
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public FileDrop(final java.io.PrintStream out, final java.awt.Component c,
|
public FileDrop(final java.io.PrintStream out, final java.awt.Component c,
|
||||||
|
@ -136,11 +144,15 @@ public class FileDrop {
|
||||||
* <tt>System.out</tt> or <tt>System.err</tt>. A <tt>null</tt> value for the
|
* <tt>System.out</tt> or <tt>System.err</tt>. A <tt>null</tt> value for the
|
||||||
* parameter <tt>out</tt> will result in no debugging output.
|
* parameter <tt>out</tt> will result in no debugging output.
|
||||||
*
|
*
|
||||||
* @param out PrintStream to record debugging info or null for no debugging.
|
|
||||||
* @param out
|
* @param out
|
||||||
* @param c Component on which files will be dropped.
|
* PrintStream to record debugging info or null for no debugging.
|
||||||
* @param recursive Recursively set children as drop targets.
|
* @param out
|
||||||
* @param listener Listens for <tt>filesDropped</tt>.
|
* @param c
|
||||||
|
* Component on which files will be dropped.
|
||||||
|
* @param recursive
|
||||||
|
* Recursively set children as drop targets.
|
||||||
|
* @param listener
|
||||||
|
* Listens for <tt>filesDropped</tt>.
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public FileDrop(final java.io.PrintStream out, final java.awt.Component c,
|
public FileDrop(final java.io.PrintStream out, final java.awt.Component c,
|
||||||
|
@ -156,10 +168,12 @@ public class FileDrop {
|
||||||
/**
|
/**
|
||||||
* Constructor with a specified border
|
* Constructor with a specified border
|
||||||
*
|
*
|
||||||
* @param c Component on which files will be dropped.
|
* @param c
|
||||||
* @param dragBorder Border to use on <tt>JComponent</tt> when dragging
|
* Component on which files will be dropped.
|
||||||
* occurs.
|
* @param dragBorder
|
||||||
* @param listener Listens for <tt>filesDropped</tt>.
|
* Border to use on <tt>JComponent</tt> when dragging occurs.
|
||||||
|
* @param listener
|
||||||
|
* Listens for <tt>filesDropped</tt>.
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public FileDrop(final java.awt.Component c,
|
public FileDrop(final java.awt.Component c,
|
||||||
|
@ -177,11 +191,14 @@ public class FileDrop {
|
||||||
* each of its children components will also listen for drops, though only
|
* each of its children components will also listen for drops, though only
|
||||||
* the parent will change borders.
|
* the parent will change borders.
|
||||||
*
|
*
|
||||||
* @param c Component on which files will be dropped.
|
* @param c
|
||||||
* @param dragBorder Border to use on <tt>JComponent</tt> when dragging
|
* Component on which files will be dropped.
|
||||||
* occurs.
|
* @param dragBorder
|
||||||
* @param recursive Recursively set children as drop targets.
|
* Border to use on <tt>JComponent</tt> when dragging occurs.
|
||||||
* @param listener Listens for <tt>filesDropped</tt>.
|
* @param recursive
|
||||||
|
* Recursively set children as drop targets.
|
||||||
|
* @param listener
|
||||||
|
* Listens for <tt>filesDropped</tt>.
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public FileDrop(final java.awt.Component c,
|
public FileDrop(final java.awt.Component c,
|
||||||
|
@ -197,11 +214,14 @@ public class FileDrop {
|
||||||
* <tt>System.out</tt> or <tt>System.err</tt>. A <tt>null</tt> value for the
|
* <tt>System.out</tt> or <tt>System.err</tt>. A <tt>null</tt> value for the
|
||||||
* parameter <tt>out</tt> will result in no debugging output.
|
* parameter <tt>out</tt> will result in no debugging output.
|
||||||
*
|
*
|
||||||
* @param out PrintStream to record debugging info or null for no debugging.
|
* @param out
|
||||||
* @param c Component on which files will be dropped.
|
* PrintStream to record debugging info or null for no debugging.
|
||||||
* @param dragBorder Border to use on <tt>JComponent</tt> when dragging
|
* @param c
|
||||||
* occurs.
|
* Component on which files will be dropped.
|
||||||
* @param listener Listens for <tt>filesDropped</tt>.
|
* @param dragBorder
|
||||||
|
* Border to use on <tt>JComponent</tt> when dragging occurs.
|
||||||
|
* @param listener
|
||||||
|
* Listens for <tt>filesDropped</tt>.
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public FileDrop(final java.io.PrintStream out, final java.awt.Component c,
|
public FileDrop(final java.io.PrintStream out, final java.awt.Component c,
|
||||||
|
@ -220,12 +240,16 @@ public class FileDrop {
|
||||||
* <tt>System.out</tt> or <tt>System.err</tt>. A <tt>null</tt> value for the
|
* <tt>System.out</tt> or <tt>System.err</tt>. A <tt>null</tt> value for the
|
||||||
* parameter <tt>out</tt> will result in no debugging output.
|
* parameter <tt>out</tt> will result in no debugging output.
|
||||||
*
|
*
|
||||||
* @param out PrintStream to record debugging info or null for no debugging.
|
* @param out
|
||||||
* @param c Component on which files will be dropped.
|
* PrintStream to record debugging info or null for no debugging.
|
||||||
* @param dragBorder Border to use on <tt>JComponent</tt> when dragging
|
* @param c
|
||||||
* occurs.
|
* Component on which files will be dropped.
|
||||||
* @param recursive Recursively set children as drop targets.
|
* @param dragBorder
|
||||||
* @param listener Listens for <tt>filesDropped</tt>.
|
* Border to use on <tt>JComponent</tt> when dragging occurs.
|
||||||
|
* @param recursive
|
||||||
|
* Recursively set children as drop targets.
|
||||||
|
* @param listener
|
||||||
|
* Listens for <tt>filesDropped</tt>.
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public FileDrop(final java.io.PrintStream out, final java.awt.Component c,
|
public FileDrop(final java.io.PrintStream out, final java.awt.Component c,
|
||||||
|
@ -293,7 +317,8 @@ public class FileDrop {
|
||||||
// Get a useful list
|
// Get a useful list
|
||||||
final java.util.List fileList = (java.util.List) tr
|
final java.util.List fileList = (java.util.List) tr
|
||||||
.getTransferData(java.awt.datatransfer.DataFlavor.javaFileListFlavor);
|
.getTransferData(java.awt.datatransfer.DataFlavor.javaFileListFlavor);
|
||||||
final java.util.Iterator iterator = fileList.iterator();
|
final java.util.Iterator iterator = fileList
|
||||||
|
.iterator();
|
||||||
|
|
||||||
// Convert list to array
|
// Convert list to array
|
||||||
final java.io.File[] filesTemp = new java.io.File[fileList
|
final java.io.File[] filesTemp = new java.io.File[fileList
|
||||||
|
@ -363,7 +388,8 @@ public class FileDrop {
|
||||||
catch (final java.awt.datatransfer.UnsupportedFlavorException ufe) {
|
catch (final java.awt.datatransfer.UnsupportedFlavorException ufe) {
|
||||||
log(out,
|
log(out,
|
||||||
"FileDrop: UnsupportedFlavorException - abort:");
|
"FileDrop: UnsupportedFlavorException - abort:");
|
||||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(ufe);
|
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(
|
||||||
|
ufe);
|
||||||
evt.rejectDrop();
|
evt.rejectDrop();
|
||||||
} // end catch: UnsupportedFlavorException
|
} // end catch: UnsupportedFlavorException
|
||||||
finally {
|
finally {
|
||||||
|
@ -562,7 +588,8 @@ public class FileDrop {
|
||||||
* all components contained within <var>c</var> if <var>c</var> is a
|
* all components contained within <var>c</var> if <var>c</var> is a
|
||||||
* {@link java.awt.Container}.
|
* {@link java.awt.Container}.
|
||||||
*
|
*
|
||||||
* @param c The component to unregister as a drop target
|
* @param c
|
||||||
|
* The component to unregister as a drop target
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public static boolean remove(final java.awt.Component c) {
|
public static boolean remove(final java.awt.Component c) {
|
||||||
|
@ -574,15 +601,19 @@ public class FileDrop {
|
||||||
* the all children. You should call this if you add and remove components
|
* the all children. You should call this if you add and remove components
|
||||||
* after you've set up the drag-and-drop.
|
* after you've set up the drag-and-drop.
|
||||||
*
|
*
|
||||||
* @param out Optional {@link java.io.PrintStream} for logging drag and drop
|
* @param out
|
||||||
|
* Optional {@link java.io.PrintStream} for logging drag and drop
|
||||||
* messages
|
* messages
|
||||||
* @param c The component to unregister
|
* @param c
|
||||||
* @param recursive Recursively unregister components within a container
|
* The component to unregister
|
||||||
|
* @param recursive
|
||||||
|
* Recursively unregister components within a container
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public static boolean remove(final java.io.PrintStream out,
|
public static boolean remove(final java.io.PrintStream out,
|
||||||
final java.awt.Component c, final boolean recursive) { // Make sure
|
final java.awt.Component c, final boolean recursive) { // Make sure
|
||||||
// we support
|
// we
|
||||||
|
// support
|
||||||
// dnd.
|
// dnd.
|
||||||
if (supportsDnD()) {
|
if (supportsDnD()) {
|
||||||
log(out, "FileDrop: Removing drag-and-drop hooks.");
|
log(out, "FileDrop: Removing drag-and-drop hooks.");
|
||||||
|
@ -623,7 +654,8 @@ public class FileDrop {
|
||||||
/**
|
/**
|
||||||
* This method is called when files have been successfully dropped.
|
* This method is called when files have been successfully dropped.
|
||||||
*
|
*
|
||||||
* @param files An array of <tt>File</tt>s that were dropped.
|
* @param files
|
||||||
|
* An array of <tt>File</tt>s that were dropped.
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public abstract void filesDropped(java.io.File[] files);
|
public abstract void filesDropped(java.io.File[] files);
|
||||||
|
@ -655,7 +687,8 @@ public class FileDrop {
|
||||||
* Constructs an {@link Event} with the array of files that were dropped
|
* Constructs an {@link Event} with the array of files that were dropped
|
||||||
* and the {@link FileDrop} that initiated the event.
|
* and the {@link FileDrop} that initiated the event.
|
||||||
*
|
*
|
||||||
* @param files The array of files that were dropped
|
* @param files
|
||||||
|
* The array of files that were dropped
|
||||||
* @source The event source
|
* @source The event source
|
||||||
* @since 1.1
|
* @since 1.1
|
||||||
*/
|
*/
|
||||||
|
@ -761,7 +794,8 @@ public class FileDrop {
|
||||||
* from <code>data.getClass()</code> and the MIME type
|
* from <code>data.getClass()</code> and the MIME type
|
||||||
* <tt>application/x-net.iharder.dnd.TransferableObject</tt>.
|
* <tt>application/x-net.iharder.dnd.TransferableObject</tt>.
|
||||||
*
|
*
|
||||||
* @param data The data to transfer
|
* @param data
|
||||||
|
* The data to transfer
|
||||||
* @since 1.1
|
* @since 1.1
|
||||||
*/
|
*/
|
||||||
public TransferableObject(final Object data) {
|
public TransferableObject(final Object data) {
|
||||||
|
@ -776,7 +810,8 @@ public class FileDrop {
|
||||||
* other than the default {@link #DATA_FLAVOR}.
|
* other than the default {@link #DATA_FLAVOR}.
|
||||||
*
|
*
|
||||||
* @see Fetcher
|
* @see Fetcher
|
||||||
* @param fetcher The {@link Fetcher} that will return the data object
|
* @param fetcher
|
||||||
|
* The {@link Fetcher} that will return the data object
|
||||||
* @since 1.1
|
* @since 1.1
|
||||||
*/
|
*/
|
||||||
public TransferableObject(final Fetcher fetcher) {
|
public TransferableObject(final Fetcher fetcher) {
|
||||||
|
@ -792,9 +827,11 @@ public class FileDrop {
|
||||||
* <tt>application/x-net.iharder.dnd.TransferableObject</tt>.
|
* <tt>application/x-net.iharder.dnd.TransferableObject</tt>.
|
||||||
*
|
*
|
||||||
* @see Fetcher
|
* @see Fetcher
|
||||||
* @param dataClass The {@link java.lang.Class} to use in the custom
|
* @param dataClass
|
||||||
* data flavor
|
* The {@link java.lang.Class} to use in the custom data
|
||||||
* @param fetcher The {@link Fetcher} that will return the data object
|
* flavor
|
||||||
|
* @param fetcher
|
||||||
|
* The {@link Fetcher} that will return the data object
|
||||||
* @since 1.1
|
* @since 1.1
|
||||||
*/
|
*/
|
||||||
public TransferableObject(final Class dataClass, final Fetcher fetcher) {
|
public TransferableObject(final Class dataClass, final Fetcher fetcher) {
|
||||||
|
@ -849,7 +886,8 @@ public class FileDrop {
|
||||||
* requested data flavor is not supported, then the
|
* requested data flavor is not supported, then the
|
||||||
* {@link Fetcher#getObject getObject()} method will not be called.
|
* {@link Fetcher#getObject getObject()} method will not be called.
|
||||||
*
|
*
|
||||||
* @param flavor The data flavor for the data to return
|
* @param flavor
|
||||||
|
* The data flavor for the data to return
|
||||||
* @return The dropped data
|
* @return The dropped data
|
||||||
* @since 1.1
|
* @since 1.1
|
||||||
*/
|
*/
|
||||||
|
@ -875,7 +913,8 @@ public class FileDrop {
|
||||||
* flavors. Flavors are supported using the <code>equals(...)</code>
|
* flavors. Flavors are supported using the <code>equals(...)</code>
|
||||||
* method.
|
* method.
|
||||||
*
|
*
|
||||||
* @param flavor The data flavor to check
|
* @param flavor
|
||||||
|
* The data flavor to check
|
||||||
* @return Whether or not the flavor is supported
|
* @return Whether or not the flavor is supported
|
||||||
* @since 1.1
|
* @since 1.1
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -30,7 +30,9 @@ public class JarUtils {
|
||||||
|
|
||||||
private static JarInputStream jis;
|
private static JarInputStream jis;
|
||||||
private static JarEntry entry;
|
private static JarEntry entry;
|
||||||
public static void put(final File jarFile, final HashMap<String, ClassNode> clazzList) throws IOException {
|
|
||||||
|
public static void put(final File jarFile,
|
||||||
|
final HashMap<String, ClassNode> clazzList) throws IOException {
|
||||||
jis = new JarInputStream(new FileInputStream(jarFile));
|
jis = new JarInputStream(new FileInputStream(jarFile));
|
||||||
while ((entry = jis.getNextJarEntry()) != null) {
|
while ((entry = jis.getNextJarEntry()) != null) {
|
||||||
final String name = entry.getName();
|
final String name = entry.getName();
|
||||||
|
@ -52,6 +54,7 @@ public class JarUtils {
|
||||||
private static ByteArrayOutputStream baos = null;
|
private static ByteArrayOutputStream baos = null;
|
||||||
private static byte[] buffer = null;
|
private static byte[] buffer = null;
|
||||||
private static int a = 0;
|
private static int a = 0;
|
||||||
|
|
||||||
public static byte[] getBytes(final InputStream is) throws IOException {
|
public static byte[] getBytes(final InputStream is) throws IOException {
|
||||||
baos = new ByteArrayOutputStream();
|
baos = new ByteArrayOutputStream();
|
||||||
buffer = new byte[1024];
|
buffer = new byte[1024];
|
||||||
|
@ -66,17 +69,24 @@ public class JarUtils {
|
||||||
|
|
||||||
private static ClassReader cr = null;
|
private static ClassReader cr = null;
|
||||||
private static ClassNode cn = null;
|
private static ClassNode cn = null;
|
||||||
|
|
||||||
public static ClassNode getNode(final byte[] bytez) {
|
public static ClassNode getNode(final byte[] bytez) {
|
||||||
cr = new ClassReader(bytez);
|
cr = new ClassReader(bytez);
|
||||||
cn = new ClassNode();
|
cn = new ClassNode();
|
||||||
|
try {
|
||||||
cr.accept(cn, ClassReader.EXPAND_FRAMES);
|
cr.accept(cn, ClassReader.EXPAND_FRAMES);
|
||||||
|
} catch (Exception e) {
|
||||||
|
cr.accept(cn, ClassReader.SKIP_FRAMES);
|
||||||
|
}
|
||||||
cr = null;
|
cr = null;
|
||||||
return cn;
|
return cn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void saveAsJar(ArrayList<ClassNode> nodeList, String path, String manifest) {
|
public static void saveAsJar(ArrayList<ClassNode> nodeList, String path,
|
||||||
|
String manifest) {
|
||||||
try {
|
try {
|
||||||
JarOutputStream out = new JarOutputStream(new FileOutputStream(path));
|
JarOutputStream out = new JarOutputStream(
|
||||||
|
new FileOutputStream(path));
|
||||||
for (ClassNode cn : nodeList) {
|
for (ClassNode cn : nodeList) {
|
||||||
ClassWriter cw = new ClassWriter(0);
|
ClassWriter cw = new ClassWriter(0);
|
||||||
cn.accept(cw);
|
cn.accept(cw);
|
||||||
|
@ -90,7 +100,8 @@ public class JarUtils {
|
||||||
out.write((manifest.trim() + "\r\n\r\n").getBytes());
|
out.write((manifest.trim() + "\r\n\r\n").getBytes());
|
||||||
out.closeEntry();
|
out.closeEntry();
|
||||||
|
|
||||||
for (Entry<String, byte[]> entry : BytecodeViewer.loadedResources.entrySet()) {
|
for (Entry<String, byte[]> entry : BytecodeViewer.loadedResources
|
||||||
|
.entrySet()) {
|
||||||
String filename = entry.getKey();
|
String filename = entry.getKey();
|
||||||
if (!filename.startsWith("META-INF")) {
|
if (!filename.startsWith("META-INF")) {
|
||||||
out.putNextEntry(new ZipEntry(filename));
|
out.putNextEntry(new ZipEntry(filename));
|
||||||
|
@ -107,7 +118,8 @@ public class JarUtils {
|
||||||
|
|
||||||
public static void saveAsJar(ArrayList<ClassNode> nodeList, String path) {
|
public static void saveAsJar(ArrayList<ClassNode> nodeList, String path) {
|
||||||
try {
|
try {
|
||||||
JarOutputStream out = new JarOutputStream(new FileOutputStream(path));
|
JarOutputStream out = new JarOutputStream(
|
||||||
|
new FileOutputStream(path));
|
||||||
for (ClassNode cn : nodeList) {
|
for (ClassNode cn : nodeList) {
|
||||||
ClassWriter cw = new ClassWriter(0);
|
ClassWriter cw = new ClassWriter(0);
|
||||||
cn.accept(cw);
|
cn.accept(cw);
|
||||||
|
@ -117,7 +129,8 @@ public class JarUtils {
|
||||||
out.closeEntry();
|
out.closeEntry();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Entry<String, byte[]> entry : BytecodeViewer.loadedResources.entrySet()) {
|
for (Entry<String, byte[]> entry : BytecodeViewer.loadedResources
|
||||||
|
.entrySet()) {
|
||||||
String filename = entry.getKey();
|
String filename = entry.getKey();
|
||||||
if (!filename.startsWith("META-INF")) {
|
if (!filename.startsWith("META-INF")) {
|
||||||
out.putNextEntry(new ZipEntry(filename));
|
out.putNextEntry(new ZipEntry(filename));
|
||||||
|
|
|
@ -40,95 +40,68 @@ public class RuntimeOverride {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public Process exec(String command, String[] envp) throws IOException {
|
/*
|
||||||
return exec(command, envp, null);
|
* public Process exec(String command, String[] envp) throws IOException {
|
||||||
}
|
* return exec(command, envp, null); }
|
||||||
|
*
|
||||||
public Process exec(String command, String[] envp, File dir)
|
* public Process exec(String command, String[] envp, File dir) throws
|
||||||
throws IOException {
|
* IOException { if (command.length() == 0) throw new
|
||||||
if (command.length() == 0)
|
* IllegalArgumentException("Empty command");
|
||||||
throw new IllegalArgumentException("Empty command");
|
*
|
||||||
|
* StringTokenizer st = new StringTokenizer(command); String[] cmdarray =
|
||||||
StringTokenizer st = new StringTokenizer(command);
|
* new String[st.countTokens()]; for (int i = 0; st.hasMoreTokens(); i++)
|
||||||
String[] cmdarray = new String[st.countTokens()];
|
* cmdarray[i] = st.nextToken(); return exec(cmdarray, envp, dir); }
|
||||||
for (int i = 0; st.hasMoreTokens(); i++)
|
*
|
||||||
cmdarray[i] = st.nextToken();
|
* public Process exec(String cmdarray[]) throws IOException { return
|
||||||
return exec(cmdarray, envp, dir);
|
* exec(cmdarray, null, null); }
|
||||||
}
|
*
|
||||||
|
* public Process exec(String[] cmdarray, String[] envp) throws IOException
|
||||||
public Process exec(String cmdarray[]) throws IOException {
|
* { return exec(cmdarray, envp, null); }
|
||||||
return exec(cmdarray, null, null);
|
*
|
||||||
}
|
* public Process exec(String[] cmdarray, String[] envp, File dir) throws
|
||||||
|
* IOException { return new ProcessBuilder(cmdarray) .environment(envp)
|
||||||
public Process exec(String[] cmdarray, String[] envp) throws IOException {
|
* .directory(dir) .start(); }
|
||||||
return exec(cmdarray, envp, null);
|
*
|
||||||
}
|
* public native int availableProcessors();
|
||||||
|
*
|
||||||
public Process exec(String[] cmdarray, String[] envp, File dir)
|
* public native long freeMemory();
|
||||||
throws IOException {
|
*
|
||||||
return new ProcessBuilder(cmdarray)
|
* public native long totalMemory();
|
||||||
.environment(envp)
|
*
|
||||||
.directory(dir)
|
* public native long maxMemory();
|
||||||
.start();
|
*
|
||||||
}
|
* public void gc() { Runtime.getRuntime().gc(); }
|
||||||
|
*
|
||||||
public native int availableProcessors();
|
* public void runFinalization() { Runtime.getRuntime().runFinalization(); }
|
||||||
|
*
|
||||||
public native long freeMemory();
|
* public native void traceInstructions(boolean on);
|
||||||
|
*
|
||||||
public native long totalMemory();
|
* public native void traceMethodCalls(boolean on);
|
||||||
|
*
|
||||||
public native long maxMemory();
|
* public void load(String filename) { load0(Reflection.getCallerClass(),
|
||||||
|
* filename); }
|
||||||
public void gc() {
|
*
|
||||||
Runtime.getRuntime().gc();
|
* synchronized void load0(Class fromClass, String filename) {
|
||||||
}
|
* SecurityManager security = System.getSecurityManager(); if (security !=
|
||||||
|
* null) { security.checkLink(filename); } if (!(new
|
||||||
public void runFinalization() {
|
* File(filename).isAbsolute())) { throw new UnsatisfiedLinkError(
|
||||||
Runtime.getRuntime().runFinalization();
|
* "Expecting an absolute path of the library: " + filename); }
|
||||||
}
|
* ClassLoader.loadLibrary(fromClass, filename, true); }
|
||||||
|
*
|
||||||
public native void traceInstructions(boolean on);
|
* public void loadLibrary(String libname) {
|
||||||
|
* loadLibrary0(Reflection.getCallerClass(), libname); }
|
||||||
public native void traceMethodCalls(boolean on);
|
*
|
||||||
|
* synchronized void loadLibrary0(Class fromClass, String libname) {
|
||||||
public void load(String filename) {
|
* SecurityManager security = System.getSecurityManager(); if (security !=
|
||||||
load0(Reflection.getCallerClass(), filename);
|
* null) { security.checkLink(libname); } if
|
||||||
}
|
* (libname.indexOf((int)File.separatorChar) != -1) { throw new
|
||||||
|
* UnsatisfiedLinkError(
|
||||||
synchronized void load0(Class fromClass, String filename) {
|
* "Directory separator should not appear in library name: " + libname); }
|
||||||
SecurityManager security = System.getSecurityManager();
|
* ClassLoader.loadLibrary(fromClass, libname, false); }
|
||||||
if (security != null) {
|
*
|
||||||
security.checkLink(filename);
|
* public InputStream getLocalizedInputStream(InputStream in) { return in; }
|
||||||
}
|
*
|
||||||
if (!(new File(filename).isAbsolute())) {
|
* public OutputStream getLocalizedOutputStream(OutputStream out) { return
|
||||||
throw new UnsatisfiedLinkError(
|
* out; }
|
||||||
"Expecting an absolute path of the library: " + filename);
|
*/
|
||||||
}
|
|
||||||
ClassLoader.loadLibrary(fromClass, filename, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadLibrary(String libname) {
|
|
||||||
loadLibrary0(Reflection.getCallerClass(), libname);
|
|
||||||
}
|
|
||||||
|
|
||||||
synchronized void loadLibrary0(Class fromClass, String libname) {
|
|
||||||
SecurityManager security = System.getSecurityManager();
|
|
||||||
if (security != null) {
|
|
||||||
security.checkLink(libname);
|
|
||||||
}
|
|
||||||
if (libname.indexOf((int)File.separatorChar) != -1) {
|
|
||||||
throw new UnsatisfiedLinkError(
|
|
||||||
"Directory separator should not appear in library name: " + libname);
|
|
||||||
}
|
|
||||||
ClassLoader.loadLibrary(fromClass, libname, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public InputStream getLocalizedInputStream(InputStream in) {
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OutputStream getLocalizedOutputStream(OutputStream out) {
|
|
||||||
return out;
|
|
||||||
}*/
|
|
||||||
}
|
}
|
|
@ -34,7 +34,8 @@ public final class ZipUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compress the given root and all its underlying folders and files to the target file, preserving files hierarchy.
|
* Compress the given root and all its underlying folders and files to the
|
||||||
|
* target file, preserving files hierarchy.
|
||||||
*
|
*
|
||||||
* @param root
|
* @param root
|
||||||
* The root of the Zip archive
|
* The root of the Zip archive
|
||||||
|
@ -43,9 +44,11 @@ public final class ZipUtils {
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* If an error occurs during the process
|
* If an error occurs during the process
|
||||||
*/
|
*/
|
||||||
public static void zipDirectory(final File root, final File target) throws IOException {
|
public static void zipDirectory(final File root, final File target)
|
||||||
|
throws IOException {
|
||||||
if (!ZIP_FILE_FILTER.accept(target)) {
|
if (!ZIP_FILE_FILTER.accept(target)) {
|
||||||
throw new IllegalArgumentException("Target file " + target.getName() + " is not a valid Zip file name");
|
throw new IllegalArgumentException("Target file "
|
||||||
|
+ target.getName() + " is not a valid Zip file name");
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
|
@ -59,7 +62,8 @@ public final class ZipUtils {
|
||||||
FileInputStream fileInputStream = null;
|
FileInputStream fileInputStream = null;
|
||||||
|
|
||||||
for (File file : ZipUtils.listFilesRecursive(root)) {
|
for (File file : ZipUtils.listFilesRecursive(root)) {
|
||||||
ZipEntry entry = new ZipEntry(ZipUtils.stripRootInclusive(file, root).getPath());
|
ZipEntry entry = new ZipEntry(ZipUtils.stripRootInclusive(file,
|
||||||
|
root).getPath());
|
||||||
zipOutputStream.putNextEntry(entry);
|
zipOutputStream.putNextEntry(entry);
|
||||||
try {
|
try {
|
||||||
fileInputStream = new FileInputStream(file);
|
fileInputStream = new FileInputStream(file);
|
||||||
|
@ -79,8 +83,9 @@ public final class ZipUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unzip the given archive Zip file to the target location. If target location is a file, the extraction will be
|
* Unzip the given archive Zip file to the target location. If target
|
||||||
* performed in the same directory of this target file.
|
* location is a file, the extraction will be performed in the same
|
||||||
|
* directory of this target file.
|
||||||
*
|
*
|
||||||
* @param zipFile
|
* @param zipFile
|
||||||
* The Zip archive file
|
* The Zip archive file
|
||||||
|
@ -89,11 +94,13 @@ public final class ZipUtils {
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* If an error occurs during the process
|
* If an error occurs during the process
|
||||||
*/
|
*/
|
||||||
public static void unzip(final File zipFile, File target) throws IOException {
|
public static void unzip(final File zipFile, File target)
|
||||||
|
throws IOException {
|
||||||
if (zipFile == null) {
|
if (zipFile == null) {
|
||||||
throw new IllegalArgumentException("Cannot unzip a null file!");
|
throw new IllegalArgumentException("Cannot unzip a null file!");
|
||||||
} else if (!ZIP_FILE_FILTER.accept(zipFile)) {
|
} else if (!ZIP_FILE_FILTER.accept(zipFile)) {
|
||||||
throw new IllegalArgumentException("Given archive is not a valid Zip file!");
|
throw new IllegalArgumentException(
|
||||||
|
"Given archive is not a valid Zip file!");
|
||||||
}
|
}
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
throw new IllegalArgumentException("Cannot unzip to a null target!");
|
throw new IllegalArgumentException("Cannot unzip to a null target!");
|
||||||
|
@ -107,13 +114,16 @@ public final class ZipUtils {
|
||||||
// Target is a file, will try to unzip in the same folder.
|
// Target is a file, will try to unzip in the same folder.
|
||||||
target = target.getParentFile();
|
target = target.getParentFile();
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
throw new IllegalArgumentException("Target is a file and has no parent!");
|
throw new IllegalArgumentException(
|
||||||
|
"Target is a file and has no parent!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(zipFile));
|
ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(
|
||||||
|
zipFile));
|
||||||
try {
|
try {
|
||||||
for (ZipEntry entry = zipInputStream.getNextEntry(); entry != null; entry = zipInputStream.getNextEntry()) {
|
for (ZipEntry entry = zipInputStream.getNextEntry(); entry != null; entry = zipInputStream
|
||||||
|
.getNextEntry()) {
|
||||||
File file = new File(target, entry.getName());
|
File file = new File(target, entry.getName());
|
||||||
|
|
||||||
// Create parent folders (folders are not in the Zip entries).
|
// Create parent folders (folders are not in the Zip entries).
|
||||||
|
@ -164,9 +174,11 @@ public final class ZipUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Strip the given file from any parent path, preserving the root as the absolute parent.
|
* Strip the given file from any parent path, preserving the root as the
|
||||||
|
* absolute parent.
|
||||||
* <p>
|
* <p>
|
||||||
* Ex. with 'Folder' as the root: /home/johnj/Test/Folder/File.txt => /Folder/File.txt
|
* Ex. with 'Folder' as the root: /home/johnj/Test/Folder/File.txt =>
|
||||||
|
* /Folder/File.txt
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param file
|
* @param file
|
||||||
|
|
|
@ -22,9 +22,9 @@ import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||||
*/
|
*/
|
||||||
public final class ASMUtil_OLD {
|
public final class ASMUtil_OLD {
|
||||||
|
|
||||||
public static void renameFieldNode(String originalParentName, String originalFieldName,
|
public static void renameFieldNode(String originalParentName,
|
||||||
String originalFieldDesc, String newFieldParent, String newFieldName, String newFieldDesc)
|
String originalFieldName, String originalFieldDesc,
|
||||||
{
|
String newFieldParent, String newFieldName, String newFieldDesc) {
|
||||||
for (ClassNode c : BytecodeViewer.getLoadedClasses()) {
|
for (ClassNode c : BytecodeViewer.getLoadedClasses()) {
|
||||||
for (Object o : c.methods.toArray()) {
|
for (Object o : c.methods.toArray()) {
|
||||||
MethodNode m = (MethodNode) o;
|
MethodNode m = (MethodNode) o;
|
||||||
|
@ -32,10 +32,9 @@ public final class ASMUtil_OLD {
|
||||||
if (i instanceof FieldInsnNode) {
|
if (i instanceof FieldInsnNode) {
|
||||||
FieldInsnNode field = (FieldInsnNode) i;
|
FieldInsnNode field = (FieldInsnNode) i;
|
||||||
|
|
||||||
if(field.owner.equals(originalParentName) &&
|
if (field.owner.equals(originalParentName)
|
||||||
field.name.equals(originalFieldName) &&
|
&& field.name.equals(originalFieldName)
|
||||||
field.desc.equals(originalFieldDesc))
|
&& field.desc.equals(originalFieldDesc)) {
|
||||||
{
|
|
||||||
if (newFieldParent != null)
|
if (newFieldParent != null)
|
||||||
field.owner = newFieldParent;
|
field.owner = newFieldParent;
|
||||||
if (newFieldName != null)
|
if (newFieldName != null)
|
||||||
|
@ -49,19 +48,18 @@ public final class ASMUtil_OLD {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void renameMethodNode(String originalParentName, String originalMethodName,
|
public static void renameMethodNode(String originalParentName,
|
||||||
String originalMethodDesc, String newParent, String newName, String newDesc)
|
String originalMethodName, String originalMethodDesc,
|
||||||
{
|
String newParent, String newName, String newDesc) {
|
||||||
for (ClassNode c : BytecodeViewer.getLoadedClasses()) {
|
for (ClassNode c : BytecodeViewer.getLoadedClasses()) {
|
||||||
for (Object o : c.methods.toArray()) {
|
for (Object o : c.methods.toArray()) {
|
||||||
MethodNode m = (MethodNode) o;
|
MethodNode m = (MethodNode) o;
|
||||||
for (AbstractInsnNode i : m.instructions.toArray()) {
|
for (AbstractInsnNode i : m.instructions.toArray()) {
|
||||||
if (i instanceof MethodInsnNode) {
|
if (i instanceof MethodInsnNode) {
|
||||||
MethodInsnNode mi = (MethodInsnNode) i;
|
MethodInsnNode mi = (MethodInsnNode) i;
|
||||||
if(mi.owner.equals(originalParentName) &&
|
if (mi.owner.equals(originalParentName)
|
||||||
mi.name.equals(originalMethodName) &&
|
&& mi.name.equals(originalMethodName)
|
||||||
mi.desc.equals(originalMethodDesc))
|
&& mi.desc.equals(originalMethodDesc)) {
|
||||||
{
|
|
||||||
if (newParent != null)
|
if (newParent != null)
|
||||||
mi.owner = newParent;
|
mi.owner = newParent;
|
||||||
if (newName != null)
|
if (newName != null)
|
||||||
|
@ -76,14 +74,16 @@ public final class ASMUtil_OLD {
|
||||||
|
|
||||||
if (m.signature != null) {
|
if (m.signature != null) {
|
||||||
if (newName != null)
|
if (newName != null)
|
||||||
m.signature = m.signature.replace(originalMethodName, newName);
|
m.signature = m.signature.replace(originalMethodName,
|
||||||
|
newName);
|
||||||
if (newParent != null)
|
if (newParent != null)
|
||||||
m.signature = m.signature.replace(originalParentName, newParent);
|
m.signature = m.signature.replace(originalParentName,
|
||||||
|
newParent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m.name.equals(originalMethodName) &&
|
if (m.name.equals(originalMethodName)
|
||||||
m.desc.equals(originalMethodDesc) &&
|
&& m.desc.equals(originalMethodDesc)
|
||||||
c.name.equals(originalParentName)) {
|
&& c.name.equals(originalParentName)) {
|
||||||
if (newName != null)
|
if (newName != null)
|
||||||
m.name = newName;
|
m.name = newName;
|
||||||
if (newDesc != null)
|
if (newDesc != null)
|
||||||
|
@ -94,19 +94,20 @@ public final class ASMUtil_OLD {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static void renameClassNode(final String oldName, final String newName) {
|
public static void renameClassNode(final String oldName,
|
||||||
|
final String newName) {
|
||||||
for (ClassNode c : BytecodeViewer.getLoadedClasses()) {
|
for (ClassNode c : BytecodeViewer.getLoadedClasses()) {
|
||||||
for (Object oo : c.innerClasses) {
|
for (Object oo : c.innerClasses) {
|
||||||
InnerClassNode innerClassNode = (InnerClassNode) oo;
|
InnerClassNode innerClassNode = (InnerClassNode) oo;
|
||||||
if (innerClassNode.innerName != null &&
|
if (innerClassNode.innerName != null
|
||||||
innerClassNode.innerName.equals(oldName)) {
|
&& innerClassNode.innerName.equals(oldName)) {
|
||||||
innerClassNode.innerName = newName;
|
innerClassNode.innerName = newName;
|
||||||
}
|
}
|
||||||
if (innerClassNode.name.equals(oldName)) {
|
if (innerClassNode.name.equals(oldName)) {
|
||||||
innerClassNode.name = newName;
|
innerClassNode.name = newName;
|
||||||
}
|
}
|
||||||
if (innerClassNode.outerName != null &&
|
if (innerClassNode.outerName != null
|
||||||
innerClassNode.outerName.equals(oldName)) {
|
&& innerClassNode.outerName.equals(oldName)) {
|
||||||
innerClassNode.outerName = newName;
|
innerClassNode.outerName = newName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,18 +165,15 @@ public final class ASMUtil_OLD {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*for(ClassNode oldClass : BytecodeViewer.getLoadedClasses()) {
|
/*
|
||||||
try {
|
* for(ClassNode oldClass : BytecodeViewer.getLoadedClasses()) { try {
|
||||||
ClassReader cr = new ClassReader(oldClass.name);
|
* ClassReader cr = new ClassReader(oldClass.name); ClassWriter cw = new
|
||||||
ClassWriter cw = new ClassWriter(0);
|
* ClassWriter(0); cr.accept(new ClassVisitor(0) {
|
||||||
cr.accept(new ClassVisitor(0) {
|
*
|
||||||
@Override
|
* @Override
|
||||||
|
*
|
||||||
}, ClassReader.EXPAND_FRAMES);
|
* }, ClassReader.EXPAND_FRAMES); byte[] b = cw.toByteArray(); }
|
||||||
byte[] b = cw.toByteArray();
|
* catch(Exception e) { new ExceptionUI(e); } }
|
||||||
} catch(Exception e) {
|
*/
|
||||||
new ExceptionUI(e);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
package the.bytecode.club.bytecodeviewer.api;
|
package the.bytecode.club.bytecodeviewer.api;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whenever a function is executed, this class will be executed with the function
|
* Whenever a function is executed, this class will be executed with the
|
||||||
* callHook(String);
|
* function callHook(String);
|
||||||
*
|
*
|
||||||
* @author Konloch
|
* @author Konloch
|
||||||
*
|
*
|
||||||
|
@ -11,9 +11,11 @@ package the.bytecode.club.bytecodeviewer.api;
|
||||||
public abstract class BytecodeHook {
|
public abstract class BytecodeHook {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called whenever a function is called (And EZ-Injection has been injected).
|
* Called whenever a function is called (And EZ-Injection has been
|
||||||
|
* injected).
|
||||||
*
|
*
|
||||||
* @param information the full name of the class, method and method description.
|
* @param information
|
||||||
|
* the full name of the class, method and method description.
|
||||||
*/
|
*/
|
||||||
public abstract void callHook(String information);
|
public abstract void callHook(String information);
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@ import org.objectweb.asm.tree.ClassNode;
|
||||||
import the.bytecode.club.bytecodeviewer.plugins.EZInjection;
|
import the.bytecode.club.bytecodeviewer.plugins.EZInjection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The official API for BCV, this was mainly designed for plugin authors
|
* The official API for BCV, this was mainly designed for plugin authors and
|
||||||
* and people utilizing EZ-Injection.
|
* people utilizing EZ-Injection.
|
||||||
*
|
*
|
||||||
* @author Konloch
|
* @author Konloch
|
||||||
*
|
*
|
||||||
|
@ -24,6 +24,7 @@ public class BytecodeViewer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Grab the loader instance
|
* Grab the loader instance
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static ClassNodeLoader getClassNodeLoader() {
|
public static ClassNodeLoader getClassNodeLoader() {
|
||||||
|
@ -40,7 +41,9 @@ public class BytecodeViewer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to start a plugin from file.
|
* Used to start a plugin from file.
|
||||||
* @param plugin the file of the plugin
|
*
|
||||||
|
* @param plugin
|
||||||
|
* the file of the plugin
|
||||||
*/
|
*/
|
||||||
public static void startPlugin(File plugin) {
|
public static void startPlugin(File plugin) {
|
||||||
the.bytecode.club.bytecodeviewer.BytecodeViewer.startPlugin(plugin);
|
the.bytecode.club.bytecodeviewer.BytecodeViewer.startPlugin(plugin);
|
||||||
|
@ -48,7 +51,9 @@ public class BytecodeViewer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to load classes/jars into BCV.
|
* Used to load classes/jars into BCV.
|
||||||
* @param files an array of the files you want loaded.
|
*
|
||||||
|
* @param files
|
||||||
|
* an array of the files you want loaded.
|
||||||
*/
|
*/
|
||||||
public static void openFiles(File[] files) {
|
public static void openFiles(File[] files) {
|
||||||
the.bytecode.club.bytecodeviewer.BytecodeViewer.openFiles(files);
|
the.bytecode.club.bytecodeviewer.BytecodeViewer.openFiles(files);
|
||||||
|
@ -56,23 +61,29 @@ public class BytecodeViewer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to load a ClassNode.
|
* Used to load a ClassNode.
|
||||||
* @param name the full name of the ClassNode
|
*
|
||||||
|
* @param name
|
||||||
|
* the full name of the ClassNode
|
||||||
* @return the ClassNode
|
* @return the ClassNode
|
||||||
*/
|
*/
|
||||||
public static ClassNode getClassNode(String name) {
|
public static ClassNode getClassNode(String name) {
|
||||||
return the.bytecode.club.bytecodeviewer.BytecodeViewer.getClassNode(name);
|
return the.bytecode.club.bytecodeviewer.BytecodeViewer
|
||||||
|
.getClassNode(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to grab the loaded ClassNodes.
|
* Used to grab the loaded ClassNodes.
|
||||||
|
*
|
||||||
* @return the loaded classes
|
* @return the loaded classes
|
||||||
*/
|
*/
|
||||||
public static ArrayList<ClassNode> getLoadedClasses() {
|
public static ArrayList<ClassNode> getLoadedClasses() {
|
||||||
return the.bytecode.club.bytecodeviewer.BytecodeViewer.getLoadedClasses();
|
return the.bytecode.club.bytecodeviewer.BytecodeViewer
|
||||||
|
.getLoadedClasses();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to insert a Bytecode Hook using EZ-Injection.
|
* Used to insert a Bytecode Hook using EZ-Injection.
|
||||||
|
*
|
||||||
* @param hook
|
* @param hook
|
||||||
*/
|
*/
|
||||||
public static void insertHook(BytecodeHook hook) {
|
public static void insertHook(BytecodeHook hook) {
|
||||||
|
@ -88,8 +99,11 @@ public class BytecodeViewer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If true, it will display the busy icon, if false it will remove it if it's displayed.
|
* If true, it will display the busy icon, if false it will remove it if
|
||||||
* @param busy if it should display the busy icon or not
|
* it's displayed.
|
||||||
|
*
|
||||||
|
* @param busy
|
||||||
|
* if it should display the busy icon or not
|
||||||
*/
|
*/
|
||||||
public static void setBusy(boolean busy) {
|
public static void setBusy(boolean busy) {
|
||||||
the.bytecode.club.bytecodeviewer.BytecodeViewer.viewer.setIcon(busy);
|
the.bytecode.club.bytecodeviewer.BytecodeViewer.viewer.setIcon(busy);
|
||||||
|
@ -97,7 +111,9 @@ public class BytecodeViewer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a small window popup with the defined message.
|
* Sends a small window popup with the defined message.
|
||||||
* @param message the message you want to display
|
*
|
||||||
|
* @param message
|
||||||
|
* the message you want to display
|
||||||
*/
|
*/
|
||||||
public static void showMessage(String message) {
|
public static void showMessage(String message) {
|
||||||
the.bytecode.club.bytecodeviewer.BytecodeViewer.showMessage(message);
|
the.bytecode.club.bytecodeviewer.BytecodeViewer.showMessage(message);
|
||||||
|
|
|
@ -24,15 +24,19 @@ public final class ClassNodeLoader extends ClassLoader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the provided class node to the class loader
|
* Adds the provided class node to the class loader
|
||||||
* @param name The class name
|
*
|
||||||
* @param contents The contents of the class (or data)
|
* @param name
|
||||||
|
* The class name
|
||||||
|
* @param contents
|
||||||
|
* The contents of the class (or data)
|
||||||
*/
|
*/
|
||||||
public void addClass(ClassNode cn) {
|
public void addClass(ClassNode cn) {
|
||||||
classes.put(cn.name.replace("/", "."), cn);
|
classes.put(cn.name.replace("/", "."), cn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name The name of the class
|
* @param name
|
||||||
|
* The name of the class
|
||||||
* @return If this class loader contains the provided class node
|
* @return If this class loader contains the provided class node
|
||||||
*/
|
*/
|
||||||
public boolean contains(String name) {
|
public boolean contains(String name) {
|
||||||
|
@ -94,7 +98,9 @@ public final class ClassNodeLoader extends ClassLoader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a class node to a class
|
* Converts a class node to a class
|
||||||
* @param node The node to convert
|
*
|
||||||
|
* @param node
|
||||||
|
* The node to convert
|
||||||
* @return The converted class
|
* @return The converted class
|
||||||
*/
|
*/
|
||||||
public Class<?> nodeToClass(ClassNode node) {
|
public Class<?> nodeToClass(ClassNode node) {
|
||||||
|
@ -107,7 +113,8 @@ public final class ClassNodeLoader extends ClassLoader {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
byte[] b = cw.toByteArray();
|
byte[] b = cw.toByteArray();
|
||||||
return defineClass(node.name.replaceAll("/", "."), b, 0, b.length, getDomain());
|
return defineClass(node.name.replaceAll("/", "."), b, 0, b.length,
|
||||||
|
getDomain());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -24,15 +24,18 @@ import java.io.StringWriter;
|
||||||
public class ExceptionUI extends JFrame {
|
public class ExceptionUI extends JFrame {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param e The exception to be shown
|
* @param e
|
||||||
|
* The exception to be shown
|
||||||
*/
|
*/
|
||||||
public ExceptionUI(Exception e) {
|
public ExceptionUI(Exception e) {
|
||||||
setup(e,"@Konloch");
|
setup(e, "@Konloch - konloch@gmail.com");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param e The exception to be shown
|
* @param e
|
||||||
* @param author the author of the plugin throwing this exception.
|
* The exception to be shown
|
||||||
|
* @param author
|
||||||
|
* the author of the plugin throwing this exception.
|
||||||
*/
|
*/
|
||||||
public ExceptionUI(Exception e, String author) {
|
public ExceptionUI(Exception e, String author) {
|
||||||
setup(e, author);
|
setup(e, author);
|
||||||
|
@ -42,13 +45,15 @@ public class ExceptionUI extends JFrame {
|
||||||
|
|
||||||
this.setIconImages(BytecodeViewer.iconList);
|
this.setIconImages(BytecodeViewer.iconList);
|
||||||
setSize(new Dimension(600, 400));
|
setSize(new Dimension(600, 400));
|
||||||
setTitle("Bytecode Viewer "+BytecodeViewer.version+" - Stack Trace - Send this to "+author);
|
setTitle("Bytecode Viewer " + BytecodeViewer.version
|
||||||
|
+ " - Stack Trace - Send this to " + author);
|
||||||
getContentPane().setLayout(new CardLayout(0, 0));
|
getContentPane().setLayout(new CardLayout(0, 0));
|
||||||
|
|
||||||
JTextArea txtrBytecodeViewerIs = new JTextArea();
|
JTextArea txtrBytecodeViewerIs = new JTextArea();
|
||||||
txtrBytecodeViewerIs.setDisabledTextColor(Color.BLACK);
|
txtrBytecodeViewerIs.setDisabledTextColor(Color.BLACK);
|
||||||
txtrBytecodeViewerIs.setWrapStyleWord(true);
|
txtrBytecodeViewerIs.setWrapStyleWord(true);
|
||||||
getContentPane().add(new JScrollPane(txtrBytecodeViewerIs), "name_140466576080695");
|
getContentPane().add(new JScrollPane(txtrBytecodeViewerIs),
|
||||||
|
"name_140466576080695");
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
e.printStackTrace(new PrintWriter(sw));
|
e.printStackTrace(new PrintWriter(sw));
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -22,8 +22,10 @@ public abstract class Plugin extends Thread {
|
||||||
if (!BytecodeViewer.getLoadedClasses().isEmpty())
|
if (!BytecodeViewer.getLoadedClasses().isEmpty())
|
||||||
execute(BytecodeViewer.getLoadedClasses());
|
execute(BytecodeViewer.getLoadedClasses());
|
||||||
else {
|
else {
|
||||||
System.out.println("Plugin not ran, put some classes in first.");
|
System.out
|
||||||
BytecodeViewer.showMessage("Plugin not ran, put some classes in first.");
|
.println("Plugin not ran, put some classes in first.");
|
||||||
|
BytecodeViewer
|
||||||
|
.showMessage("Plugin not ran, put some classes in first.");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
||||||
|
@ -37,6 +39,7 @@ public abstract class Plugin extends Thread {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When the plugin is finally finished, this will return true
|
* When the plugin is finally finished, this will return true
|
||||||
|
*
|
||||||
* @return true if the plugin is finished executing
|
* @return true if the plugin is finished executing
|
||||||
*/
|
*/
|
||||||
public boolean isFinished() {
|
public boolean isFinished() {
|
||||||
|
@ -44,9 +47,9 @@ public abstract class Plugin extends Thread {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If for some reason your plugin needs to keep the thread alive,
|
* If for some reason your plugin needs to keep the thread alive, yet will
|
||||||
* yet will still be considered finished (EZ-Injection), you can call this
|
* still be considered finished (EZ-Injection), you can call this function
|
||||||
* function and it will set the finished boolean to true.
|
* and it will set the finished boolean to true.
|
||||||
*/
|
*/
|
||||||
public void setFinished() {
|
public void setFinished() {
|
||||||
finished = true;
|
finished = true;
|
||||||
|
@ -54,7 +57,9 @@ public abstract class Plugin extends Thread {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whenever the plugin is started, this method is called
|
* Whenever the plugin is started, this method is called
|
||||||
* @param classNodeList all of the loaded classes for easy access.
|
*
|
||||||
|
* @param classNodeList
|
||||||
|
* all of the loaded classes for easy access.
|
||||||
*/
|
*/
|
||||||
public abstract void execute(ArrayList<ClassNode> classNodeList);
|
public abstract void execute(ArrayList<ClassNode> classNodeList);
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ public class PluginConsole extends JFrame {
|
||||||
JPanel panel = new JPanel(new BorderLayout());
|
JPanel panel = new JPanel(new BorderLayout());
|
||||||
JScrollPane scrollPane = new JScrollPane();
|
JScrollPane scrollPane = new JScrollPane();
|
||||||
public JCheckBox check = new JCheckBox("Exact");
|
public JCheckBox check = new JCheckBox("Exact");
|
||||||
|
|
||||||
public PluginConsole(String pluginName) {
|
public PluginConsole(String pluginName) {
|
||||||
this.setIconImages(BytecodeViewer.iconList);
|
this.setIconImages(BytecodeViewer.iconList);
|
||||||
setTitle("Bytecode Viewer - Plugin Console - " + pluginName);
|
setTitle("Bytecode Viewer - Plugin Console - " + pluginName);
|
||||||
|
@ -48,14 +49,19 @@ public class PluginConsole extends JFrame {
|
||||||
|
|
||||||
scrollPane.setViewportView(textArea);
|
scrollPane.setViewportView(textArea);
|
||||||
|
|
||||||
|
|
||||||
JButton searchNext = new JButton();
|
JButton searchNext = new JButton();
|
||||||
JButton searchPrev = new JButton();
|
JButton searchPrev = new JButton();
|
||||||
JPanel buttonPane = new JPanel(new BorderLayout());
|
JPanel buttonPane = new JPanel(new BorderLayout());
|
||||||
buttonPane.add(searchNext, BorderLayout.WEST);
|
buttonPane.add(searchNext, BorderLayout.WEST);
|
||||||
buttonPane.add(searchPrev, BorderLayout.EAST);
|
buttonPane.add(searchPrev, BorderLayout.EAST);
|
||||||
searchNext.setIcon(new ImageIcon(BytecodeViewer.b642IMG("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAABnRSTlMANzlYqPBJSG/ZAAAASUlEQVR42mNgwAbS0oAEE4yHyWBmYAzjYDC694OJ4f9+BoY3H0BSbz6A2MxA6VciFyDqGAWQTWVkYEkCUrcOsDD8OwtkvMViMwAb8xEUHlHcFAAAAABJRU5ErkJggg==")));
|
searchNext
|
||||||
searchPrev.setIcon(new ImageIcon(BytecodeViewer.b642IMG("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAABnRSTlMANzlYgKhxpRi1AAAATElEQVR42mNgwAZYHIAEExA7qUAYLApMDmCGEwODCojByM/A8FEAyPi/moFh9QewYjCAM1iA+D2KqYwMrIlA6tUGFoa/Z4GMt1hsBgCe1wuKber+SwAAAABJRU5ErkJggg==")));
|
.setIcon(new ImageIcon(
|
||||||
|
BytecodeViewer
|
||||||
|
.b642IMG("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAABnRSTlMANzlYqPBJSG/ZAAAASUlEQVR42mNgwAbS0oAEE4yHyWBmYAzjYDC694OJ4f9+BoY3H0BSbz6A2MxA6VciFyDqGAWQTWVkYEkCUrcOsDD8OwtkvMViMwAb8xEUHlHcFAAAAABJRU5ErkJggg==")));
|
||||||
|
searchPrev
|
||||||
|
.setIcon(new ImageIcon(
|
||||||
|
BytecodeViewer
|
||||||
|
.b642IMG("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAABnRSTlMANzlYgKhxpRi1AAAATElEQVR42mNgwAZYHIAEExA7qUAYLApMDmCGEwODCojByM/A8FEAyPi/moFh9QewYjCAM1iA+D2KqYwMrIlA6tUGFoa/Z4GMt1hsBgCe1wuKber+SwAAAABJRU5ErkJggg==")));
|
||||||
panel.add(buttonPane, BorderLayout.WEST);
|
panel.add(buttonPane, BorderLayout.WEST);
|
||||||
final JTextField field = new JTextField();
|
final JTextField field = new JTextField();
|
||||||
panel.add(field, BorderLayout.CENTER);
|
panel.add(field, BorderLayout.CENTER);
|
||||||
|
@ -80,16 +86,18 @@ public class PluginConsole extends JFrame {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void keyPressed(KeyEvent arg0) {}
|
public void keyPressed(KeyEvent arg0) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void keyTyped(KeyEvent arg0) {}
|
public void keyTyped(KeyEvent arg0) {
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
scrollPane.setColumnHeaderView(panel);
|
scrollPane.setColumnHeaderView(panel);
|
||||||
this.setLocationRelativeTo(null);
|
this.setLocationRelativeTo(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This was really interesting to write.
|
* This was really interesting to write.
|
||||||
*
|
*
|
||||||
|
@ -104,7 +112,8 @@ public class PluginConsole extends JFrame {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int startLine = area.getDocument().getDefaultRootElement().getElementIndex(area.getCaretPosition())+1;
|
int startLine = area.getDocument().getDefaultRootElement()
|
||||||
|
.getElementIndex(area.getCaretPosition()) + 1;
|
||||||
int currentLine = 1;
|
int currentLine = 1;
|
||||||
boolean canSearch = false;
|
boolean canSearch = false;
|
||||||
String[] test = null;
|
String[] test = null;
|
||||||
|
@ -118,8 +127,7 @@ public class PluginConsole extends JFrame {
|
||||||
|
|
||||||
if (next) {
|
if (next) {
|
||||||
for (String s : test) {
|
for (String s : test) {
|
||||||
if(!check.isSelected())
|
if (!check.isSelected()) {
|
||||||
{
|
|
||||||
s = s.toLowerCase();
|
s = s.toLowerCase();
|
||||||
search = search.toLowerCase();
|
search = search.toLowerCase();
|
||||||
}
|
}
|
||||||
|
@ -129,7 +137,8 @@ public class PluginConsole extends JFrame {
|
||||||
} else if (s.contains(search)) {
|
} else if (s.contains(search)) {
|
||||||
if (canSearch) {
|
if (canSearch) {
|
||||||
area.setCaretPosition(area.getDocument()
|
area.setCaretPosition(area.getDocument()
|
||||||
.getDefaultRootElement().getElement(currentLine-1)
|
.getDefaultRootElement()
|
||||||
|
.getElement(currentLine - 1)
|
||||||
.getStartOffset());
|
.getStartOffset());
|
||||||
canSearch = false;
|
canSearch = false;
|
||||||
found = true;
|
found = true;
|
||||||
|
@ -150,8 +159,7 @@ public class PluginConsole extends JFrame {
|
||||||
} else {
|
} else {
|
||||||
canSearch = true;
|
canSearch = true;
|
||||||
for (String s : test) {
|
for (String s : test) {
|
||||||
if(!check.isSelected())
|
if (!check.isSelected()) {
|
||||||
{
|
|
||||||
s = s.toLowerCase();
|
s = s.toLowerCase();
|
||||||
search = search.toLowerCase();
|
search = search.toLowerCase();
|
||||||
}
|
}
|
||||||
|
@ -159,7 +167,8 @@ public class PluginConsole extends JFrame {
|
||||||
if (s.contains(search)) {
|
if (s.contains(search)) {
|
||||||
if (lastGoodLine != -1 && canSearch)
|
if (lastGoodLine != -1 && canSearch)
|
||||||
area.setCaretPosition(area.getDocument()
|
area.setCaretPosition(area.getDocument()
|
||||||
.getDefaultRootElement().getElement(lastGoodLine-1)
|
.getDefaultRootElement()
|
||||||
|
.getElement(lastGoodLine - 1)
|
||||||
.getStartOffset());
|
.getStartOffset());
|
||||||
|
|
||||||
lastGoodLine = currentLine;
|
lastGoodLine = currentLine;
|
||||||
|
@ -170,10 +179,12 @@ public class PluginConsole extends JFrame {
|
||||||
currentLine++;
|
currentLine++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(lastGoodLine != -1 && area.getDocument().getDefaultRootElement().getElementIndex(area.getCaretPosition())+1 == startLine) {
|
if (lastGoodLine != -1
|
||||||
|
&& area.getDocument().getDefaultRootElement()
|
||||||
|
.getElementIndex(area.getCaretPosition()) + 1 == startLine) {
|
||||||
area.setCaretPosition(area.getDocument()
|
area.setCaretPosition(area.getDocument()
|
||||||
.getDefaultRootElement().getElement(lastGoodLine-1)
|
.getDefaultRootElement()
|
||||||
.getStartOffset());
|
.getElement(lastGoodLine - 1).getStartOffset());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
highlight(area, search);
|
highlight(area, search);
|
||||||
|
@ -182,7 +193,8 @@ public class PluginConsole extends JFrame {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private DefaultHighlighter.DefaultHighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter(new Color(255,62,150));
|
private DefaultHighlighter.DefaultHighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter(
|
||||||
|
new Color(255, 62, 150));
|
||||||
|
|
||||||
public void highlight(JTextComponent textComp, String pattern) {
|
public void highlight(JTextComponent textComp, String pattern) {
|
||||||
if (pattern.isEmpty()) {
|
if (pattern.isEmpty()) {
|
||||||
|
@ -204,7 +216,8 @@ public class PluginConsole extends JFrame {
|
||||||
|
|
||||||
// Search for pattern
|
// Search for pattern
|
||||||
while ((pos = text.indexOf(pattern, pos)) >= 0) {
|
while ((pos = text.indexOf(pattern, pos)) >= 0) {
|
||||||
// Create highlighter using private painter and apply around pattern
|
// Create highlighter using private painter and apply around
|
||||||
|
// pattern
|
||||||
hilite.addHighlight(pos, pos + pattern.length(), painter);
|
hilite.addHighlight(pos, pos + pattern.length(), painter);
|
||||||
pos += pattern.length();
|
pos += pattern.length();
|
||||||
}
|
}
|
||||||
|
@ -215,16 +228,22 @@ public class PluginConsole extends JFrame {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Appends \r\n to the end of your string, then it puts it on the top.
|
* Appends \r\n to the end of your string, then it puts it on the top.
|
||||||
* @param t the string you want to append
|
*
|
||||||
|
* @param t
|
||||||
|
* the string you want to append
|
||||||
*/
|
*/
|
||||||
public void appendText(String t) {
|
public void appendText(String t) {
|
||||||
textArea.setText((textArea.getText().isEmpty() ? "" : textArea.getText()+"\r\n")+t);
|
textArea.setText((textArea.getText().isEmpty() ? "" : textArea
|
||||||
|
.getText() + "\r\n")
|
||||||
|
+ t);
|
||||||
textArea.setCaretPosition(0);
|
textArea.setCaretPosition(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the text
|
* Sets the text
|
||||||
* @param t the text you want set
|
*
|
||||||
|
* @param t
|
||||||
|
* the text you want set
|
||||||
*/
|
*/
|
||||||
public void setText(String t) {
|
public void setText(String t) {
|
||||||
textArea.setText(t);
|
textArea.setText(t);
|
||||||
|
|
|
@ -21,11 +21,14 @@ import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||||
public class ClassNodeDecompiler {
|
public class ClassNodeDecompiler {
|
||||||
|
|
||||||
public static String decompile(ClassNode cn) {
|
public static String decompile(ClassNode cn) {
|
||||||
return decompileClassNode(new PrefixedStringBuilder(), new ArrayList<String>(), cn).toString();
|
return decompileClassNode(new PrefixedStringBuilder(),
|
||||||
|
new ArrayList<String>(), cn).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
protected static PrefixedStringBuilder decompileClassNode(PrefixedStringBuilder sb, ArrayList<String> decompiledClasses, ClassNode cn) {
|
protected static PrefixedStringBuilder decompileClassNode(
|
||||||
|
PrefixedStringBuilder sb, ArrayList<String> decompiledClasses,
|
||||||
|
ClassNode cn) {
|
||||||
ArrayList<String> unableToDecompile = new ArrayList<String>();
|
ArrayList<String> unableToDecompile = new ArrayList<String>();
|
||||||
decompiledClasses.add(cn.name);
|
decompiledClasses.add(cn.name);
|
||||||
sb.append(getAccessString(cn.access));
|
sb.append(getAccessString(cn.access));
|
||||||
|
@ -66,7 +69,8 @@ public class ClassNodeDecompiler {
|
||||||
for (Object o : cn.innerClasses) {
|
for (Object o : cn.innerClasses) {
|
||||||
InnerClassNode innerClassNode = (InnerClassNode) o;
|
InnerClassNode innerClassNode = (InnerClassNode) o;
|
||||||
String innerClassName = innerClassNode.name;
|
String innerClassName = innerClassNode.name;
|
||||||
if ((innerClassName != null) && !decompiledClasses.contains(innerClassName)) {
|
if ((innerClassName != null)
|
||||||
|
&& !decompiledClasses.contains(innerClassName)) {
|
||||||
decompiledClasses.add(innerClassName);
|
decompiledClasses.add(innerClassName);
|
||||||
ClassNode cn1 = BytecodeViewer.getClassNode(innerClassName);
|
ClassNode cn1 = BytecodeViewer.getClassNode(innerClassName);
|
||||||
if (cn1 != null) {
|
if (cn1 != null) {
|
||||||
|
@ -91,7 +95,8 @@ public class ClassNodeDecompiler {
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append("}");
|
sb.append("}");
|
||||||
// System.out.println("Wrote end for " + cn.name + " with prefix length: " + sb.prefix.length());
|
// System.out.println("Wrote end for " + cn.name +
|
||||||
|
// " with prefix length: " + sb.prefix.length());
|
||||||
return sb;
|
return sb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +122,8 @@ public class ClassNodeDecompiler {
|
||||||
tokens.add("enum");
|
tokens.add("enum");
|
||||||
if ((access & Opcodes.ACC_ANNOTATION) != 0)
|
if ((access & Opcodes.ACC_ANNOTATION) != 0)
|
||||||
tokens.add("annotation");
|
tokens.add("annotation");
|
||||||
if (!tokens.contains("interface") && !tokens.contains("enum") && !tokens.contains("annotation"))
|
if (!tokens.contains("interface") && !tokens.contains("enum")
|
||||||
|
&& !tokens.contains("annotation"))
|
||||||
tokens.add("class");
|
tokens.add("class");
|
||||||
if (tokens.size() == 0)
|
if (tokens.size() == 0)
|
||||||
return "[Error parsing]";
|
return "[Error parsing]";
|
||||||
|
|
|
@ -16,7 +16,8 @@ import org.objectweb.asm.tree.FieldNode;
|
||||||
|
|
||||||
public class FieldNodeDecompiler {
|
public class FieldNodeDecompiler {
|
||||||
|
|
||||||
public static PrefixedStringBuilder decompile(PrefixedStringBuilder sb, FieldNode f) {
|
public static PrefixedStringBuilder decompile(PrefixedStringBuilder sb,
|
||||||
|
FieldNode f) {
|
||||||
String s = getAccessString(f.access);
|
String s = getAccessString(f.access);
|
||||||
sb.append(s);
|
sb.append(s);
|
||||||
if (s.length() > 0)
|
if (s.length() > 0)
|
||||||
|
|
|
@ -29,6 +29,7 @@ import eu.bibl.banalysis.filter.insn.VarInstructionFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pattern filter holder and stepper.
|
* Pattern filter holder and stepper.
|
||||||
|
*
|
||||||
* @author Bibl
|
* @author Bibl
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -43,7 +44,9 @@ public class InstructionPattern implements Opcodes {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new pattern from the specified instructions.
|
* Construct a new pattern from the specified instructions.
|
||||||
* @param insns {@link AbstractInsnNode} pattern array.
|
*
|
||||||
|
* @param insns
|
||||||
|
* {@link AbstractInsnNode} pattern array.
|
||||||
*/
|
*/
|
||||||
public InstructionPattern(AbstractInsnNode[] insns) {
|
public InstructionPattern(AbstractInsnNode[] insns) {
|
||||||
filters = translate(insns);
|
filters = translate(insns);
|
||||||
|
@ -52,7 +55,9 @@ public class InstructionPattern implements Opcodes {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new pattern from the specified opcode.
|
* Construct a new pattern from the specified opcode.
|
||||||
* @param opcodes Opcodes to convert to {@link OpcodeFilter}s.
|
*
|
||||||
|
* @param opcodes
|
||||||
|
* Opcodes to convert to {@link OpcodeFilter}s.
|
||||||
*/
|
*/
|
||||||
public InstructionPattern(int[] opcodes) {
|
public InstructionPattern(int[] opcodes) {
|
||||||
filters = new InstructionFilter[opcodes.length];
|
filters = new InstructionFilter[opcodes.length];
|
||||||
|
@ -64,7 +69,9 @@ public class InstructionPattern implements Opcodes {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an absolute pattern from user-defined filters.
|
* Construct an absolute pattern from user-defined filters.
|
||||||
* @param filters User-defined {@link InstructionFilter}s.
|
*
|
||||||
|
* @param filters
|
||||||
|
* User-defined {@link InstructionFilter}s.
|
||||||
*/
|
*/
|
||||||
public InstructionPattern(InstructionFilter[] filters) {
|
public InstructionPattern(InstructionFilter[] filters) {
|
||||||
this.filters = filters;
|
this.filters = filters;
|
||||||
|
@ -72,8 +79,11 @@ public class InstructionPattern implements Opcodes {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Steps through the instruction list checking if the current instruction ended a successful pattern-match sequence.
|
* Steps through the instruction list checking if the current instruction
|
||||||
* @param ain {@link AbstractInsnNode} to check.
|
* ended a successful pattern-match sequence.
|
||||||
|
*
|
||||||
|
* @param ain
|
||||||
|
* {@link AbstractInsnNode} to check.
|
||||||
* @return True if this instruction successfully completed the pattern.
|
* @return True if this instruction successfully completed the pattern.
|
||||||
*/
|
*/
|
||||||
public boolean accept(AbstractInsnNode ain) {
|
public boolean accept(AbstractInsnNode ain) {
|
||||||
|
@ -94,7 +104,8 @@ public class InstructionPattern implements Opcodes {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Last pattern sequence match equivilent from the inputted {@link AbstractInsnNode}s.
|
* @return Last pattern sequence match equivilent from the inputted
|
||||||
|
* {@link AbstractInsnNode}s.
|
||||||
*/
|
*/
|
||||||
public AbstractInsnNode[] getLastMatch() {
|
public AbstractInsnNode[] getLastMatch() {
|
||||||
return lastMatch;
|
return lastMatch;
|
||||||
|
@ -117,8 +128,11 @@ public class InstructionPattern implements Opcodes {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts an array of {@link AbstractInsnNode}s to their {@link InstructionFilter} counterparts.
|
* Converts an array of {@link AbstractInsnNode}s to their
|
||||||
* @param ains {@link AbstractInsnNode}s to convert.
|
* {@link InstructionFilter} counterparts.
|
||||||
|
*
|
||||||
|
* @param ains
|
||||||
|
* {@link AbstractInsnNode}s to convert.
|
||||||
* @return Array of {@link InstructionFilter}s.
|
* @return Array of {@link InstructionFilter}s.
|
||||||
*/
|
*/
|
||||||
public static InstructionFilter[] translate(AbstractInsnNode[] ains) {
|
public static InstructionFilter[] translate(AbstractInsnNode[] ains) {
|
||||||
|
@ -130,31 +144,45 @@ public class InstructionPattern implements Opcodes {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translate a single {@link AbstractInsnNode} to an {@link InstructionFilter}.
|
* Translate a single {@link AbstractInsnNode} to an
|
||||||
* @param ain Instruction to convert.
|
* {@link InstructionFilter}.
|
||||||
|
*
|
||||||
|
* @param ain
|
||||||
|
* Instruction to convert.
|
||||||
* @return A filter an an equivilent to the inputted instruction.
|
* @return A filter an an equivilent to the inputted instruction.
|
||||||
*/
|
*/
|
||||||
public static InstructionFilter translate(AbstractInsnNode ain) {
|
public static InstructionFilter translate(AbstractInsnNode ain) {
|
||||||
if (ain instanceof LdcInsnNode) {
|
if (ain instanceof LdcInsnNode) {
|
||||||
return new LdcInstructionFilter(((LdcInsnNode) ain).cst);
|
return new LdcInstructionFilter(((LdcInsnNode) ain).cst);
|
||||||
} else if (ain instanceof TypeInsnNode) {
|
} else if (ain instanceof TypeInsnNode) {
|
||||||
return new TypeInstructionFilter(ain.getOpcode(), ((TypeInsnNode) ain).desc);
|
return new TypeInstructionFilter(ain.getOpcode(),
|
||||||
|
((TypeInsnNode) ain).desc);
|
||||||
} else if (ain instanceof FieldInsnNode) {
|
} else if (ain instanceof FieldInsnNode) {
|
||||||
return new FieldInstructionFilter(ain.getOpcode(), ((FieldInsnNode) ain).owner, ((FieldInsnNode) ain).name, ((FieldInsnNode) ain).desc);
|
return new FieldInstructionFilter(ain.getOpcode(),
|
||||||
|
((FieldInsnNode) ain).owner, ((FieldInsnNode) ain).name,
|
||||||
|
((FieldInsnNode) ain).desc);
|
||||||
} else if (ain instanceof MethodInsnNode) {
|
} else if (ain instanceof MethodInsnNode) {
|
||||||
return new MethodInstructionFilter(ain.getOpcode(), ((MethodInsnNode) ain).owner, ((MethodInsnNode) ain).name, ((MethodInsnNode) ain).desc);
|
return new MethodInstructionFilter(ain.getOpcode(),
|
||||||
|
((MethodInsnNode) ain).owner, ((MethodInsnNode) ain).name,
|
||||||
|
((MethodInsnNode) ain).desc);
|
||||||
} else if (ain instanceof VarInsnNode) {
|
} else if (ain instanceof VarInsnNode) {
|
||||||
return new VarInstructionFilter(ain.getOpcode(), ((VarInsnNode) ain).var);
|
return new VarInstructionFilter(ain.getOpcode(),
|
||||||
|
((VarInsnNode) ain).var);
|
||||||
} else if (ain instanceof InsnNode) {
|
} else if (ain instanceof InsnNode) {
|
||||||
return new InsnInstructionFilter(ain.getOpcode());
|
return new InsnInstructionFilter(ain.getOpcode());
|
||||||
} else if (ain instanceof IincInsnNode) {
|
} else if (ain instanceof IincInsnNode) {
|
||||||
return new IincInstructionFilter(((IincInsnNode) ain).incr, ((IincInsnNode) ain).var);
|
return new IincInstructionFilter(((IincInsnNode) ain).incr,
|
||||||
|
((IincInsnNode) ain).var);
|
||||||
} else if (ain instanceof JumpInsnNode) {
|
} else if (ain instanceof JumpInsnNode) {
|
||||||
return new JumpInstructionFilter(ain.getOpcode());
|
return new JumpInstructionFilter(ain.getOpcode());
|
||||||
} else if (ain instanceof LabelNode) {
|
} else if (ain instanceof LabelNode) {
|
||||||
return InstructionFilter.ACCEPT_ALL; // TODO: Cache labels and check. // TODO: That's a fucking stupid idea.
|
return InstructionFilter.ACCEPT_ALL; // TODO: Cache labels and
|
||||||
|
// check. // TODO: That's a
|
||||||
|
// fucking stupid idea.
|
||||||
} else if (ain instanceof MultiANewArrayInsnNode) {
|
} else if (ain instanceof MultiANewArrayInsnNode) {
|
||||||
return new MultiANewArrayInstructionFilter(((MultiANewArrayInsnNode) ain).desc, ((MultiANewArrayInsnNode) ain).dims);
|
return new MultiANewArrayInstructionFilter(
|
||||||
|
((MultiANewArrayInsnNode) ain).desc,
|
||||||
|
((MultiANewArrayInsnNode) ain).dims);
|
||||||
} else {
|
} else {
|
||||||
return InstructionFilter.ACCEPT_ALL;
|
return InstructionFilter.ACCEPT_ALL;
|
||||||
}
|
}
|
||||||
|
@ -162,11 +190,10 @@ public class InstructionPattern implements Opcodes {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
AbstractInsnNode[] ains = new AbstractInsnNode[] {
|
AbstractInsnNode[] ains = new AbstractInsnNode[] {
|
||||||
new LdcInsnNode("ldc"),
|
new LdcInsnNode("ldc"), new VarInsnNode(ASTORE, 0),
|
||||||
new VarInsnNode(ASTORE, 0),
|
|
||||||
new LdcInsnNode("ldc") };
|
new LdcInsnNode("ldc") };
|
||||||
InstructionPattern pattern = new InstructionPattern(new AbstractInsnNode[] {
|
InstructionPattern pattern = new InstructionPattern(
|
||||||
new LdcInsnNode("ldc"),
|
new AbstractInsnNode[] { new LdcInsnNode("ldc"),
|
||||||
new VarInsnNode(-1, -1) });
|
new VarInsnNode(-1, -1) });
|
||||||
for (AbstractInsnNode ain : ains) {
|
for (AbstractInsnNode ain : ains) {
|
||||||
if (pattern.accept(ain)) {
|
if (pattern.accept(ain)) {
|
||||||
|
|
|
@ -57,11 +57,13 @@ public class InstructionPrinter {
|
||||||
this.args = args;
|
this.args = args;
|
||||||
mNode = m;
|
mNode = m;
|
||||||
labels = new HashMap<LabelNode, Integer>();
|
labels = new HashMap<LabelNode, Integer>();
|
||||||
// matchedInsns = new ArrayList<AbstractInsnNode>(); // ingnored because match = false
|
// matchedInsns = new ArrayList<AbstractInsnNode>(); // ingnored because
|
||||||
|
// match = false
|
||||||
match = false;
|
match = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InstructionPrinter(MethodNode m, InstructionPattern pattern, TypeAndName[] args) {
|
public InstructionPrinter(MethodNode m, InstructionPattern pattern,
|
||||||
|
TypeAndName[] args) {
|
||||||
this.args = args;
|
this.args = args;
|
||||||
mNode = m;
|
mNode = m;
|
||||||
labels = new HashMap<LabelNode, Integer>();
|
labels = new HashMap<LabelNode, Integer>();
|
||||||
|
@ -78,6 +80,7 @@ public class InstructionPrinter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the print
|
* Creates the print
|
||||||
|
*
|
||||||
* @return The print as an ArrayList
|
* @return The print as an ArrayList
|
||||||
*/
|
*/
|
||||||
public ArrayList<String> createPrint() {
|
public ArrayList<String> createPrint() {
|
||||||
|
@ -104,7 +107,9 @@ public class InstructionPrinter {
|
||||||
} else if (ain instanceof LineNumberNode) {
|
} else if (ain instanceof LineNumberNode) {
|
||||||
line = printLineNumberNode((LineNumberNode) ain, it);
|
line = printLineNumberNode((LineNumberNode) ain, it);
|
||||||
} else if (ain instanceof LabelNode) {
|
} else if (ain instanceof LabelNode) {
|
||||||
if(firstLabel && BytecodeViewer.viewer.chckbxmntmAppendBrackets.isSelected())
|
if (firstLabel
|
||||||
|
&& BytecodeViewer.viewer.chckbxmntmAppendBrackets
|
||||||
|
.isSelected())
|
||||||
info.add("}");
|
info.add("}");
|
||||||
|
|
||||||
line = printLabelnode((LabelNode) ain);
|
line = printLabelnode((LabelNode) ain);
|
||||||
|
@ -125,7 +130,8 @@ public class InstructionPrinter {
|
||||||
} else if (ain instanceof LookupSwitchInsnNode) {
|
} else if (ain instanceof LookupSwitchInsnNode) {
|
||||||
line = printLookupSwitchInsnNode((LookupSwitchInsnNode) ain);
|
line = printLookupSwitchInsnNode((LookupSwitchInsnNode) ain);
|
||||||
} else {
|
} else {
|
||||||
line += "UNADDED OPCODE: " + nameOpcode(ain.getOpcode()) + " " + ain.toString();
|
line += "UNADDED OPCODE: " + nameOpcode(ain.getOpcode()) + " "
|
||||||
|
+ ain.toString();
|
||||||
}
|
}
|
||||||
if (!line.equals("")) {
|
if (!line.equals("")) {
|
||||||
if (match)
|
if (match)
|
||||||
|
@ -135,7 +141,8 @@ public class InstructionPrinter {
|
||||||
info.add(line);
|
info.add(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(firstLabel && BytecodeViewer.viewer.chckbxmntmAppendBrackets.isSelected())
|
if (firstLabel
|
||||||
|
&& BytecodeViewer.viewer.chckbxmntmAppendBrackets.isSelected())
|
||||||
info.add("}");
|
info.add("}");
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
@ -148,7 +155,8 @@ public class InstructionPrinter {
|
||||||
if (vin.var == 0 && !Modifier.isStatic(mNode.access)) {
|
if (vin.var == 0 && !Modifier.isStatic(mNode.access)) {
|
||||||
sb.append(" // reference to self");
|
sb.append(" // reference to self");
|
||||||
} else {
|
} else {
|
||||||
final int refIndex = vin.var - (Modifier.isStatic(mNode.access) ? 0 : 1);
|
final int refIndex = vin.var
|
||||||
|
- (Modifier.isStatic(mNode.access) ? 0 : 1);
|
||||||
if (refIndex >= 0 && refIndex < args.length - 1) {
|
if (refIndex >= 0 && refIndex < args.length - 1) {
|
||||||
sb.append(" // reference to " + args[refIndex].name);
|
sb.append(" // reference to " + args[refIndex].name);
|
||||||
}
|
}
|
||||||
|
@ -166,12 +174,14 @@ public class InstructionPrinter {
|
||||||
String desc = Type.getType(fin.desc).getClassName();
|
String desc = Type.getType(fin.desc).getClassName();
|
||||||
if (desc == null || desc.equals("null"))
|
if (desc == null || desc.equals("null"))
|
||||||
desc = fin.desc;
|
desc = fin.desc;
|
||||||
return nameOpcode(fin.getOpcode()) + " " + fin.owner + "." + fin.name + ":" + desc;
|
return nameOpcode(fin.getOpcode()) + " " + fin.owner + "." + fin.name
|
||||||
|
+ ":" + desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String printMethodInsnNode(MethodInsnNode min, ListIterator<?> it) {
|
protected String printMethodInsnNode(MethodInsnNode min, ListIterator<?> it) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(nameOpcode(min.getOpcode()) + " " + min.owner + " " + min.name + "(");
|
sb.append(nameOpcode(min.getOpcode()) + " " + min.owner + " "
|
||||||
|
+ min.name + "(");
|
||||||
|
|
||||||
String desc = Type.getType(min.desc).getClassName();
|
String desc = Type.getType(min.desc).getClassName();
|
||||||
if (desc == null || desc.equals("null"))
|
if (desc == null || desc.equals("null"))
|
||||||
|
@ -184,18 +194,14 @@ public class InstructionPrinter {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String printLdcInsnNode(LdcInsnNode ldc, ListIterator<?> it) {
|
protected String printLdcInsnNode(LdcInsnNode ldc, ListIterator<?> it) {
|
||||||
if(BytecodeViewer.viewer.chckbxmntmNewCheckItem.isSelected()) { //ascii only
|
|
||||||
if (ldc.cst instanceof String)
|
if (ldc.cst instanceof String)
|
||||||
return nameOpcode(ldc.getOpcode()) + " \"" + StringEscapeUtils.escapeJava(ldc.cst.toString()) + "\" (" + ldc.cst.getClass().getCanonicalName() + ")";
|
return nameOpcode(ldc.getOpcode()) + " \""
|
||||||
|
+ StringEscapeUtils.escapeJava(ldc.cst.toString()) + "\" ("
|
||||||
|
+ ldc.cst.getClass().getCanonicalName() + ")";
|
||||||
|
|
||||||
return nameOpcode(ldc.getOpcode()) + " " + StringEscapeUtils.escapeJava(ldc.cst.toString()) + " (" + ldc.cst.getClass().getCanonicalName() + ")";
|
return nameOpcode(ldc.getOpcode()) + " "
|
||||||
|
+ StringEscapeUtils.escapeJava(ldc.cst.toString()) + " ("
|
||||||
} else {
|
+ ldc.cst.getClass().getCanonicalName() + ")";
|
||||||
if (ldc.cst instanceof String)
|
|
||||||
return nameOpcode(ldc.getOpcode()) + " \"" + ((String)ldc.cst).replaceAll("\\n", "\\\\n").replaceAll("\\r", "\\\\r").replaceAll("\\\"", "\\\\\"") + "\" (" + ldc.cst.getClass().getCanonicalName() + ")";
|
|
||||||
|
|
||||||
return nameOpcode(ldc.getOpcode()) + " " + ldc.cst + " (" + ldc.cst.getClass().getCanonicalName() + ")";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String printInsnNode(InsnNode in, ListIterator<?> it) {
|
protected String printInsnNode(InsnNode in, ListIterator<?> it) {
|
||||||
|
@ -203,7 +209,8 @@ public class InstructionPrinter {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String printJumpInsnNode(JumpInsnNode jin, ListIterator<?> it) {
|
protected String printJumpInsnNode(JumpInsnNode jin, ListIterator<?> it) {
|
||||||
String line = nameOpcode(jin.getOpcode()) + " L" + resolveLabel(jin.label);
|
String line = nameOpcode(jin.getOpcode()) + " L"
|
||||||
|
+ resolveLabel(jin.label);
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,9 +243,11 @@ public class InstructionPrinter {
|
||||||
List<?> labels = tin.labels;
|
List<?> labels = tin.labels;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int i = tin.min; i < tin.max; i++) {
|
for (int i = tin.min; i < tin.max; i++) {
|
||||||
line += " val: " + i + " -> " + "L" + resolveLabel((LabelNode) labels.get(count++)) + "\n";
|
line += " val: " + i + " -> " + "L"
|
||||||
|
+ resolveLabel((LabelNode) labels.get(count++)) + "\n";
|
||||||
}
|
}
|
||||||
line += " default" + " -> L" + resolveLabel(tin.dflt) + "";
|
line += " default" + " -> L" + resolveLabel(tin.dflt)
|
||||||
|
+ "";
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,13 +259,14 @@ public class InstructionPrinter {
|
||||||
for (int i = 0; i < keys.size(); i++) {
|
for (int i = 0; i < keys.size(); i++) {
|
||||||
int key = (Integer) keys.get(i);
|
int key = (Integer) keys.get(i);
|
||||||
LabelNode label = (LabelNode) labels.get(i);
|
LabelNode label = (LabelNode) labels.get(i);
|
||||||
line += " val: " + key + " -> " + "L" + resolveLabel(label) + "\n";
|
line += " val: " + key + " -> " + "L"
|
||||||
|
+ resolveLabel(label) + "\n";
|
||||||
}
|
}
|
||||||
line += " default" + " -> L" + resolveLabel(lin.dflt) + "";
|
line += " default" + " -> L" + resolveLabel(lin.dflt)
|
||||||
|
+ "";
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected String nameOpcode(int opcode) {
|
protected String nameOpcode(int opcode) {
|
||||||
return " " + OpcodeInfo.OPCODES.get(opcode).toLowerCase();
|
return " " + OpcodeInfo.OPCODES.get(opcode).toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,8 @@ import the.bytecode.club.bytecodeviewer.decompilers.bytecode.TypeAndName;
|
||||||
public class MethodNodeDecompiler {
|
public class MethodNodeDecompiler {
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public static PrefixedStringBuilder decompile(PrefixedStringBuilder sb, MethodNode m, ClassNode cn) {
|
public static PrefixedStringBuilder decompile(PrefixedStringBuilder sb,
|
||||||
|
MethodNode m, ClassNode cn) {
|
||||||
String package_ = null;
|
String package_ = null;
|
||||||
String class_ = null;
|
String class_ = null;
|
||||||
if (cn.name.contains("/")) {
|
if (cn.name.contains("/")) {
|
||||||
|
@ -68,7 +69,8 @@ public class MethodNodeDecompiler {
|
||||||
|
|
||||||
args[i] = tan;
|
args[i] = tan;
|
||||||
|
|
||||||
sb.append(type.getClassName() + " " + argName + (i < argTypes.length-1 ? ", " : ""));
|
sb.append(type.getClassName() + " " + argName
|
||||||
|
+ (i < argTypes.length - 1 ? ", " : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append(")");
|
sb.append(")");
|
||||||
|
@ -113,12 +115,16 @@ public class MethodNodeDecompiler {
|
||||||
|
|
||||||
addAttrList(m.attrs, "attr", sb, insnPrinter);
|
addAttrList(m.attrs, "attr", sb, insnPrinter);
|
||||||
addAttrList(m.invisibleAnnotations, "invisAnno", sb, insnPrinter);
|
addAttrList(m.invisibleAnnotations, "invisAnno", sb, insnPrinter);
|
||||||
addAttrList(m.invisibleAnnotations, "invisLocalVarAnno", sb, insnPrinter);
|
addAttrList(m.invisibleAnnotations, "invisLocalVarAnno", sb,
|
||||||
addAttrList(m.invisibleTypeAnnotations, "invisTypeAnno", sb, insnPrinter);
|
insnPrinter);
|
||||||
|
addAttrList(m.invisibleTypeAnnotations, "invisTypeAnno", sb,
|
||||||
|
insnPrinter);
|
||||||
addAttrList(m.localVariables, "localVar", sb, insnPrinter);
|
addAttrList(m.localVariables, "localVar", sb, insnPrinter);
|
||||||
addAttrList(m.visibleAnnotations, "visAnno", sb, insnPrinter);
|
addAttrList(m.visibleAnnotations, "visAnno", sb, insnPrinter);
|
||||||
addAttrList(m.visibleLocalVariableAnnotations, "visLocalVarAnno", sb, insnPrinter);
|
addAttrList(m.visibleLocalVariableAnnotations, "visLocalVarAnno",
|
||||||
addAttrList(m.visibleTypeAnnotations, "visTypeAnno", sb, insnPrinter);
|
sb, insnPrinter);
|
||||||
|
addAttrList(m.visibleTypeAnnotations, "visTypeAnno", sb,
|
||||||
|
insnPrinter);
|
||||||
|
|
||||||
for (Object o : m.tryCatchBlocks) {
|
for (Object o : m.tryCatchBlocks) {
|
||||||
TryCatchBlockNode tcbn = (TryCatchBlockNode) o;
|
TryCatchBlockNode tcbn = (TryCatchBlockNode) o;
|
||||||
|
@ -146,7 +152,8 @@ public class MethodNodeDecompiler {
|
||||||
return sb;
|
return sb;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addAttrList(List<?> list, String name, PrefixedStringBuilder sb, InstructionPrinter insnPrinter) {
|
private static void addAttrList(List<?> list, String name,
|
||||||
|
PrefixedStringBuilder sb, InstructionPrinter insnPrinter) {
|
||||||
if (list == null)
|
if (list == null)
|
||||||
return;
|
return;
|
||||||
if (list.size() > 0) {
|
if (list.size() > 0) {
|
||||||
|
@ -165,7 +172,10 @@ public class MethodNodeDecompiler {
|
||||||
private static String printAttr(Object o, InstructionPrinter insnPrinter) {
|
private static String printAttr(Object o, InstructionPrinter insnPrinter) {
|
||||||
if (o instanceof LocalVariableNode) {
|
if (o instanceof LocalVariableNode) {
|
||||||
LocalVariableNode lvn = (LocalVariableNode) o;
|
LocalVariableNode lvn = (LocalVariableNode) o;
|
||||||
return "index=" + lvn.index + " , name=" + lvn.name + " , desc=" + lvn.desc + ", sig=" + lvn.signature + ", start=L" + insnPrinter.resolveLabel(lvn.start) + ", end=L" + insnPrinter.resolveLabel(lvn.end);
|
return "index=" + lvn.index + " , name=" + lvn.name + " , desc="
|
||||||
|
+ lvn.desc + ", sig=" + lvn.signature + ", start=L"
|
||||||
|
+ insnPrinter.resolveLabel(lvn.start) + ", end=L"
|
||||||
|
+ insnPrinter.resolveLabel(lvn.end);
|
||||||
} else if (o instanceof AnnotationNode) {
|
} else if (o instanceof AnnotationNode) {
|
||||||
AnnotationNode an = (AnnotationNode) o;
|
AnnotationNode an = (AnnotationNode) o;
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
|
@ -17,7 +17,14 @@ public class PrefixedStringBuilder {
|
||||||
|
|
||||||
public PrefixedStringBuilder append(String s) {
|
public PrefixedStringBuilder append(String s) {
|
||||||
sb.append(s);
|
sb.append(s);
|
||||||
if (s.contains("\n") && (prefix != null) && (prefix.length() > 0))// insert the prefix at every new line, overridable
|
if (s.contains("\n") && (prefix != null) && (prefix.length() > 0))// insert
|
||||||
|
// the
|
||||||
|
// prefix
|
||||||
|
// at
|
||||||
|
// every
|
||||||
|
// new
|
||||||
|
// line,
|
||||||
|
// overridable
|
||||||
sb.append(prefix);
|
sb.append(prefix);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,8 @@ package the.bytecode.club.bytecodeviewer.decompilers.bytecode;
|
||||||
import org.objectweb.asm.Type;
|
import org.objectweb.asm.Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Container class for type and name. Used to pass arguments and local variables around
|
* Container class for type and name. Used to pass arguments and local variables
|
||||||
|
* around
|
||||||
*
|
*
|
||||||
* @author Waterwolf
|
* @author Waterwolf
|
||||||
*
|
*
|
||||||
|
|
|
@ -34,7 +34,8 @@ public class CFRDecompiler extends JavaDecompiler {
|
||||||
final ClassWriter cw = new ClassWriter(0);
|
final ClassWriter cw = new ClassWriter(0);
|
||||||
cn.accept(cw);
|
cn.accept(cw);
|
||||||
|
|
||||||
String fileStart = BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp";
|
String fileStart = BytecodeViewer.tempDirectory + BytecodeViewer.fs
|
||||||
|
+ "temp";
|
||||||
int fileNumber = getClassNumber(fileStart, ".class");
|
int fileNumber = getClassNumber(fileStart, ".class");
|
||||||
|
|
||||||
final File tempClass = new File(fileStart + fileNumber + ".class");
|
final File tempClass = new File(fileStart + fileNumber + ".class");
|
||||||
|
@ -50,17 +51,18 @@ public class CFRDecompiler extends JavaDecompiler {
|
||||||
}
|
}
|
||||||
|
|
||||||
String fuckery = fuckery(fileStart);
|
String fuckery = fuckery(fileStart);
|
||||||
org.benf.cfr.reader.Main.main(generateMainMethod(tempClass.getAbsolutePath(), fuckery));
|
org.benf.cfr.reader.Main.main(generateMainMethod(
|
||||||
|
tempClass.getAbsolutePath(), fuckery));
|
||||||
|
|
||||||
tempClass.delete();
|
tempClass.delete();
|
||||||
|
|
||||||
|
|
||||||
return findFile(new File(fuckery).listFiles());
|
return findFile(new File(fuckery).listFiles());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Random r = new Random();
|
Random r = new Random();
|
||||||
File f;
|
File f;
|
||||||
|
|
||||||
public String fuckery(String start) {
|
public String fuckery(String start) {
|
||||||
boolean b = false;
|
boolean b = false;
|
||||||
while (!b) {
|
while (!b) {
|
||||||
|
@ -96,31 +98,40 @@ public class CFRDecompiler extends JavaDecompiler {
|
||||||
"--outputdir",
|
"--outputdir",
|
||||||
outputPath,
|
outputPath,
|
||||||
"--decodeenumswitch",
|
"--decodeenumswitch",
|
||||||
String.valueOf(BytecodeViewer.viewer.decodeenumswitch.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.decodeenumswitch
|
||||||
|
.isSelected()),
|
||||||
"--sugarenums",
|
"--sugarenums",
|
||||||
String.valueOf(BytecodeViewer.viewer.sugarenums.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.sugarenums.isSelected()),
|
||||||
"--decodestringswitch",
|
"--decodestringswitch",
|
||||||
String.valueOf(BytecodeViewer.viewer.decodestringswitch.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.decodestringswitch
|
||||||
|
.isSelected()),
|
||||||
"--arrayiter",
|
"--arrayiter",
|
||||||
String.valueOf(BytecodeViewer.viewer.arrayiter.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.arrayiter.isSelected()),
|
||||||
"--collectioniter",
|
"--collectioniter",
|
||||||
String.valueOf(BytecodeViewer.viewer.collectioniter.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.collectioniter
|
||||||
|
.isSelected()),
|
||||||
"--innerclasses",
|
"--innerclasses",
|
||||||
String.valueOf(BytecodeViewer.viewer.innerclasses.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.innerclasses.isSelected()),
|
||||||
"--removeboilerplate",
|
"--removeboilerplate",
|
||||||
String.valueOf(BytecodeViewer.viewer.removeboilerplate.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.removeboilerplate
|
||||||
|
.isSelected()),
|
||||||
"--removeinnerclasssynthetics",
|
"--removeinnerclasssynthetics",
|
||||||
String.valueOf(BytecodeViewer.viewer.removeinnerclasssynthetics.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.removeinnerclasssynthetics
|
||||||
|
.isSelected()),
|
||||||
"--decodelambdas",
|
"--decodelambdas",
|
||||||
String.valueOf(BytecodeViewer.viewer.decodelambdas.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.decodelambdas.isSelected()),
|
||||||
"--hidebridgemethods",
|
"--hidebridgemethods",
|
||||||
String.valueOf(BytecodeViewer.viewer.hidebridgemethods.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.hidebridgemethods
|
||||||
|
.isSelected()),
|
||||||
"--liftconstructorinit",
|
"--liftconstructorinit",
|
||||||
String.valueOf(BytecodeViewer.viewer.liftconstructorinit.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.liftconstructorinit
|
||||||
|
.isSelected()),
|
||||||
"--removedeadmethods",
|
"--removedeadmethods",
|
||||||
String.valueOf(BytecodeViewer.viewer.removedeadmethods.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.removedeadmethods
|
||||||
|
.isSelected()),
|
||||||
"--removebadgenerics",
|
"--removebadgenerics",
|
||||||
String.valueOf(BytecodeViewer.viewer.removebadgenerics.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.removebadgenerics
|
||||||
|
.isSelected()),
|
||||||
"--sugarasserts",
|
"--sugarasserts",
|
||||||
String.valueOf(BytecodeViewer.viewer.sugarasserts.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.sugarasserts.isSelected()),
|
||||||
"--sugarboxing",
|
"--sugarboxing",
|
||||||
|
@ -140,7 +151,8 @@ public class CFRDecompiler extends JavaDecompiler {
|
||||||
"--forcetopsort",
|
"--forcetopsort",
|
||||||
String.valueOf(BytecodeViewer.viewer.forcetopsort.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.forcetopsort.isSelected()),
|
||||||
"--forcetopsortaggress",
|
"--forcetopsortaggress",
|
||||||
String.valueOf(BytecodeViewer.viewer.forcetopsortaggress.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.forcetopsortaggress
|
||||||
|
.isSelected()),
|
||||||
"--stringbuffer",
|
"--stringbuffer",
|
||||||
String.valueOf(BytecodeViewer.viewer.stringbuffer.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.stringbuffer.isSelected()),
|
||||||
"--stringbuilder",
|
"--stringbuilder",
|
||||||
|
@ -154,50 +166,65 @@ public class CFRDecompiler extends JavaDecompiler {
|
||||||
"--override",
|
"--override",
|
||||||
String.valueOf(BytecodeViewer.viewer.override.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.override.isSelected()),
|
||||||
"--showinferrable",
|
"--showinferrable",
|
||||||
String.valueOf(BytecodeViewer.viewer.showinferrable.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.showinferrable
|
||||||
|
.isSelected()),
|
||||||
"--aexagg",
|
"--aexagg",
|
||||||
String.valueOf(BytecodeViewer.viewer.aexagg.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.aexagg.isSelected()),
|
||||||
"--forcecondpropagate",
|
"--forcecondpropagate",
|
||||||
String.valueOf(BytecodeViewer.viewer.forcecondpropagate.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.forcecondpropagate
|
||||||
|
.isSelected()),
|
||||||
"--hideutf",
|
"--hideutf",
|
||||||
String.valueOf(BytecodeViewer.viewer.hideutf.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.hideutf.isSelected()),
|
||||||
"--hidelongstrings",
|
"--hidelongstrings",
|
||||||
String.valueOf(BytecodeViewer.viewer.hidelongstrings.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.hidelongstrings
|
||||||
|
.isSelected()),
|
||||||
"--commentmonitors",
|
"--commentmonitors",
|
||||||
String.valueOf(BytecodeViewer.viewer.commentmonitor.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.commentmonitor
|
||||||
|
.isSelected()),
|
||||||
"--allowcorrecting",
|
"--allowcorrecting",
|
||||||
String.valueOf(BytecodeViewer.viewer.allowcorrecting.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.allowcorrecting
|
||||||
|
.isSelected()),
|
||||||
"--labelledblocks",
|
"--labelledblocks",
|
||||||
String.valueOf(BytecodeViewer.viewer.labelledblocks.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.labelledblocks
|
||||||
|
.isSelected()),
|
||||||
"--j14classobj",
|
"--j14classobj",
|
||||||
String.valueOf(BytecodeViewer.viewer.j14classobj.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.j14classobj.isSelected()),
|
||||||
"--hidelangimports",
|
"--hidelangimports",
|
||||||
String.valueOf(BytecodeViewer.viewer.hidelangimports.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.hidelangimports
|
||||||
|
.isSelected()),
|
||||||
"--recovertypeclash",
|
"--recovertypeclash",
|
||||||
String.valueOf(BytecodeViewer.viewer.recoverytypeclash.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.recoverytypeclash
|
||||||
|
.isSelected()),
|
||||||
"--recovertypehints",
|
"--recovertypehints",
|
||||||
String.valueOf(BytecodeViewer.viewer.recoverytypehints.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.recoverytypehints
|
||||||
|
.isSelected()),
|
||||||
"--forcereturningifs",
|
"--forcereturningifs",
|
||||||
String.valueOf(BytecodeViewer.viewer.forceturningifs.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.forceturningifs
|
||||||
|
.isSelected()),
|
||||||
"--forloopaggcapture",
|
"--forloopaggcapture",
|
||||||
String.valueOf(BytecodeViewer.viewer.forloopaggcapture.isSelected()),
|
String.valueOf(BytecodeViewer.viewer.forloopaggcapture
|
||||||
};
|
.isSelected()), };
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decompileToZip(String zipName) {
|
public void decompileToZip(String zipName) {
|
||||||
File tempZip = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp.jar");
|
File tempZip = new File(BytecodeViewer.tempDirectory
|
||||||
|
+ BytecodeViewer.fs + "temp.jar");
|
||||||
if (tempZip.exists())
|
if (tempZip.exists())
|
||||||
tempZip.delete();
|
tempZip.delete();
|
||||||
|
|
||||||
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), tempZip.getAbsolutePath());
|
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(),
|
||||||
|
tempZip.getAbsolutePath());
|
||||||
|
|
||||||
String fileStart = BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp";
|
String fileStart = BytecodeViewer.tempDirectory + BytecodeViewer.fs
|
||||||
|
+ "temp";
|
||||||
|
|
||||||
String fuckery = fuckery(fileStart);
|
String fuckery = fuckery(fileStart);
|
||||||
|
|
||||||
org.benf.cfr.reader.Main.main(generateMainMethod(tempZip.getAbsolutePath(), fuckery));
|
org.benf.cfr.reader.Main.main(generateMainMethod(
|
||||||
|
tempZip.getAbsolutePath(), fuckery));
|
||||||
|
|
||||||
tempZip.delete();
|
tempZip.delete();
|
||||||
File fuck = new File(fuckery);
|
File fuck = new File(fuckery);
|
||||||
|
@ -242,7 +269,8 @@ public class CFRDecompiler extends JavaDecompiler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void copy(InputStream in, OutputStream out) throws IOException {
|
private static void copy(InputStream in, OutputStream out)
|
||||||
|
throws IOException {
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
while (true) {
|
while (true) {
|
||||||
int readCount = in.read(buffer);
|
int readCount = in.read(buffer);
|
||||||
|
|
|
@ -28,18 +28,25 @@ public class FernFlowerDecompiler extends JavaDecompiler {
|
||||||
if (tempZip.exists())
|
if (tempZip.exists())
|
||||||
tempZip.delete();
|
tempZip.delete();
|
||||||
|
|
||||||
File f = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs +"temp" + BytecodeViewer.fs);
|
File f = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs
|
||||||
|
+ "temp" + BytecodeViewer.fs);
|
||||||
f.mkdir();
|
f.mkdir();
|
||||||
|
|
||||||
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), tempZip.getAbsolutePath());
|
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(),
|
||||||
|
tempZip.getAbsolutePath());
|
||||||
|
|
||||||
org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler.main(generateMainMethod(tempZip.getAbsolutePath(), BytecodeViewer.tempDirectory + "./temp/"));
|
org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler
|
||||||
File tempZip2 = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + BytecodeViewer.fs +tempZip.getName());
|
.main(generateMainMethod(tempZip.getAbsolutePath(),
|
||||||
|
BytecodeViewer.tempDirectory + "./temp/"));
|
||||||
|
File tempZip2 = new File(BytecodeViewer.tempDirectory
|
||||||
|
+ BytecodeViewer.fs + "temp" + BytecodeViewer.fs
|
||||||
|
+ tempZip.getName());
|
||||||
if (tempZip2.exists())
|
if (tempZip2.exists())
|
||||||
tempZip2.renameTo(new File(zipName));
|
tempZip2.renameTo(new File(zipName));
|
||||||
|
|
||||||
tempZip.delete();
|
tempZip.delete();
|
||||||
new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp").delete();
|
new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp")
|
||||||
|
.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -47,7 +54,8 @@ public class FernFlowerDecompiler extends JavaDecompiler {
|
||||||
final ClassWriter cw = new ClassWriter(0);
|
final ClassWriter cw = new ClassWriter(0);
|
||||||
cn.accept(cw);
|
cn.accept(cw);
|
||||||
|
|
||||||
String fileStart = BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp";
|
String fileStart = BytecodeViewer.tempDirectory + BytecodeViewer.fs
|
||||||
|
+ "temp";
|
||||||
int fileNumber = getClassNumber(fileStart, ".class");
|
int fileNumber = getClassNumber(fileStart, ".class");
|
||||||
|
|
||||||
final File tempClass = new File(fileStart + fileNumber + ".class");
|
final File tempClass = new File(fileStart + fileNumber + ".class");
|
||||||
|
@ -62,7 +70,8 @@ public class FernFlowerDecompiler extends JavaDecompiler {
|
||||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler.main(generateMainMethod(tempClass.getAbsolutePath(), "."));
|
org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler
|
||||||
|
.main(generateMainMethod(tempClass.getAbsolutePath(), "."));
|
||||||
|
|
||||||
tempClass.delete();
|
tempClass.delete();
|
||||||
|
|
||||||
|
@ -101,8 +110,7 @@ public class FernFlowerDecompiler extends JavaDecompiler {
|
||||||
"-udv=" + r(BytecodeViewer.viewer.udv.isSelected()),
|
"-udv=" + r(BytecodeViewer.viewer.udv.isSelected()),
|
||||||
"-rer=" + r(BytecodeViewer.viewer.rer.isSelected()),
|
"-rer=" + r(BytecodeViewer.viewer.rer.isSelected()),
|
||||||
"-fdi=" + r(BytecodeViewer.viewer.fdi.isSelected()),
|
"-fdi=" + r(BytecodeViewer.viewer.fdi.isSelected()),
|
||||||
"-asc="+r(BytecodeViewer.viewer.asc.isSelected()),
|
"-asc=" + r(BytecodeViewer.viewer.asc.isSelected()), className,
|
||||||
className,
|
|
||||||
folder };
|
folder };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,11 @@ import org.objectweb.asm.tree.ClassNode;
|
||||||
public abstract class JavaDecompiler {
|
public abstract class JavaDecompiler {
|
||||||
|
|
||||||
public abstract String decompileClassNode(ClassNode cn);
|
public abstract String decompileClassNode(ClassNode cn);
|
||||||
|
|
||||||
public abstract void decompileToZip(String zipName);
|
public abstract void decompileToZip(String zipName);
|
||||||
|
|
||||||
File tempF = null;
|
File tempF = null;
|
||||||
|
|
||||||
public int getClassNumber(String start, String ext) {
|
public int getClassNumber(String start, String ext) {
|
||||||
boolean b = true;
|
boolean b = true;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
|
@ -48,20 +48,34 @@ public class ProcyonDecompiler extends JavaDecompiler {
|
||||||
|
|
||||||
public DecompilerSettings getDecompilerSettings() {
|
public DecompilerSettings getDecompilerSettings() {
|
||||||
DecompilerSettings settings = new DecompilerSettings();
|
DecompilerSettings settings = new DecompilerSettings();
|
||||||
settings.setAlwaysGenerateExceptionVariableForCatchBlocks(BytecodeViewer.viewer.chckbxmntmNewCheckItem_6.isSelected());
|
settings.setAlwaysGenerateExceptionVariableForCatchBlocks(BytecodeViewer.viewer.chckbxmntmNewCheckItem_6
|
||||||
settings.setExcludeNestedTypes(BytecodeViewer.viewer.chckbxmntmNewCheckItem_11.isSelected());
|
.isSelected());
|
||||||
settings.setShowDebugLineNumbers(BytecodeViewer.viewer.chckbxmntmShowDebugLine.isSelected());
|
settings.setExcludeNestedTypes(BytecodeViewer.viewer.chckbxmntmNewCheckItem_11
|
||||||
settings.setIncludeLineNumbersInBytecode(BytecodeViewer.viewer.chckbxmntmNewCheckItem_3.isSelected());
|
.isSelected());
|
||||||
settings.setIncludeErrorDiagnostics(BytecodeViewer.viewer.chckbxmntmNewCheckItem_4.isSelected());
|
settings.setShowDebugLineNumbers(BytecodeViewer.viewer.chckbxmntmShowDebugLine
|
||||||
settings.setShowSyntheticMembers(BytecodeViewer.viewer.chckbxmntmNewCheckItem_7.isSelected());
|
.isSelected());
|
||||||
settings.setSimplifyMemberReferences(BytecodeViewer.viewer.chckbxmntmSimplifyMemberReferences.isSelected());
|
settings.setIncludeLineNumbersInBytecode(BytecodeViewer.viewer.chckbxmntmNewCheckItem_3
|
||||||
settings.setMergeVariables(BytecodeViewer.viewer.mnMergeVariables.isSelected());
|
.isSelected());
|
||||||
settings.setForceExplicitTypeArguments(BytecodeViewer.viewer.chckbxmntmNewCheckItem_8.isSelected());
|
settings.setIncludeErrorDiagnostics(BytecodeViewer.viewer.chckbxmntmNewCheckItem_4
|
||||||
settings.setForceExplicitImports(BytecodeViewer.viewer.chckbxmntmNewCheckItem_9.isSelected());
|
.isSelected());
|
||||||
settings.setFlattenSwitchBlocks(BytecodeViewer.viewer.chckbxmntmNewCheckItem_10.isSelected());
|
settings.setShowSyntheticMembers(BytecodeViewer.viewer.chckbxmntmNewCheckItem_7
|
||||||
settings.setRetainPointlessSwitches(BytecodeViewer.viewer.chckbxmntmNewCheckItem_2.isSelected());
|
.isSelected());
|
||||||
settings.setRetainRedundantCasts(BytecodeViewer.viewer.chckbxmntmNewCheckItem_5.isSelected());
|
settings.setSimplifyMemberReferences(BytecodeViewer.viewer.chckbxmntmSimplifyMemberReferences
|
||||||
settings.setUnicodeOutputEnabled(BytecodeViewer.viewer.chckbxmntmNewCheckItem_1.isSelected());
|
.isSelected());
|
||||||
|
settings.setMergeVariables(BytecodeViewer.viewer.mnMergeVariables
|
||||||
|
.isSelected());
|
||||||
|
settings.setForceExplicitTypeArguments(BytecodeViewer.viewer.chckbxmntmNewCheckItem_8
|
||||||
|
.isSelected());
|
||||||
|
settings.setForceExplicitImports(BytecodeViewer.viewer.chckbxmntmNewCheckItem_9
|
||||||
|
.isSelected());
|
||||||
|
settings.setFlattenSwitchBlocks(BytecodeViewer.viewer.chckbxmntmNewCheckItem_10
|
||||||
|
.isSelected());
|
||||||
|
settings.setRetainPointlessSwitches(BytecodeViewer.viewer.chckbxmntmNewCheckItem_2
|
||||||
|
.isSelected());
|
||||||
|
settings.setRetainRedundantCasts(BytecodeViewer.viewer.chckbxmntmNewCheckItem_5
|
||||||
|
.isSelected());
|
||||||
|
settings.setUnicodeOutputEnabled(BytecodeViewer.viewer.chckbxmntmNewCheckItem_1
|
||||||
|
.isSelected());
|
||||||
settings.setFormattingOptions(JavaFormattingOptions.createDefault());
|
settings.setFormattingOptions(JavaFormattingOptions.createDefault());
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +86,8 @@ public class ProcyonDecompiler extends JavaDecompiler {
|
||||||
final ClassWriter cw = new ClassWriter(0);
|
final ClassWriter cw = new ClassWriter(0);
|
||||||
cn.accept(cw);
|
cn.accept(cw);
|
||||||
|
|
||||||
String fileStart = BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp";
|
String fileStart = BytecodeViewer.tempDirectory + BytecodeViewer.fs
|
||||||
|
+ "temp";
|
||||||
int fileNumber = getClassNumber(fileStart, ".class");
|
int fileNumber = getClassNumber(fileStart, ".class");
|
||||||
|
|
||||||
final File tempClass = new File(fileStart + fileNumber + ".class");
|
final File tempClass = new File(fileStart + fileNumber + ".class");
|
||||||
|
@ -87,12 +102,12 @@ public class ProcyonDecompiler extends JavaDecompiler {
|
||||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DecompilerSettings settings = getDecompilerSettings();
|
DecompilerSettings settings = getDecompilerSettings();
|
||||||
|
|
||||||
LuytenTypeLoader typeLoader = new LuytenTypeLoader();
|
LuytenTypeLoader typeLoader = new LuytenTypeLoader();
|
||||||
MetadataSystem metadataSystem = new MetadataSystem(typeLoader);
|
MetadataSystem metadataSystem = new MetadataSystem(typeLoader);
|
||||||
TypeReference type = metadataSystem.lookupType(tempClass.getCanonicalPath());
|
TypeReference type = metadataSystem.lookupType(tempClass
|
||||||
|
.getCanonicalPath());
|
||||||
|
|
||||||
DecompilationOptions decompilationOptions = new DecompilationOptions();
|
DecompilationOptions decompilationOptions = new DecompilationOptions();
|
||||||
decompilationOptions.setSettings(DecompilerSettings.javaDefaults());
|
decompilationOptions.setSettings(DecompilerSettings.javaDefaults());
|
||||||
|
@ -103,10 +118,10 @@ public class ProcyonDecompiler extends JavaDecompiler {
|
||||||
throw new Exception("Unable to resolve type.");
|
throw new Exception("Unable to resolve type.");
|
||||||
}
|
}
|
||||||
StringWriter stringwriter = new StringWriter();
|
StringWriter stringwriter = new StringWriter();
|
||||||
settings.getLanguage().decompileType(resolvedType, new PlainTextOutput(stringwriter), decompilationOptions);
|
settings.getLanguage().decompileType(resolvedType,
|
||||||
|
new PlainTextOutput(stringwriter), decompilationOptions);
|
||||||
String decompiledSource = stringwriter.toString();
|
String decompiledSource = stringwriter.toString();
|
||||||
|
|
||||||
|
|
||||||
return decompiledSource;
|
return decompiledSource;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
||||||
|
@ -116,11 +131,13 @@ public class ProcyonDecompiler extends JavaDecompiler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decompileToZip(String zipName) {
|
public void decompileToZip(String zipName) {
|
||||||
File tempZip = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp.jar");
|
File tempZip = new File(BytecodeViewer.tempDirectory
|
||||||
|
+ BytecodeViewer.fs + "temp.jar");
|
||||||
if (tempZip.exists())
|
if (tempZip.exists())
|
||||||
tempZip.delete();
|
tempZip.delete();
|
||||||
|
|
||||||
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), tempZip.getAbsolutePath());
|
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(),
|
||||||
|
tempZip.getAbsolutePath());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
doSaveJarDecompiled(tempZip, new File(zipName));
|
doSaveJarDecompiled(tempZip, new File(zipName));
|
||||||
|
@ -134,7 +151,8 @@ public class ProcyonDecompiler extends JavaDecompiler {
|
||||||
* @author DeathMarine
|
* @author DeathMarine
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private void doSaveJarDecompiled(File inFile, File outFile) throws Exception {
|
private void doSaveJarDecompiled(File inFile, File outFile)
|
||||||
|
throws Exception {
|
||||||
try (JarFile jfile = new JarFile(inFile);
|
try (JarFile jfile = new JarFile(inFile);
|
||||||
FileOutputStream dest = new FileOutputStream(outFile);
|
FileOutputStream dest = new FileOutputStream(outFile);
|
||||||
BufferedOutputStream buffDest = new BufferedOutputStream(dest);
|
BufferedOutputStream buffDest = new BufferedOutputStream(dest);
|
||||||
|
@ -155,19 +173,24 @@ public class ProcyonDecompiler extends JavaDecompiler {
|
||||||
while (ent.hasMoreElements()) {
|
while (ent.hasMoreElements()) {
|
||||||
JarEntry entry = ent.nextElement();
|
JarEntry entry = ent.nextElement();
|
||||||
if (entry.getName().endsWith(".class")) {
|
if (entry.getName().endsWith(".class")) {
|
||||||
JarEntry etn = new JarEntry(entry.getName().replace(".class", ".java"));
|
JarEntry etn = new JarEntry(entry.getName().replace(
|
||||||
|
".class", ".java"));
|
||||||
if (history.add(etn)) {
|
if (history.add(etn)) {
|
||||||
out.putNextEntry(etn);
|
out.putNextEntry(etn);
|
||||||
try {
|
try {
|
||||||
String internalName = StringUtilities.removeRight(entry.getName(), ".class");
|
String internalName = StringUtilities.removeRight(
|
||||||
TypeReference type = metadataSystem.lookupType(internalName);
|
entry.getName(), ".class");
|
||||||
|
TypeReference type = metadataSystem
|
||||||
|
.lookupType(internalName);
|
||||||
TypeDefinition resolvedType = null;
|
TypeDefinition resolvedType = null;
|
||||||
if ((type == null) || ((resolvedType = type.resolve()) == null)) {
|
if ((type == null)
|
||||||
|
|| ((resolvedType = type.resolve()) == null)) {
|
||||||
throw new Exception("Unable to resolve type.");
|
throw new Exception("Unable to resolve type.");
|
||||||
}
|
}
|
||||||
Writer writer = new OutputStreamWriter(out);
|
Writer writer = new OutputStreamWriter(out);
|
||||||
settings.getLanguage().decompileType(resolvedType,
|
settings.getLanguage().decompileType(resolvedType,
|
||||||
new PlainTextOutput(writer), decompilationOptions);
|
new PlainTextOutput(writer),
|
||||||
|
decompilationOptions);
|
||||||
writer.flush();
|
writer.flush();
|
||||||
} finally {
|
} finally {
|
||||||
out.closeEntry();
|
out.closeEntry();
|
||||||
|
@ -196,7 +219,8 @@ public class ProcyonDecompiler extends JavaDecompiler {
|
||||||
out.closeEntry();
|
out.closeEntry();
|
||||||
}
|
}
|
||||||
} catch (ZipException ze) {
|
} catch (ZipException ze) {
|
||||||
// some jar-s contain duplicate pom.xml entries: ignore it
|
// some jar-s contain duplicate pom.xml entries: ignore
|
||||||
|
// it
|
||||||
if (!ze.getMessage().contains("duplicate")) {
|
if (!ze.getMessage().contains("duplicate")) {
|
||||||
throw ze;
|
throw ze;
|
||||||
}
|
}
|
||||||
|
@ -206,7 +230,6 @@ public class ProcyonDecompiler extends JavaDecompiler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author DeathMarine
|
* @author DeathMarine
|
||||||
|
@ -225,7 +248,8 @@ public class ProcyonDecompiler extends JavaDecompiler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean tryLoadType(final String internalName, final Buffer buffer) {
|
public boolean tryLoadType(final String internalName,
|
||||||
|
final Buffer buffer) {
|
||||||
for (final ITypeLoader typeLoader : _typeLoaders) {
|
for (final ITypeLoader typeLoader : _typeLoaders) {
|
||||||
if (typeLoader.tryLoadType(internalName, buffer)) {
|
if (typeLoader.tryLoadType(internalName, buffer)) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -23,7 +23,10 @@ public class AboutWindow extends JFrame {
|
||||||
txtrBytecodeViewerIs.setDisabledTextColor(Color.BLACK);
|
txtrBytecodeViewerIs.setDisabledTextColor(Color.BLACK);
|
||||||
txtrBytecodeViewerIs.setWrapStyleWord(true);
|
txtrBytecodeViewerIs.setWrapStyleWord(true);
|
||||||
getContentPane().add(txtrBytecodeViewerIs, "name_140466526081695");
|
getContentPane().add(txtrBytecodeViewerIs, "name_140466526081695");
|
||||||
txtrBytecodeViewerIs.setText("Bytecode Viewer " + BytecodeViewer.version+ " is an open source program\r\ndeveloped by Konloch (konloch@gmail.com)\r\nDir: "+BytecodeViewer.getBCVDirectory()+"\r\n\r\nIt uses code from the following:\r\n J-RET by WaterWolf\r\n JHexPane by Sam Koivu\r\n RSyntaxTextArea by Bobbylight\r\n Commons IO by Apache\r\n ASM by OW2\r\n CFIDE by Bibl\r\n FernFlower by Stiver\r\n Procyon by Mstrobel\r\n CFR by Lee Benfield\r\n\r\nIf you're interested in Java Reverse\r\nEngineering, join The Bytecode Club\r\nhttp://the.bytecode.club");
|
txtrBytecodeViewerIs
|
||||||
|
.setText("Bytecode Viewer 2.3.0 is an open source program\r\ndeveloped by Konloch (konloch@gmail.com)\r\nDir: "
|
||||||
|
+ BytecodeViewer.getBCVDirectory()
|
||||||
|
+ "\r\n\r\nIt uses code from the following:\r\n J-RET by WaterWolf\r\n JHexPane by Sam Koivu\r\n RSyntaxTextArea by Bobbylight\r\n Commons IO by Apache\r\n ASM by OW2\r\n CFIDE by Bibl\r\n FernFlower by Stiver\r\n Procyon by Mstrobel\r\n CFR by Lee Benfield\r\n\r\nIf you're interested in Java Reverse\r\nEngineering, join The Bytecode Club\r\nhttps://the.bytecode.club");
|
||||||
txtrBytecodeViewerIs.setEnabled(false);
|
txtrBytecodeViewerIs.setEnabled(false);
|
||||||
this.setResizable(false);
|
this.setResizable(false);
|
||||||
this.setLocationRelativeTo(null);
|
this.setLocationRelativeTo(null);
|
||||||
|
|
|
@ -14,16 +14,12 @@ import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.KeyListener;
|
import java.awt.event.KeyListener;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import static javax.swing.ScrollPaneConstants.*;
|
|
||||||
|
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JScrollPane;
|
|
||||||
import javax.swing.JSplitPane;
|
import javax.swing.JSplitPane;
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
import javax.swing.SwingUtilities;
|
|
||||||
import javax.swing.text.AbstractDocument;
|
import javax.swing.text.AbstractDocument;
|
||||||
import javax.swing.text.BoxView;
|
import javax.swing.text.BoxView;
|
||||||
import javax.swing.text.ComponentView;
|
import javax.swing.text.ComponentView;
|
||||||
|
@ -64,10 +60,9 @@ import the.bytecode.club.bytecodeviewer.decompilers.java.ProcyonDecompiler;
|
||||||
|
|
||||||
public class ClassViewer extends JPanel {
|
public class ClassViewer extends JPanel {
|
||||||
|
|
||||||
private boolean sourcePane = false, bytecodePane = false, hexPane = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whoever wrote this function, THANK YOU!
|
* Whoever wrote this function, THANK YOU!
|
||||||
|
*
|
||||||
* @param splitter
|
* @param splitter
|
||||||
* @param proportion
|
* @param proportion
|
||||||
* @return
|
* @return
|
||||||
|
@ -77,8 +72,7 @@ public class ClassViewer extends JPanel {
|
||||||
if (splitter.isShowing()) {
|
if (splitter.isShowing()) {
|
||||||
if (splitter.getWidth() > 0 && splitter.getHeight() > 0) {
|
if (splitter.getWidth() > 0 && splitter.getHeight() > 0) {
|
||||||
splitter.setDividerLocation(proportion);
|
splitter.setDividerLocation(proportion);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
splitter.addComponentListener(new ComponentAdapter() {
|
splitter.addComponentListener(new ComponentAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void componentResized(ComponentEvent ce) {
|
public void componentResized(ComponentEvent ce) {
|
||||||
|
@ -87,13 +81,12 @@ public class ClassViewer extends JPanel {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
splitter.addHierarchyListener(new HierarchyListener() {
|
splitter.addHierarchyListener(new HierarchyListener() {
|
||||||
@Override
|
@Override
|
||||||
public void hierarchyChanged(HierarchyEvent e) {
|
public void hierarchyChanged(HierarchyEvent e) {
|
||||||
if((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0 &&
|
if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0
|
||||||
splitter.isShowing()) {
|
&& splitter.isShowing()) {
|
||||||
splitter.removeHierarchyListener(this);
|
splitter.removeHierarchyListener(this);
|
||||||
setDividerLocation(splitter, proportion);
|
setDividerLocation(splitter, proportion);
|
||||||
}
|
}
|
||||||
|
@ -109,12 +102,18 @@ public class ClassViewer extends JPanel {
|
||||||
ClassNode cn;
|
ClassNode cn;
|
||||||
JSplitPane sp;
|
JSplitPane sp;
|
||||||
JSplitPane sp2;
|
JSplitPane sp2;
|
||||||
public JCheckBox byteCheck = new JCheckBox("Exact");
|
public JPanel panel1Search = new JPanel(new BorderLayout());
|
||||||
public JPanel bytePanelSearch = new JPanel(new BorderLayout());
|
public JPanel panel2Search = new JPanel(new BorderLayout());
|
||||||
public JPanel decompPanelSearch = new JPanel(new BorderLayout());
|
public JPanel panel3Search = new JPanel(new BorderLayout());
|
||||||
public JCheckBox decompCheck = new JCheckBox("Exact");
|
public JCheckBox check1 = new JCheckBox("Exact");
|
||||||
public JPanel bytePanel = new JPanel(new BorderLayout());
|
public JCheckBox check2 = new JCheckBox("Exact");
|
||||||
public JPanel decompPanel = new JPanel(new BorderLayout());
|
public JCheckBox check3 = new JCheckBox("Exact");
|
||||||
|
public JPanel panel1 = new JPanel(new BorderLayout());
|
||||||
|
public JPanel panel2 = new JPanel(new BorderLayout());
|
||||||
|
public JPanel panel3 = new JPanel(new BorderLayout());
|
||||||
|
int pane1 = -1;
|
||||||
|
int pane2 = -1;
|
||||||
|
int pane3 = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This was really interesting to write.
|
* This was really interesting to write.
|
||||||
|
@ -126,23 +125,27 @@ public class ClassViewer extends JPanel {
|
||||||
try {
|
try {
|
||||||
Component[] com = null;
|
Component[] com = null;
|
||||||
if (pane == 0) // bytecode
|
if (pane == 0) // bytecode
|
||||||
com = bytePanel.getComponents();
|
com = panel1.getComponents();
|
||||||
else if (pane == 1)
|
else if (pane == 1)
|
||||||
com = decompPanel.getComponents();
|
com = panel2.getComponents();
|
||||||
|
else if (pane == 2)
|
||||||
|
com = panel3.getComponents();
|
||||||
|
|
||||||
if (com == null) // someone fucked up, lets prevent a nullpointer.
|
if (com == null) // someone fucked up, lets prevent a nullpointer.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Component c : com) {
|
for (Component c : com) {
|
||||||
if (c instanceof RTextScrollPane) {
|
if (c instanceof RTextScrollPane) {
|
||||||
RSyntaxTextArea area = (RSyntaxTextArea) ((RTextScrollPane)c).getViewport().getComponent(0);
|
RSyntaxTextArea area = (RSyntaxTextArea) ((RTextScrollPane) c)
|
||||||
|
.getViewport().getComponent(0);
|
||||||
|
|
||||||
if (search.isEmpty()) {
|
if (search.isEmpty()) {
|
||||||
highlight(pane, area, "");
|
highlight(pane, area, "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int startLine = area.getDocument().getDefaultRootElement().getElementIndex(area.getCaretPosition())+1;
|
int startLine = area.getDocument().getDefaultRootElement()
|
||||||
|
.getElementIndex(area.getCaretPosition()) + 1;
|
||||||
int currentLine = 1;
|
int currentLine = 1;
|
||||||
boolean canSearch = false;
|
boolean canSearch = false;
|
||||||
String[] test = null;
|
String[] test = null;
|
||||||
|
@ -156,9 +159,8 @@ public class ClassViewer extends JPanel {
|
||||||
|
|
||||||
if (next) {
|
if (next) {
|
||||||
for (String s : test) {
|
for (String s : test) {
|
||||||
if(pane == 0 && !byteCheck.isSelected() ||
|
if (pane == 0 && !check1.isSelected() || pane == 1
|
||||||
pane == 1 && !decompCheck.isSelected())
|
&& !check2.isSelected()) {
|
||||||
{
|
|
||||||
s = s.toLowerCase();
|
s = s.toLowerCase();
|
||||||
search = search.toLowerCase();
|
search = search.toLowerCase();
|
||||||
}
|
}
|
||||||
|
@ -168,7 +170,8 @@ public class ClassViewer extends JPanel {
|
||||||
} else if (s.contains(search)) {
|
} else if (s.contains(search)) {
|
||||||
if (canSearch) {
|
if (canSearch) {
|
||||||
area.setCaretPosition(area.getDocument()
|
area.setCaretPosition(area.getDocument()
|
||||||
.getDefaultRootElement().getElement(currentLine-1)
|
.getDefaultRootElement()
|
||||||
|
.getElement(currentLine - 1)
|
||||||
.getStartOffset());
|
.getStartOffset());
|
||||||
canSearch = false;
|
canSearch = false;
|
||||||
found = true;
|
found = true;
|
||||||
|
@ -183,15 +186,15 @@ public class ClassViewer extends JPanel {
|
||||||
|
|
||||||
if (!found && firstPos != -1) {
|
if (!found && firstPos != -1) {
|
||||||
area.setCaretPosition(area.getDocument()
|
area.setCaretPosition(area.getDocument()
|
||||||
.getDefaultRootElement().getElement(firstPos-1)
|
.getDefaultRootElement()
|
||||||
.getStartOffset());
|
.getElement(firstPos - 1).getStartOffset());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
canSearch = true;
|
canSearch = true;
|
||||||
for (String s : test) {
|
for (String s : test) {
|
||||||
if(pane == 0 && !byteCheck.isSelected() ||
|
if (pane == 0 && !check1.isSelected() || pane == 1
|
||||||
pane == 1 && !decompCheck.isSelected())
|
&& !check2.isSelected() || pane == 2
|
||||||
{
|
&& !check3.isSelected()) {
|
||||||
s = s.toLowerCase();
|
s = s.toLowerCase();
|
||||||
search = search.toLowerCase();
|
search = search.toLowerCase();
|
||||||
}
|
}
|
||||||
|
@ -199,7 +202,8 @@ public class ClassViewer extends JPanel {
|
||||||
if (s.contains(search)) {
|
if (s.contains(search)) {
|
||||||
if (lastGoodLine != -1 && canSearch)
|
if (lastGoodLine != -1 && canSearch)
|
||||||
area.setCaretPosition(area.getDocument()
|
area.setCaretPosition(area.getDocument()
|
||||||
.getDefaultRootElement().getElement(lastGoodLine-1)
|
.getDefaultRootElement()
|
||||||
|
.getElement(lastGoodLine - 1)
|
||||||
.getStartOffset());
|
.getStartOffset());
|
||||||
|
|
||||||
lastGoodLine = currentLine;
|
lastGoodLine = currentLine;
|
||||||
|
@ -210,9 +214,14 @@ public class ClassViewer extends JPanel {
|
||||||
currentLine++;
|
currentLine++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(lastGoodLine != -1 && area.getDocument().getDefaultRootElement().getElementIndex(area.getCaretPosition())+1 == startLine) {
|
if (lastGoodLine != -1
|
||||||
|
&& area.getDocument()
|
||||||
|
.getDefaultRootElement()
|
||||||
|
.getElementIndex(
|
||||||
|
area.getCaretPosition()) + 1 == startLine) {
|
||||||
area.setCaretPosition(area.getDocument()
|
area.setCaretPosition(area.getDocument()
|
||||||
.getDefaultRootElement().getElement(lastGoodLine-1)
|
.getDefaultRootElement()
|
||||||
|
.getElement(lastGoodLine - 1)
|
||||||
.getStartOffset());
|
.getStartOffset());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -224,7 +233,8 @@ public class ClassViewer extends JPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private DefaultHighlighter.DefaultHighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter(new Color(255,62,150));
|
private DefaultHighlighter.DefaultHighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter(
|
||||||
|
new Color(255, 62, 150));
|
||||||
|
|
||||||
public void highlight(int pane, JTextComponent textComp, String pattern) {
|
public void highlight(int pane, JTextComponent textComp, String pattern) {
|
||||||
if (pattern.isEmpty()) {
|
if (pattern.isEmpty()) {
|
||||||
|
@ -239,14 +249,17 @@ public class ClassViewer extends JPanel {
|
||||||
String text = doc.getText(0, doc.getLength());
|
String text = doc.getText(0, doc.getLength());
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
if((pane == 0 && !byteCheck.isSelected()) || pane == 1 && !decompCheck.isSelected()) {
|
if ((pane == 0 && !check1.isSelected()) || pane == 1
|
||||||
|
&& !check2.isSelected() || pane == 2
|
||||||
|
&& !check3.isSelected()) {
|
||||||
pattern = pattern.toLowerCase();
|
pattern = pattern.toLowerCase();
|
||||||
text = text.toLowerCase();
|
text = text.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search for pattern
|
// Search for pattern
|
||||||
while ((pos = text.indexOf(pattern, pos)) >= 0) {
|
while ((pos = text.indexOf(pattern, pos)) >= 0) {
|
||||||
// Create highlighter using private painter and apply around pattern
|
// Create highlighter using private painter and apply around
|
||||||
|
// pattern
|
||||||
hilite.addHighlight(pos, pos + pattern.length(), painter);
|
hilite.addHighlight(pos, pos + pattern.length(), painter);
|
||||||
pos += pattern.length();
|
pos += pattern.length();
|
||||||
}
|
}
|
||||||
|
@ -261,106 +274,152 @@ public class ClassViewer extends JPanel {
|
||||||
JPanel byteButtonPane = new JPanel(new BorderLayout());
|
JPanel byteButtonPane = new JPanel(new BorderLayout());
|
||||||
byteButtonPane.add(byteSearchNext, BorderLayout.WEST);
|
byteButtonPane.add(byteSearchNext, BorderLayout.WEST);
|
||||||
byteButtonPane.add(byteSearchPrev, BorderLayout.EAST);
|
byteButtonPane.add(byteSearchPrev, BorderLayout.EAST);
|
||||||
byteSearchNext.setIcon(new ImageIcon(BytecodeViewer.b642IMG("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAABnRSTlMANzlYqPBJSG/ZAAAASUlEQVR42mNgwAbS0oAEE4yHyWBmYAzjYDC694OJ4f9+BoY3H0BSbz6A2MxA6VciFyDqGAWQTWVkYEkCUrcOsDD8OwtkvMViMwAb8xEUHlHcFAAAAABJRU5ErkJggg==")));
|
byteSearchNext
|
||||||
byteSearchPrev.setIcon(new ImageIcon(BytecodeViewer.b642IMG("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAABnRSTlMANzlYgKhxpRi1AAAATElEQVR42mNgwAZYHIAEExA7qUAYLApMDmCGEwODCojByM/A8FEAyPi/moFh9QewYjCAM1iA+D2KqYwMrIlA6tUGFoa/Z4GMt1hsBgCe1wuKber+SwAAAABJRU5ErkJggg==")));
|
.setIcon(new ImageIcon(
|
||||||
bytePanelSearch.add(byteButtonPane, BorderLayout.WEST);
|
BytecodeViewer
|
||||||
final JTextField byteField = new JTextField();
|
.b642IMG("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAABnRSTlMANzlYqPBJSG/ZAAAASUlEQVR42mNgwAbS0oAEE4yHyWBmYAzjYDC694OJ4f9+BoY3H0BSbz6A2MxA6VciFyDqGAWQTWVkYEkCUrcOsDD8OwtkvMViMwAb8xEUHlHcFAAAAABJRU5ErkJggg==")));
|
||||||
bytePanelSearch.add(byteField, BorderLayout.CENTER);
|
byteSearchPrev
|
||||||
bytePanelSearch.add(byteCheck, BorderLayout.EAST);
|
.setIcon(new ImageIcon(
|
||||||
|
BytecodeViewer
|
||||||
|
.b642IMG("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAABnRSTlMANzlYgKhxpRi1AAAATElEQVR42mNgwAZYHIAEExA7qUAYLApMDmCGEwODCojByM/A8FEAyPi/moFh9QewYjCAM1iA+D2KqYwMrIlA6tUGFoa/Z4GMt1hsBgCe1wuKber+SwAAAABJRU5ErkJggg==")));
|
||||||
|
panel1Search.add(byteButtonPane, BorderLayout.WEST);
|
||||||
|
final JTextField field1 = new JTextField();
|
||||||
|
panel1Search.add(field1, BorderLayout.CENTER);
|
||||||
|
panel1Search.add(check1, BorderLayout.EAST);
|
||||||
byteSearchNext.addActionListener(new ActionListener() {
|
byteSearchNext.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
search(0,byteField.getText(), true);
|
search(0, field1.getText(), true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
byteSearchPrev.addActionListener(new ActionListener() {
|
byteSearchPrev.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
search(0,byteField.getText(), false);
|
search(0, field1.getText(), false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
byteField.addKeyListener(new KeyListener() {
|
field1.addKeyListener(new KeyListener() {
|
||||||
@Override
|
@Override
|
||||||
public void keyReleased(KeyEvent arg0) {
|
public void keyReleased(KeyEvent arg0) {
|
||||||
if (arg0.getKeyCode() == KeyEvent.VK_ENTER)
|
if (arg0.getKeyCode() == KeyEvent.VK_ENTER)
|
||||||
search(0,byteField.getText(), true);
|
search(0, field1.getText(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void keyPressed(KeyEvent arg0) {}
|
public void keyPressed(KeyEvent arg0) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void keyTyped(KeyEvent arg0) {}
|
public void keyTyped(KeyEvent arg0) {
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
JButton decompSearchNext = new JButton();
|
JButton searchNext2 = new JButton();
|
||||||
JButton decompSearchPrev = new JButton();
|
JButton searchPrev2 = new JButton();
|
||||||
JPanel decompButtonPane = new JPanel(new BorderLayout());
|
JPanel buttonPane2 = new JPanel(new BorderLayout());
|
||||||
decompButtonPane.add(decompSearchNext, BorderLayout.WEST);
|
buttonPane2.add(searchNext2, BorderLayout.WEST);
|
||||||
decompButtonPane.add(decompSearchPrev, BorderLayout.EAST);
|
buttonPane2.add(searchPrev2, BorderLayout.EAST);
|
||||||
decompSearchNext.setIcon(new ImageIcon(BytecodeViewer.b642IMG("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAABnRSTlMANzlYqPBJSG/ZAAAASUlEQVR42mNgwAbS0oAEE4yHyWBmYAzjYDC694OJ4f9+BoY3H0BSbz6A2MxA6VciFyDqGAWQTWVkYEkCUrcOsDD8OwtkvMViMwAb8xEUHlHcFAAAAABJRU5ErkJggg==")));
|
searchNext2
|
||||||
decompSearchPrev.setIcon(new ImageIcon(BytecodeViewer.b642IMG("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAABnRSTlMANzlYgKhxpRi1AAAATElEQVR42mNgwAZYHIAEExA7qUAYLApMDmCGEwODCojByM/A8FEAyPi/moFh9QewYjCAM1iA+D2KqYwMrIlA6tUGFoa/Z4GMt1hsBgCe1wuKber+SwAAAABJRU5ErkJggg==")));
|
.setIcon(new ImageIcon(
|
||||||
decompPanelSearch.add(decompButtonPane, BorderLayout.WEST);
|
BytecodeViewer
|
||||||
final JTextField decompField = new JTextField();
|
.b642IMG("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAABnRSTlMANzlYqPBJSG/ZAAAASUlEQVR42mNgwAbS0oAEE4yHyWBmYAzjYDC694OJ4f9+BoY3H0BSbz6A2MxA6VciFyDqGAWQTWVkYEkCUrcOsDD8OwtkvMViMwAb8xEUHlHcFAAAAABJRU5ErkJggg==")));
|
||||||
decompPanelSearch.add(decompField, BorderLayout.CENTER);
|
searchPrev2
|
||||||
decompPanelSearch.add(decompCheck, BorderLayout.EAST);
|
.setIcon(new ImageIcon(
|
||||||
decompSearchNext.addActionListener(new ActionListener() {
|
BytecodeViewer
|
||||||
|
.b642IMG("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAABnRSTlMANzlYgKhxpRi1AAAATElEQVR42mNgwAZYHIAEExA7qUAYLApMDmCGEwODCojByM/A8FEAyPi/moFh9QewYjCAM1iA+D2KqYwMrIlA6tUGFoa/Z4GMt1hsBgCe1wuKber+SwAAAABJRU5ErkJggg==")));
|
||||||
|
panel2Search.add(buttonPane2, BorderLayout.WEST);
|
||||||
|
final JTextField field2 = new JTextField();
|
||||||
|
panel2Search.add(field2, BorderLayout.CENTER);
|
||||||
|
panel2Search.add(check2, BorderLayout.EAST);
|
||||||
|
searchNext2.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
search(1,decompField.getText(), true);
|
search(1, field2.getText(), true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
decompSearchPrev.addActionListener(new ActionListener() {
|
searchPrev2.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
search(1,decompField.getText(), false);
|
search(1, field2.getText(), false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
decompField.addKeyListener(new KeyListener() {
|
field2.addKeyListener(new KeyListener() {
|
||||||
@Override
|
@Override
|
||||||
public void keyReleased(KeyEvent arg0) {
|
public void keyReleased(KeyEvent arg0) {
|
||||||
if (arg0.getKeyCode() == KeyEvent.VK_ENTER)
|
if (arg0.getKeyCode() == KeyEvent.VK_ENTER)
|
||||||
search(1,decompField.getText(), true);
|
search(1, field2.getText(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void keyPressed(KeyEvent arg0) {}
|
public void keyPressed(KeyEvent arg0) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void keyTyped(KeyEvent arg0) {}
|
public void keyTyped(KeyEvent arg0) {
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
sourcePane = BytecodeViewer.viewer.sourcePane.isSelected();
|
JButton searchNext3 = new JButton();
|
||||||
bytecodePane = BytecodeViewer.viewer.bytecodePane.isSelected();
|
JButton searchPrev3 = new JButton();
|
||||||
hexPane = BytecodeViewer.viewer.hexPane.isSelected();
|
JPanel buttonPane3 = new JPanel(new BorderLayout());
|
||||||
|
buttonPane3.add(searchNext3, BorderLayout.WEST);
|
||||||
|
buttonPane3.add(searchPrev3, BorderLayout.EAST);
|
||||||
|
searchNext3
|
||||||
|
.setIcon(new ImageIcon(
|
||||||
|
BytecodeViewer
|
||||||
|
.b642IMG("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAABnRSTlMANzlYqPBJSG/ZAAAASUlEQVR42mNgwAbS0oAEE4yHyWBmYAzjYDC694OJ4f9+BoY3H0BSbz6A2MxA6VciFyDqGAWQTWVkYEkCUrcOsDD8OwtkvMViMwAb8xEUHlHcFAAAAABJRU5ErkJggg==")));
|
||||||
|
searchPrev3
|
||||||
|
.setIcon(new ImageIcon(
|
||||||
|
BytecodeViewer
|
||||||
|
.b642IMG("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAABnRSTlMANzlYgKhxpRi1AAAATElEQVR42mNgwAZYHIAEExA7qUAYLApMDmCGEwODCojByM/A8FEAyPi/moFh9QewYjCAM1iA+D2KqYwMrIlA6tUGFoa/Z4GMt1hsBgCe1wuKber+SwAAAABJRU5ErkJggg==")));
|
||||||
|
panel3Search.add(buttonPane3, BorderLayout.WEST);
|
||||||
|
final JTextField field3 = new JTextField();
|
||||||
|
panel3Search.add(field3, BorderLayout.CENTER);
|
||||||
|
panel3Search.add(check3, BorderLayout.EAST);
|
||||||
|
searchNext3.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
|
search(2, field3.getText(), true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
searchPrev3.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
|
search(2, field3.getText(), false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
field3.addKeyListener(new KeyListener() {
|
||||||
|
@Override
|
||||||
|
public void keyReleased(KeyEvent arg0) {
|
||||||
|
if (arg0.getKeyCode() == KeyEvent.VK_ENTER)
|
||||||
|
search(2, field3.getText(), true);
|
||||||
|
}
|
||||||
|
|
||||||
if(bytecodePane)
|
@Override
|
||||||
bytePanel.add(bytePanelSearch, BorderLayout.NORTH);
|
public void keyPressed(KeyEvent arg0) {
|
||||||
if(sourcePane)
|
}
|
||||||
decompPanel.add(decompPanelSearch, BorderLayout.NORTH);
|
|
||||||
|
@Override
|
||||||
|
public void keyTyped(KeyEvent arg0) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.cn = cn;
|
this.cn = cn;
|
||||||
this.setName(name);
|
this.setName(name);
|
||||||
this.setLayout(new BorderLayout());
|
this.setLayout(new BorderLayout());
|
||||||
|
|
||||||
this.sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, decompPanel, bytePanel);
|
this.sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panel1, panel2);
|
||||||
final ClassWriter cw = new ClassWriter(0);
|
final ClassWriter cw = new ClassWriter(0);
|
||||||
cn.accept(cw);
|
cn.accept(cw);
|
||||||
JHexEditor hex = new JHexEditor(cw.toByteArray());
|
JHexEditor hex = new JHexEditor(cw.toByteArray());
|
||||||
JScrollPane penis;
|
this.sp2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp, panel3);
|
||||||
if(hexPane) {
|
|
||||||
penis = new JScrollPane(hex);
|
|
||||||
} else {
|
|
||||||
penis = new JScrollPane();
|
|
||||||
}
|
|
||||||
penis.setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_NEVER);
|
|
||||||
this.sp2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp, penis);
|
|
||||||
this.add(sp2, BorderLayout.CENTER);
|
this.add(sp2, BorderLayout.CENTER);
|
||||||
|
|
||||||
hex.setMaximumSize(new Dimension(0, Integer.MAX_VALUE));
|
hex.setMaximumSize(new Dimension(0, Integer.MAX_VALUE));
|
||||||
hex.setSize(0, Integer.MAX_VALUE);
|
hex.setSize(0, Integer.MAX_VALUE);
|
||||||
resetDivider();
|
|
||||||
BytecodeViewer.viewer.setIcon(true);
|
|
||||||
|
|
||||||
|
BytecodeViewer.viewer.setIcon(true);
|
||||||
startPaneUpdater();
|
startPaneUpdater();
|
||||||
this.addComponentListener(new ComponentAdapter() {
|
this.addComponentListener(new ComponentAdapter() {
|
||||||
public void componentResized(ComponentEvent e) {
|
public void componentResized(ComponentEvent e) {
|
||||||
|
@ -370,19 +429,22 @@ public class ClassViewer extends JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetDivider() {
|
public void resetDivider() {
|
||||||
if(!sourcePane) {
|
|
||||||
sp.setResizeWeight(0);
|
|
||||||
} else if(!bytecodePane) {
|
|
||||||
sp.setResizeWeight(1);
|
|
||||||
} else {
|
|
||||||
sp.setResizeWeight(0.5);
|
sp.setResizeWeight(0.5);
|
||||||
}
|
if (pane2 != 0 && pane1 != 0)
|
||||||
if(hexPane) {
|
sp = setDividerLocation(sp, 0.5);
|
||||||
if(!sourcePane && !bytecodePane)
|
else if (pane1 != 0)
|
||||||
sp2 = setDividerLocation(sp2, 0);
|
sp = setDividerLocation(sp, 1);
|
||||||
else
|
else
|
||||||
|
sp = setDividerLocation(sp, 0);
|
||||||
|
if (pane3 != 0) {
|
||||||
|
sp2.setResizeWeight(0.7);
|
||||||
sp2 = setDividerLocation(sp2, 0.7);
|
sp2 = setDividerLocation(sp2, 0.7);
|
||||||
|
if ((pane2 == 0 && pane1 != 0) || (pane1 == 0 && pane2 != 0))
|
||||||
|
sp2 = setDividerLocation(sp2, 0.5);
|
||||||
|
else if (pane1 == 0 && pane2 == 0)
|
||||||
|
sp2 = setDividerLocation(sp2, 0);
|
||||||
} else {
|
} else {
|
||||||
|
sp2.setResizeWeight(0);
|
||||||
sp2 = setDividerLocation(sp2, 1);
|
sp2 = setDividerLocation(sp2, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -391,55 +453,245 @@ public class ClassViewer extends JPanel {
|
||||||
static ProcyonDecompiler proc_dc = new ProcyonDecompiler();
|
static ProcyonDecompiler proc_dc = new ProcyonDecompiler();
|
||||||
static CFRDecompiler cfr_dc = new CFRDecompiler();
|
static CFRDecompiler cfr_dc = new CFRDecompiler();
|
||||||
PaneUpdaterThread t;
|
PaneUpdaterThread t;
|
||||||
|
|
||||||
public void startPaneUpdater() {
|
public void startPaneUpdater() {
|
||||||
|
if (BytecodeViewer.viewer.decompilerGroup1
|
||||||
|
.isSelected(BytecodeViewer.viewer.panel1None.getModel()))
|
||||||
|
pane1 = 0;
|
||||||
|
else if (BytecodeViewer.viewer.decompilerGroup1
|
||||||
|
.isSelected(BytecodeViewer.viewer.panel1Proc.getModel()))
|
||||||
|
pane1 = 1;
|
||||||
|
else if (BytecodeViewer.viewer.decompilerGroup1
|
||||||
|
.isSelected(BytecodeViewer.viewer.panel1CFR.getModel()))
|
||||||
|
pane1 = 2;
|
||||||
|
else if (BytecodeViewer.viewer.decompilerGroup1
|
||||||
|
.isSelected(BytecodeViewer.viewer.panel1Fern.getModel()))
|
||||||
|
pane1 = 3;
|
||||||
|
else if (BytecodeViewer.viewer.decompilerGroup1
|
||||||
|
.isSelected(BytecodeViewer.viewer.panel1Bytecode.getModel()))
|
||||||
|
pane1 = 4;
|
||||||
|
else if (BytecodeViewer.viewer.decompilerGroup1
|
||||||
|
.isSelected(BytecodeViewer.viewer.panel1Hexcode.getModel()))
|
||||||
|
pane1 = 5;
|
||||||
|
|
||||||
|
if (BytecodeViewer.viewer.decompilerGroup2
|
||||||
|
.isSelected(BytecodeViewer.viewer.panel2None.getModel()))
|
||||||
|
pane2 = 0;
|
||||||
|
else if (BytecodeViewer.viewer.decompilerGroup2
|
||||||
|
.isSelected(BytecodeViewer.viewer.panel2Proc.getModel()))
|
||||||
|
pane2 = 1;
|
||||||
|
else if (BytecodeViewer.viewer.decompilerGroup2
|
||||||
|
.isSelected(BytecodeViewer.viewer.panel2CFR.getModel()))
|
||||||
|
pane2 = 2;
|
||||||
|
else if (BytecodeViewer.viewer.decompilerGroup2
|
||||||
|
.isSelected(BytecodeViewer.viewer.panel2Fern.getModel()))
|
||||||
|
pane2 = 3;
|
||||||
|
else if (BytecodeViewer.viewer.decompilerGroup2
|
||||||
|
.isSelected(BytecodeViewer.viewer.panel2Bytecode.getModel()))
|
||||||
|
pane2 = 4;
|
||||||
|
else if (BytecodeViewer.viewer.decompilerGroup2
|
||||||
|
.isSelected(BytecodeViewer.viewer.panel2Hexcode.getModel()))
|
||||||
|
pane2 = 5;
|
||||||
|
|
||||||
|
if (BytecodeViewer.viewer.decompilerGroup3
|
||||||
|
.isSelected(BytecodeViewer.viewer.panel3None.getModel()))
|
||||||
|
pane3 = 0;
|
||||||
|
else if (BytecodeViewer.viewer.decompilerGroup3
|
||||||
|
.isSelected(BytecodeViewer.viewer.panel3Proc.getModel()))
|
||||||
|
pane3 = 1;
|
||||||
|
else if (BytecodeViewer.viewer.decompilerGroup3
|
||||||
|
.isSelected(BytecodeViewer.viewer.panel3CFR.getModel()))
|
||||||
|
pane3 = 2;
|
||||||
|
else if (BytecodeViewer.viewer.decompilerGroup3
|
||||||
|
.isSelected(BytecodeViewer.viewer.panel3Fern.getModel()))
|
||||||
|
pane3 = 3;
|
||||||
|
else if (BytecodeViewer.viewer.decompilerGroup3
|
||||||
|
.isSelected(BytecodeViewer.viewer.panel3Bytecode.getModel()))
|
||||||
|
pane3 = 4;
|
||||||
|
else if (BytecodeViewer.viewer.decompilerGroup3
|
||||||
|
.isSelected(BytecodeViewer.viewer.panel3Hexcode.getModel()))
|
||||||
|
pane3 = 5;
|
||||||
|
|
||||||
t = new PaneUpdaterThread() {
|
t = new PaneUpdaterThread() {
|
||||||
String s = "";
|
|
||||||
@Override
|
@Override
|
||||||
public void doShit() {
|
public void doShit() {
|
||||||
final String b = ClassNodeDecompiler.decompile(cn);
|
panel1.removeAll();
|
||||||
|
panel2.removeAll();
|
||||||
|
panel3.removeAll();
|
||||||
|
|
||||||
if(BytecodeViewer.viewer.sourcePane.isSelected()) {
|
if (pane1 != 0 && pane1 != 5)
|
||||||
if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.fernflowerDec.getModel()))
|
panel1.add(panel1Search, BorderLayout.NORTH);
|
||||||
s = ff_dc.decompileClassNode(cn);
|
if (pane2 != 0 && pane2 != 5)
|
||||||
else if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.procyonDec.getModel()))
|
panel2.add(panel2Search, BorderLayout.NORTH);
|
||||||
s = proc_dc.decompileClassNode(cn);
|
if (pane3 != 0 && pane3 != 5)
|
||||||
else if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.cfrDec.getModel()))
|
panel3.add(panel3Search, BorderLayout.NORTH);
|
||||||
s = cfr_dc.decompileClassNode(cn);
|
|
||||||
|
if (pane1 == 1) { // procyon
|
||||||
|
RSyntaxTextArea panelArea = new RSyntaxTextArea();
|
||||||
|
panelArea
|
||||||
|
.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
|
||||||
|
panelArea.setCodeFoldingEnabled(true);
|
||||||
|
panelArea.setAntiAliasingEnabled(true);
|
||||||
|
RTextScrollPane scrollPane = new RTextScrollPane(panelArea);
|
||||||
|
panelArea.setText(proc_dc.decompileClassNode(cn));
|
||||||
|
panelArea.setCaretPosition(0);
|
||||||
|
panel1.add(scrollPane);
|
||||||
}
|
}
|
||||||
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
if (pane1 == 2) {// cfr
|
||||||
public void run() {
|
RSyntaxTextArea panelArea = new RSyntaxTextArea();
|
||||||
|
panelArea
|
||||||
|
.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
|
||||||
|
panelArea.setCodeFoldingEnabled(true);
|
||||||
|
panelArea.setAntiAliasingEnabled(true);
|
||||||
|
RTextScrollPane scrollPane = new RTextScrollPane(panelArea);
|
||||||
|
panelArea.setText(cfr_dc.decompileClassNode(cn));
|
||||||
|
panelArea.setCaretPosition(0);
|
||||||
|
panel1.add(scrollPane);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pane1 == 3) {// fern
|
||||||
|
RSyntaxTextArea panelArea = new RSyntaxTextArea();
|
||||||
|
panelArea
|
||||||
|
.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
|
||||||
|
panelArea.setCodeFoldingEnabled(true);
|
||||||
|
panelArea.setAntiAliasingEnabled(true);
|
||||||
|
RTextScrollPane scrollPane = new RTextScrollPane(panelArea);
|
||||||
|
panelArea.setText(ff_dc.decompileClassNode(cn));
|
||||||
|
panelArea.setCaretPosition(0);
|
||||||
|
panel1.add(scrollPane);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pane1 == 4) {// bytecode
|
||||||
RSyntaxTextArea bytecodeArea = new RSyntaxTextArea();
|
RSyntaxTextArea bytecodeArea = new RSyntaxTextArea();
|
||||||
bytecodeArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
|
bytecodeArea
|
||||||
|
.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
|
||||||
bytecodeArea.setCodeFoldingEnabled(true);
|
bytecodeArea.setCodeFoldingEnabled(true);
|
||||||
bytecodeArea.setAntiAliasingEnabled(true);
|
bytecodeArea.setAntiAliasingEnabled(true);
|
||||||
RTextScrollPane bytecodeSPane = new RTextScrollPane(bytecodeArea);
|
RTextScrollPane bytecodeSPane = new RTextScrollPane(
|
||||||
bytecodeArea.setText(b);
|
bytecodeArea);
|
||||||
|
bytecodeArea.setText(ClassNodeDecompiler.decompile(cn));
|
||||||
RSyntaxTextArea sourcecodeArea = new RSyntaxTextArea();
|
|
||||||
sourcecodeArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
|
|
||||||
sourcecodeArea.setCodeFoldingEnabled(true);
|
|
||||||
sourcecodeArea.setAntiAliasingEnabled(true);
|
|
||||||
RTextScrollPane sourcecodeSPane = new RTextScrollPane(sourcecodeArea);
|
|
||||||
sourcecodeArea.setText(s);
|
|
||||||
|
|
||||||
if(BytecodeViewer.viewer.bytecodePane.isSelected()) {
|
|
||||||
if(bytePanel.getComponents().length == 2)
|
|
||||||
bytePanel.remove(1);
|
|
||||||
bytePanel.add(bytecodeSPane);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(BytecodeViewer.viewer.sourcePane.isSelected()) {
|
|
||||||
if(decompPanel.getComponents().length == 2)
|
|
||||||
decompPanel.remove(1);
|
|
||||||
decompPanel.add(sourcecodeSPane);
|
|
||||||
}
|
|
||||||
bytecodeArea.setCaretPosition(0);
|
bytecodeArea.setCaretPosition(0);
|
||||||
sourcecodeArea.setCaretPosition(0);
|
panel1.add(bytecodeSPane);
|
||||||
|
|
||||||
BytecodeViewer.viewer.setIcon(false);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
if (pane1 == 5) {// hex
|
||||||
|
final ClassWriter cw = new ClassWriter(0);
|
||||||
|
cn.accept(cw);
|
||||||
|
JHexEditor hex = new JHexEditor(cw.toByteArray());
|
||||||
|
panel1.add(hex);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pane2 == 1) {
|
||||||
|
RSyntaxTextArea panelArea = new RSyntaxTextArea();
|
||||||
|
panelArea
|
||||||
|
.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
|
||||||
|
panelArea.setCodeFoldingEnabled(true);
|
||||||
|
panelArea.setAntiAliasingEnabled(true);
|
||||||
|
RTextScrollPane scrollPane = new RTextScrollPane(panelArea);
|
||||||
|
panelArea.setText(proc_dc.decompileClassNode(cn));
|
||||||
|
panelArea.setCaretPosition(0);
|
||||||
|
panel2.add(scrollPane);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pane2 == 2) {
|
||||||
|
RSyntaxTextArea panelArea = new RSyntaxTextArea();
|
||||||
|
panelArea
|
||||||
|
.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
|
||||||
|
panelArea.setCodeFoldingEnabled(true);
|
||||||
|
panelArea.setAntiAliasingEnabled(true);
|
||||||
|
RTextScrollPane scrollPane = new RTextScrollPane(panelArea);
|
||||||
|
panelArea.setText(cfr_dc.decompileClassNode(cn));
|
||||||
|
panelArea.setCaretPosition(0);
|
||||||
|
panel2.add(scrollPane);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pane2 == 3) {
|
||||||
|
RSyntaxTextArea panelArea = new RSyntaxTextArea();
|
||||||
|
panelArea
|
||||||
|
.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
|
||||||
|
panelArea.setCodeFoldingEnabled(true);
|
||||||
|
panelArea.setAntiAliasingEnabled(true);
|
||||||
|
RTextScrollPane scrollPane = new RTextScrollPane(panelArea);
|
||||||
|
panelArea.setText(ff_dc.decompileClassNode(cn));
|
||||||
|
panelArea.setCaretPosition(0);
|
||||||
|
panel2.add(scrollPane);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pane2 == 4) {
|
||||||
|
RSyntaxTextArea paneArea = new RSyntaxTextArea();
|
||||||
|
paneArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
|
||||||
|
paneArea.setCodeFoldingEnabled(true);
|
||||||
|
paneArea.setAntiAliasingEnabled(true);
|
||||||
|
RTextScrollPane scrollPane = new RTextScrollPane(paneArea);
|
||||||
|
paneArea.setText(ClassNodeDecompiler.decompile(cn));
|
||||||
|
paneArea.setCaretPosition(0);
|
||||||
|
panel2.add(scrollPane);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pane2 == 5) {
|
||||||
|
final ClassWriter cw = new ClassWriter(0);
|
||||||
|
cn.accept(cw);
|
||||||
|
JHexEditor hex = new JHexEditor(cw.toByteArray());
|
||||||
|
panel2.add(hex);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pane3 == 1) {
|
||||||
|
RSyntaxTextArea panelArea = new RSyntaxTextArea();
|
||||||
|
panelArea
|
||||||
|
.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
|
||||||
|
panelArea.setCodeFoldingEnabled(true);
|
||||||
|
panelArea.setAntiAliasingEnabled(true);
|
||||||
|
RTextScrollPane scrollPane = new RTextScrollPane(panelArea);
|
||||||
|
panelArea.setText(proc_dc.decompileClassNode(cn));
|
||||||
|
panelArea.setCaretPosition(0);
|
||||||
|
panel3.add(scrollPane);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pane3 == 2) {
|
||||||
|
RSyntaxTextArea panelArea = new RSyntaxTextArea();
|
||||||
|
panelArea
|
||||||
|
.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
|
||||||
|
panelArea.setCodeFoldingEnabled(true);
|
||||||
|
panelArea.setAntiAliasingEnabled(true);
|
||||||
|
RTextScrollPane scrollPane = new RTextScrollPane(panelArea);
|
||||||
|
panelArea.setText(cfr_dc.decompileClassNode(cn));
|
||||||
|
panelArea.setCaretPosition(0);
|
||||||
|
panel3.add(scrollPane);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pane3 == 3) {
|
||||||
|
RSyntaxTextArea panelArea = new RSyntaxTextArea();
|
||||||
|
panelArea
|
||||||
|
.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
|
||||||
|
panelArea.setCodeFoldingEnabled(true);
|
||||||
|
panelArea.setAntiAliasingEnabled(true);
|
||||||
|
RTextScrollPane scrollPane = new RTextScrollPane(panelArea);
|
||||||
|
panelArea.setText(ff_dc.decompileClassNode(cn));
|
||||||
|
panelArea.setCaretPosition(0);
|
||||||
|
panel3.add(scrollPane);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pane3 == 4) {
|
||||||
|
RSyntaxTextArea paneArea = new RSyntaxTextArea();
|
||||||
|
paneArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
|
||||||
|
paneArea.setCodeFoldingEnabled(true);
|
||||||
|
paneArea.setAntiAliasingEnabled(true);
|
||||||
|
RTextScrollPane scrollPane = new RTextScrollPane(paneArea);
|
||||||
|
paneArea.setText(ClassNodeDecompiler.decompile(cn));
|
||||||
|
paneArea.setCaretPosition(0);
|
||||||
|
panel3.add(scrollPane);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pane3 == 5) {
|
||||||
|
final ClassWriter cw = new ClassWriter(0);
|
||||||
|
cn.accept(cw);
|
||||||
|
JHexEditor hex = new JHexEditor(cw.toByteArray());
|
||||||
|
panel3.add(hex);
|
||||||
|
}
|
||||||
|
|
||||||
|
resetDivider();
|
||||||
|
BytecodeViewer.viewer.setIcon(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -520,5 +772,4 @@ public class ClassViewer extends JPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,8 @@ public class EZInjectionOptions extends JFrame {
|
||||||
setTitle("EZ Injection Options");
|
setTitle("EZ Injection Options");
|
||||||
getContentPane().setLayout(null);
|
getContentPane().setLayout(null);
|
||||||
|
|
||||||
final JCheckBox accessModifiers = new JCheckBox("Set All Access Modifiers Public");
|
final JCheckBox accessModifiers = new JCheckBox(
|
||||||
|
"Set All Access Modifiers Public");
|
||||||
accessModifiers.setSelected(true);
|
accessModifiers.setSelected(true);
|
||||||
accessModifiers.setBounds(6, 7, 232, 23);
|
accessModifiers.setBounds(6, 7, 232, 23);
|
||||||
getContentPane().add(accessModifiers);
|
getContentPane().add(accessModifiers);
|
||||||
|
@ -69,17 +70,20 @@ public class EZInjectionOptions extends JFrame {
|
||||||
for (Object o : classNode.methods.toArray()) {
|
for (Object o : classNode.methods.toArray()) {
|
||||||
MethodNode m = (MethodNode) o;
|
MethodNode m = (MethodNode) o;
|
||||||
|
|
||||||
if(m.name.equals("main") && m.desc.equals("([Ljava/lang/String;)V")) {
|
if (m.name.equals("main")
|
||||||
|
&& m.desc.equals("([Ljava/lang/String;)V")) {
|
||||||
if (!b) {
|
if (!b) {
|
||||||
b = true;
|
b = true;
|
||||||
txtThebytecodeclubexamplemainlstring.setText(classNode.name+"."+m.name);
|
txtThebytecodeclubexamplemainlstring
|
||||||
|
.setText(classNode.name + "." + m.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!b)
|
if (!b)
|
||||||
txtThebytecodeclubexamplemainlstring.setText("the/bytecode/club/Example.main");
|
txtThebytecodeclubexamplemainlstring
|
||||||
|
.setText("the/bytecode/club/Example.main");
|
||||||
|
|
||||||
txtThebytecodeclubexamplemainlstring.setBounds(6, 281, 232, 20);
|
txtThebytecodeclubexamplemainlstring.setBounds(6, 281, 232, 20);
|
||||||
getContentPane().add(txtThebytecodeclubexamplemainlstring);
|
getContentPane().add(txtThebytecodeclubexamplemainlstring);
|
||||||
|
@ -101,11 +105,13 @@ public class EZInjectionOptions extends JFrame {
|
||||||
textField_1.setBounds(6, 220, 232, 20);
|
textField_1.setBounds(6, 220, 232, 20);
|
||||||
getContentPane().add(textField_1);
|
getContentPane().add(textField_1);
|
||||||
|
|
||||||
final JCheckBox forceProxy = new JCheckBox("Force Proxy (socks5, host:port):");
|
final JCheckBox forceProxy = new JCheckBox(
|
||||||
|
"Force Proxy (socks5, host:port):");
|
||||||
forceProxy.setBounds(6, 190, 232, 23);
|
forceProxy.setBounds(6, 190, 232, 23);
|
||||||
getContentPane().add(forceProxy);
|
getContentPane().add(forceProxy);
|
||||||
|
|
||||||
final JCheckBox launchReflectionKit = new JCheckBox("Launch Reflection Kit On Successful Invoke");
|
final JCheckBox launchReflectionKit = new JCheckBox(
|
||||||
|
"Launch Reflection Kit On Successful Invoke");
|
||||||
launchReflectionKit.setEnabled(false);
|
launchReflectionKit.setEnabled(false);
|
||||||
launchReflectionKit.setBounds(6, 308, 232, 23);
|
launchReflectionKit.setBounds(6, 308, 232, 23);
|
||||||
getContentPane().add(launchReflectionKit);
|
getContentPane().add(launchReflectionKit);
|
||||||
|
@ -115,14 +121,24 @@ public class EZInjectionOptions extends JFrame {
|
||||||
console.setSelected(true);
|
console.setSelected(true);
|
||||||
getContentPane().add(console);
|
getContentPane().add(console);
|
||||||
|
|
||||||
final JCheckBox chckbxPrintToTerminal = new JCheckBox("Print To Command Line");
|
final JCheckBox chckbxPrintToTerminal = new JCheckBox(
|
||||||
|
"Print To Command Line");
|
||||||
chckbxPrintToTerminal.setSelected(true);
|
chckbxPrintToTerminal.setSelected(true);
|
||||||
chckbxPrintToTerminal.setBounds(6, 363, 232, 23);
|
chckbxPrintToTerminal.setBounds(6, 363, 232, 23);
|
||||||
getContentPane().add(chckbxPrintToTerminal);
|
getContentPane().add(chckbxPrintToTerminal);
|
||||||
this.setLocationRelativeTo(null);
|
this.setLocationRelativeTo(null);
|
||||||
btnNewButton.addActionListener(new ActionListener() {
|
btnNewButton.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
PluginManager.runPlugin(new EZInjection(accessModifiers.isSelected(), injectHooks.isSelected(), debugMethodCalls.isSelected(), invokeMethod.isSelected(), txtThebytecodeclubexamplemainlstring.getText(), runtime.isSelected(), system.isSelected(), textField.getText(), textField_1.getText(), forceProxy.isSelected(), launchReflectionKit.isSelected(), console.isSelected(), chckbxPrintToTerminal.isSelected()));
|
PluginManager.runPlugin(new EZInjection(accessModifiers
|
||||||
|
.isSelected(), injectHooks.isSelected(),
|
||||||
|
debugMethodCalls.isSelected(), invokeMethod
|
||||||
|
.isSelected(),
|
||||||
|
txtThebytecodeclubexamplemainlstring.getText(), runtime
|
||||||
|
.isSelected(), system.isSelected(), textField
|
||||||
|
.getText(), textField_1.getText(), forceProxy
|
||||||
|
.isSelected(),
|
||||||
|
launchReflectionKit.isSelected(), console.isSelected(),
|
||||||
|
chckbxPrintToTerminal.isSelected()));
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -25,7 +25,8 @@ public class ExportJar extends JFrame {
|
||||||
btnNewButton.setMaximumSize(new Dimension(999, 23));
|
btnNewButton.setMaximumSize(new Dimension(999, 23));
|
||||||
btnNewButton.setMinimumSize(new Dimension(999, 23));
|
btnNewButton.setMinimumSize(new Dimension(999, 23));
|
||||||
btnNewButton.setSize(new Dimension(999, 0));
|
btnNewButton.setSize(new Dimension(999, 0));
|
||||||
getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
|
getContentPane().setLayout(
|
||||||
|
new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
|
||||||
|
|
||||||
JScrollPane scrollPane = new JScrollPane();
|
JScrollPane scrollPane = new JScrollPane();
|
||||||
getContentPane().add(scrollPane);
|
getContentPane().add(scrollPane);
|
||||||
|
@ -41,7 +42,8 @@ public class ExportJar extends JFrame {
|
||||||
btnNewButton.addActionListener(new ActionListener() {
|
btnNewButton.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
BytecodeViewer.viewer.setC(true);
|
BytecodeViewer.viewer.setC(true);
|
||||||
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), jarPath, mani.getText());
|
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), jarPath,
|
||||||
|
mani.getText());
|
||||||
BytecodeViewer.viewer.setC(false);
|
BytecodeViewer.viewer.setC(false);
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,8 @@ import org.objectweb.asm.tree.ClassNode;
|
||||||
import the.bytecode.club.bytecodeviewer.*;
|
import the.bytecode.club.bytecodeviewer.*;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class FileNavigationPane extends VisibleComponent implements FileDrop.Listener {
|
public class FileNavigationPane extends VisibleComponent implements
|
||||||
|
FileDrop.Listener {
|
||||||
|
|
||||||
FileChangeNotifier fcn;
|
FileChangeNotifier fcn;
|
||||||
JCheckBox exact = new JCheckBox("Exact");
|
JCheckBox exact = new JCheckBox("Exact");
|
||||||
|
@ -67,7 +68,8 @@ public class FileNavigationPane extends VisibleComponent implements FileDrop.Lis
|
||||||
nameBuffer.append("/");
|
nameBuffer.append("/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final ClassNode cn = BytecodeViewer.getClassNode(nameBuffer.toString());
|
final ClassNode cn = BytecodeViewer.getClassNode(nameBuffer
|
||||||
|
.toString());
|
||||||
if (cn != null) {
|
if (cn != null) {
|
||||||
openClassFileToWorkSpace(nameBuffer.toString(), cn);
|
openClassFileToWorkSpace(nameBuffer.toString(), cn);
|
||||||
}
|
}
|
||||||
|
@ -90,25 +92,27 @@ public class FileNavigationPane extends VisibleComponent implements FileDrop.Lis
|
||||||
|
|
||||||
if (qt.contains(".")) {
|
if (qt.contains(".")) {
|
||||||
path = qt.split("\\.");
|
path = qt.split("\\.");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
path = new String[] { qt };
|
path = new String[] { qt };
|
||||||
}
|
}
|
||||||
|
|
||||||
MyTreeNode curNode = treeRoot;
|
MyTreeNode curNode = treeRoot;
|
||||||
pathLoop:
|
if (exact.isSelected()) {
|
||||||
for (int i = 0;i < path.length; i++) {
|
pathLoop: for (int i = 0; i < path.length; i++) {
|
||||||
final String pathName = path[i];
|
final String pathName = path[i];
|
||||||
final boolean isLast = i == path.length - 1;
|
final boolean isLast = i == path.length - 1;
|
||||||
|
|
||||||
for (int c = 0; c < curNode.getChildCount(); c++) {
|
for (int c = 0; c < curNode.getChildCount(); c++) {
|
||||||
final MyTreeNode child = (MyTreeNode) curNode.getChildAt(c);
|
final MyTreeNode child = (MyTreeNode) curNode
|
||||||
|
.getChildAt(c);
|
||||||
|
|
||||||
if(!exact.isSelected()) {
|
if (((String) child.getUserObject())
|
||||||
if (((String)child.getUserObject()).toLowerCase().contains(pathName.toLowerCase())) {
|
.toLowerCase().contains(
|
||||||
|
pathName.toLowerCase())) {
|
||||||
curNode = child;
|
curNode = child;
|
||||||
if (isLast) {
|
if (isLast) {
|
||||||
final TreePath pathn = new TreePath(curNode.getPath());
|
final TreePath pathn = new TreePath(
|
||||||
|
curNode.getPath());
|
||||||
tree.setSelectionPath(pathn);
|
tree.setSelectionPath(pathn);
|
||||||
tree.makeVisible(pathn);
|
tree.makeVisible(pathn);
|
||||||
tree.scrollPathToVisible(pathn);
|
tree.scrollPathToVisible(pathn);
|
||||||
|
@ -117,25 +121,50 @@ public class FileNavigationPane extends VisibleComponent implements FileDrop.Lis
|
||||||
}
|
}
|
||||||
continue pathLoop;
|
continue pathLoop;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (((String)child.getUserObject()).equals(pathName)) {
|
|
||||||
curNode = child;
|
|
||||||
if (isLast) {
|
|
||||||
final TreePath pathn = new TreePath(curNode.getPath());
|
|
||||||
tree.setSelectionPath(pathn);
|
|
||||||
tree.makeVisible(pathn);
|
|
||||||
tree.scrollPathToVisible(pathn);
|
|
||||||
System.out.println("Found! " + curNode);
|
|
||||||
break pathLoop;
|
|
||||||
}
|
|
||||||
continue pathLoop;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Could not find " + pathName);
|
System.out.println("Could not find " + pathName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
Enumeration<MyTreeNode> enums = curNode
|
||||||
|
.depthFirstEnumeration();
|
||||||
|
while (enums != null && enums.hasMoreElements()) {
|
||||||
|
|
||||||
|
MyTreeNode node = enums.nextElement();
|
||||||
|
// System.out.println("enum " +
|
||||||
|
// node.getUserObject());
|
||||||
|
if (node.isLeaf()) {
|
||||||
|
if (((String) (node.getUserObject()))
|
||||||
|
.equalsIgnoreCase(path[path.length - 1])) {
|
||||||
|
TreeNode pathArray[] = node.getPath();
|
||||||
|
int k = 0;
|
||||||
|
StringBuffer fullPath = new StringBuffer();
|
||||||
|
while (pathArray != null
|
||||||
|
&& k < pathArray.length) {
|
||||||
|
MyTreeNode n = (MyTreeNode) pathArray[k];
|
||||||
|
fullPath.append((String) (n
|
||||||
|
.getUserObject()));
|
||||||
|
if (k++ != pathArray.length - 1) {
|
||||||
|
fullPath.append(".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String fullPathString = fullPath.toString();
|
||||||
|
if (fullPathString != null
|
||||||
|
&& fullPathString.toLowerCase()
|
||||||
|
.contains(qt.toLowerCase())) {
|
||||||
|
System.out.println("Found! " + node);
|
||||||
|
final TreePath pathn = new TreePath(
|
||||||
|
node.getPath());
|
||||||
|
tree.setSelectionPath(pathn);
|
||||||
|
tree.makeVisible(pathn);
|
||||||
|
tree.scrollPathToVisible(pathn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,6 +177,7 @@ public class FileNavigationPane extends VisibleComponent implements FileDrop.Lis
|
||||||
quickSearch.setForeground(Color.black);
|
quickSearch.setForeground(Color.black);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void focusLost(final FocusEvent arg0) {
|
public void focusLost(final FocusEvent arg0) {
|
||||||
if (quickSearch.getText().isEmpty()) {
|
if (quickSearch.getText().isEmpty()) {
|
||||||
|
@ -181,18 +211,19 @@ public class FileNavigationPane extends VisibleComponent implements FileDrop.Lis
|
||||||
|
|
||||||
public void updateTree() {
|
public void updateTree() {
|
||||||
treeRoot.removeAllChildren();
|
treeRoot.removeAllChildren();
|
||||||
for (final Entry<String, ClassNode> entry : BytecodeViewer.loadedClasses.entrySet()) {
|
for (final Entry<String, ClassNode> entry : BytecodeViewer.loadedClasses
|
||||||
|
.entrySet()) {
|
||||||
String name = entry.getKey();
|
String name = entry.getKey();
|
||||||
final String[] spl = name.split("\\/");
|
final String[] spl = name.split("\\/");
|
||||||
if (spl.length < 2) {
|
if (spl.length < 2) {
|
||||||
treeRoot.add(new MyTreeNode(name));
|
treeRoot.add(new MyTreeNode(name));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
MyTreeNode parent = treeRoot;
|
MyTreeNode parent = treeRoot;
|
||||||
for (final String s : spl) {
|
for (final String s : spl) {
|
||||||
MyTreeNode child = null;
|
MyTreeNode child = null;
|
||||||
for (int i = 0; i < parent.getChildCount(); i++) {
|
for (int i = 0; i < parent.getChildCount(); i++) {
|
||||||
if (((MyTreeNode) parent.getChildAt(i)).getUserObject().equals(s)) {
|
if (((MyTreeNode) parent.getChildAt(i)).getUserObject()
|
||||||
|
.equals(s)) {
|
||||||
child = (MyTreeNode) parent.getChildAt(i);
|
child = (MyTreeNode) parent.getChildAt(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -206,7 +237,6 @@ public class FileNavigationPane extends VisibleComponent implements FileDrop.Lis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
treeRoot.sort();
|
treeRoot.sort();
|
||||||
tree.expandPath(new TreePath(tree.getModel().getRoot()));
|
tree.expandPath(new TreePath(tree.getModel().getRoot()));
|
||||||
tree.updateUI();
|
tree.updateUI();
|
||||||
|
@ -266,7 +296,9 @@ public class FileNavigationPane extends VisibleComponent implements FileDrop.Lis
|
||||||
g.fillRect(0, 0, getWidth(), getHeight());
|
g.fillRect(0, 0, getWidth(), getHeight());
|
||||||
g.setColor(Color.white);
|
g.setColor(Color.white);
|
||||||
String s = "Drag class/jar here";
|
String s = "Drag class/jar here";
|
||||||
g.drawString(s, ((int)((getWidth()/2)-(m.getWidth(s)/2))), getHeight()/2);
|
g.drawString(s,
|
||||||
|
((int) ((getWidth() / 2) - (m.getWidth(s) / 2))),
|
||||||
|
getHeight() / 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -306,7 +338,8 @@ public class FileNavigationPane extends VisibleComponent implements FileDrop.Lis
|
||||||
// To make sure nodes with children are always on top
|
// To make sure nodes with children are always on top
|
||||||
final int firstOffset = o1.getChildCount() > 0 ? -1000 : 0;
|
final int firstOffset = o1.getChildCount() > 0 ? -1000 : 0;
|
||||||
final int secondOffset = o2.getChildCount() > 0 ? 1000 : 0;
|
final int secondOffset = o2.getChildCount() > 0 ? 1000 : 0;
|
||||||
return o1.toString().compareToIgnoreCase(o2.toString()) + firstOffset + secondOffset;
|
return o1.toString().compareToIgnoreCase(o2.toString())
|
||||||
|
+ firstOffset + secondOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -45,7 +45,6 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
import javax.swing.JRadioButtonMenuItem;
|
import javax.swing.JRadioButtonMenuItem;
|
||||||
|
|
||||||
|
|
||||||
public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
|
|
||||||
final FernFlowerDecompiler ff_dc = new FernFlowerDecompiler();
|
final FernFlowerDecompiler ff_dc = new FernFlowerDecompiler();
|
||||||
|
@ -53,131 +52,245 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
final CFRDecompiler cfr_dc = new CFRDecompiler();
|
final CFRDecompiler cfr_dc = new CFRDecompiler();
|
||||||
|
|
||||||
private static final long serialVersionUID = 1851409230530948543L;
|
private static final long serialVersionUID = 1851409230530948543L;
|
||||||
public JCheckBoxMenuItem debugHelpers = new JCheckBoxMenuItem("Debug Helpers");
|
public JCheckBoxMenuItem debugHelpers = new JCheckBoxMenuItem(
|
||||||
|
"Debug Helpers");
|
||||||
private JSplitPane sp1;
|
private JSplitPane sp1;
|
||||||
private JSplitPane sp2;
|
private JSplitPane sp2;
|
||||||
static ArrayList<VisibleComponent> rfComps = new ArrayList<VisibleComponent>();
|
static ArrayList<VisibleComponent> rfComps = new ArrayList<VisibleComponent>();
|
||||||
public JCheckBoxMenuItem rbr = new JCheckBoxMenuItem("Hide bridge methods");
|
public JCheckBoxMenuItem rbr = new JCheckBoxMenuItem("Hide bridge methods");
|
||||||
public JCheckBoxMenuItem rsy = new JCheckBoxMenuItem("Hide synthetic class members");
|
public JCheckBoxMenuItem rsy = new JCheckBoxMenuItem(
|
||||||
public JCheckBoxMenuItem din = new JCheckBoxMenuItem("Decompile inner classes");
|
"Hide synthetic class members");
|
||||||
public JCheckBoxMenuItem dc4 = new JCheckBoxMenuItem("Collapse 1.4 class references");
|
public JCheckBoxMenuItem din = new JCheckBoxMenuItem(
|
||||||
|
"Decompile inner classes");
|
||||||
|
public JCheckBoxMenuItem dc4 = new JCheckBoxMenuItem(
|
||||||
|
"Collapse 1.4 class references");
|
||||||
public JCheckBoxMenuItem das = new JCheckBoxMenuItem("Decompile assertions");
|
public JCheckBoxMenuItem das = new JCheckBoxMenuItem("Decompile assertions");
|
||||||
public JCheckBoxMenuItem hes = new JCheckBoxMenuItem("Hide empty super invocation");
|
public JCheckBoxMenuItem hes = new JCheckBoxMenuItem(
|
||||||
public JCheckBoxMenuItem hdc = new JCheckBoxMenuItem("Hide empty default constructor");
|
"Hide empty super invocation");
|
||||||
public JCheckBoxMenuItem dgs = new JCheckBoxMenuItem("Decompile generic signatures");
|
public JCheckBoxMenuItem hdc = new JCheckBoxMenuItem(
|
||||||
public JCheckBoxMenuItem ner = new JCheckBoxMenuItem("Assume return not throwing exceptions");
|
"Hide empty default constructor");
|
||||||
public JCheckBoxMenuItem den = new JCheckBoxMenuItem("Decompile enumerations");
|
public JCheckBoxMenuItem dgs = new JCheckBoxMenuItem(
|
||||||
public JCheckBoxMenuItem rgn = new JCheckBoxMenuItem("Remove getClass() invocation");
|
"Decompile generic signatures");
|
||||||
public JCheckBoxMenuItem bto = new JCheckBoxMenuItem("Interpret int 1 as boolean true");
|
public JCheckBoxMenuItem ner = new JCheckBoxMenuItem(
|
||||||
public JCheckBoxMenuItem nns = new JCheckBoxMenuItem("Allow for not set synthetic attribute");
|
"Assume return not throwing exceptions");
|
||||||
public JCheckBoxMenuItem uto = new JCheckBoxMenuItem("Consider nameless types as java.lang.Object");
|
public JCheckBoxMenuItem den = new JCheckBoxMenuItem(
|
||||||
public JCheckBoxMenuItem udv = new JCheckBoxMenuItem("Reconstruct variable names from debug info");
|
"Decompile enumerations");
|
||||||
public JCheckBoxMenuItem rer = new JCheckBoxMenuItem("Remove empty exception ranges");
|
public JCheckBoxMenuItem rgn = new JCheckBoxMenuItem(
|
||||||
public JCheckBoxMenuItem fdi = new JCheckBoxMenuItem("Deinline finally structures");
|
"Remove getClass() invocation");
|
||||||
public JCheckBoxMenuItem asc = new JCheckBoxMenuItem("Allow only ASCII characters in strings");
|
public JCheckBoxMenuItem bto = new JCheckBoxMenuItem(
|
||||||
public JCheckBoxMenuItem sourcePane = new JCheckBoxMenuItem("Source Pane");
|
"Interpret int 1 as boolean true");
|
||||||
public JCheckBoxMenuItem bytecodePane = new JCheckBoxMenuItem("Bytecode Pane");
|
public JCheckBoxMenuItem nns = new JCheckBoxMenuItem(
|
||||||
public JCheckBoxMenuItem hexPane = new JCheckBoxMenuItem("Hex Pane");
|
"Allow for not set synthetic attribute");
|
||||||
|
public JCheckBoxMenuItem uto = new JCheckBoxMenuItem(
|
||||||
|
"Consider nameless types as java.lang.Object");
|
||||||
|
public JCheckBoxMenuItem udv = new JCheckBoxMenuItem(
|
||||||
|
"Reconstruct variable names from debug info");
|
||||||
|
public JCheckBoxMenuItem rer = new JCheckBoxMenuItem(
|
||||||
|
"Remove empty exception ranges");
|
||||||
|
public JCheckBoxMenuItem fdi = new JCheckBoxMenuItem(
|
||||||
|
"Deinline finally structures");
|
||||||
|
public JCheckBoxMenuItem asc = new JCheckBoxMenuItem(
|
||||||
|
"Allow only ASCII characters in strings");
|
||||||
private final JMenuItem mntmNewWorkspace = new JMenuItem("New Workspace");
|
private final JMenuItem mntmNewWorkspace = new JMenuItem("New Workspace");
|
||||||
public JMenu mnRecentFiles = new JMenu("Recent Files");
|
public JMenu mnRecentFiles = new JMenu("Recent Files");
|
||||||
private final JMenuItem mntmNewMenuItem = new JMenuItem("Save Java Files As..");
|
private final JMenuItem mntmNewMenuItem = new JMenuItem(
|
||||||
|
"Save Java Files As..");
|
||||||
private final JMenuItem mntmAbout = new JMenuItem("About");
|
private final JMenuItem mntmAbout = new JMenuItem("About");
|
||||||
private AboutWindow aboutWindow = new AboutWindow();
|
private AboutWindow aboutWindow = new AboutWindow();
|
||||||
private final JSeparator separator_3 = new JSeparator();
|
private final JSeparator separator_3 = new JSeparator();
|
||||||
private final JMenu mnNewMenu_1 = new JMenu("Plugins");
|
private final JMenu mnNewMenu_1 = new JMenu("Plugins");
|
||||||
private final JMenuItem mntmStartExternalPlugin = new JMenuItem("Open Plugin..");
|
private final JMenuItem mntmStartExternalPlugin = new JMenuItem(
|
||||||
|
"Open Plugin..");
|
||||||
private final JSeparator separator_4 = new JSeparator();
|
private final JSeparator separator_4 = new JSeparator();
|
||||||
public JMenu mnRecentPlugins = new JMenu("Recent Plugins");
|
public JMenu mnRecentPlugins = new JMenu("Recent Plugins");
|
||||||
private final JSeparator separator_5 = new JSeparator();
|
private final JSeparator separator_5 = new JSeparator();
|
||||||
private final JMenuItem mntmStartZkmString = new JMenuItem("ZKM String Decrypter");
|
private final JMenuItem mntmStartZkmString = new JMenuItem(
|
||||||
private final JMenuItem mntmNewMenuItem_1 = new JMenuItem("Malicious Code Scanner");
|
"ZKM String Decrypter");
|
||||||
private final JMenuItem mntmNewMenuItem_2 = new JMenuItem("Allatori String Decrypter");
|
private final JMenuItem mntmNewMenuItem_1 = new JMenuItem(
|
||||||
private final JMenuItem mntmShowAllStrings = new JMenuItem("Show All Strings");
|
"Malicious Code Scanner");
|
||||||
private final JMenuItem mntmShowMainMethods = new JMenuItem("Show Main Methods");
|
private final JMenuItem mntmNewMenuItem_2 = new JMenuItem(
|
||||||
|
"Allatori String Decrypter");
|
||||||
|
private final JMenuItem mntmShowAllStrings = new JMenuItem(
|
||||||
|
"Show All Strings");
|
||||||
|
private final JMenuItem mntmShowMainMethods = new JMenuItem(
|
||||||
|
"Show Main Methods");
|
||||||
private final JMenuItem mntmNewMenuItem_3 = new JMenuItem("Save As Jar..");
|
private final JMenuItem mntmNewMenuItem_3 = new JMenuItem("Save As Jar..");
|
||||||
private JMenuBar menuBar = new JMenuBar();
|
private JMenuBar menuBar = new JMenuBar();
|
||||||
public JCheckBoxMenuItem chckbxmntmNewCheckItem = new JCheckBoxMenuItem("Allow Only ASCII Characters In Strings");
|
private final JMenuItem mntmReplaceStrings = new JMenuItem(
|
||||||
private final JMenuItem mntmReplaceStrings = new JMenuItem("Replace Strings");
|
"Replace Strings");
|
||||||
private final JMenuItem mntmNewMenuItem_4 = new JMenuItem("");
|
private final JMenuItem mntmNewMenuItem_4 = new JMenuItem("");
|
||||||
private final JMenu mnNewMenu_2 = new JMenu("Java Decompiler");
|
|
||||||
public final JRadioButtonMenuItem fernflowerDec = new JRadioButtonMenuItem("FernFlower");
|
|
||||||
public final JRadioButtonMenuItem procyonDec = new JRadioButtonMenuItem("Procyon");
|
|
||||||
public final JRadioButtonMenuItem cfrDec = new JRadioButtonMenuItem("CFR");
|
|
||||||
public final ButtonGroup decompilerGroup = new ButtonGroup();
|
|
||||||
private final JMenu mnNewMenu_3 = new JMenu("CFR");
|
private final JMenu mnNewMenu_3 = new JMenu("CFR");
|
||||||
private final JMenu mnNewMenu_4 = new JMenu("Procyon");
|
private final JMenu mnNewMenu_4 = new JMenu("Procyon");
|
||||||
public final JCheckBoxMenuItem decodeenumswitch = new JCheckBoxMenuItem("Decode Enum Switch");
|
public final JCheckBoxMenuItem decodeenumswitch = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem sugarenums = new JCheckBoxMenuItem("SugarEnums");
|
"Decode Enum Switch");
|
||||||
public final JCheckBoxMenuItem decodestringswitch = new JCheckBoxMenuItem("Decode String Switch");
|
public final JCheckBoxMenuItem sugarenums = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem arrayiter = new JCheckBoxMenuItem("Arrayiter");
|
"SugarEnums");
|
||||||
public final JCheckBoxMenuItem collectioniter = new JCheckBoxMenuItem("Collectioniter");
|
public final JCheckBoxMenuItem decodestringswitch = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem innerclasses = new JCheckBoxMenuItem("Inner Classes");
|
"Decode String Switch");
|
||||||
public final JCheckBoxMenuItem removeboilerplate = new JCheckBoxMenuItem("Remove Boiler Plate");
|
public final JCheckBoxMenuItem arrayiter = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem removeinnerclasssynthetics = new JCheckBoxMenuItem("Remove Inner Class Synthetics");
|
"Arrayiter");
|
||||||
public final JCheckBoxMenuItem decodelambdas = new JCheckBoxMenuItem("Decode Lambdas");
|
public final JCheckBoxMenuItem collectioniter = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem hidebridgemethods = new JCheckBoxMenuItem("Hide Bridge Methods");
|
"Collectioniter");
|
||||||
public final JCheckBoxMenuItem liftconstructorinit = new JCheckBoxMenuItem("Lift Constructor Init");
|
public final JCheckBoxMenuItem innerclasses = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem removedeadmethods = new JCheckBoxMenuItem("Remove Dead Methods");
|
"Inner Classes");
|
||||||
public final JCheckBoxMenuItem removebadgenerics = new JCheckBoxMenuItem("Remove Bad Generics");
|
public final JCheckBoxMenuItem removeboilerplate = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem sugarasserts = new JCheckBoxMenuItem("Sugar Asserts");
|
"Remove Boiler Plate");
|
||||||
public final JCheckBoxMenuItem sugarboxing = new JCheckBoxMenuItem("Sugar Boxing");
|
public final JCheckBoxMenuItem removeinnerclasssynthetics = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem showversion = new JCheckBoxMenuItem("Show Version");
|
"Remove Inner Class Synthetics");
|
||||||
public final JCheckBoxMenuItem decodefinally = new JCheckBoxMenuItem("Decode Finally");
|
public final JCheckBoxMenuItem decodelambdas = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem tidymonitors = new JCheckBoxMenuItem("Tidy Monitors");
|
"Decode Lambdas");
|
||||||
|
public final JCheckBoxMenuItem hidebridgemethods = new JCheckBoxMenuItem(
|
||||||
|
"Hide Bridge Methods");
|
||||||
|
public final JCheckBoxMenuItem liftconstructorinit = new JCheckBoxMenuItem(
|
||||||
|
"Lift Constructor Init");
|
||||||
|
public final JCheckBoxMenuItem removedeadmethods = new JCheckBoxMenuItem(
|
||||||
|
"Remove Dead Methods");
|
||||||
|
public final JCheckBoxMenuItem removebadgenerics = new JCheckBoxMenuItem(
|
||||||
|
"Remove Bad Generics");
|
||||||
|
public final JCheckBoxMenuItem sugarasserts = new JCheckBoxMenuItem(
|
||||||
|
"Sugar Asserts");
|
||||||
|
public final JCheckBoxMenuItem sugarboxing = new JCheckBoxMenuItem(
|
||||||
|
"Sugar Boxing");
|
||||||
|
public final JCheckBoxMenuItem showversion = new JCheckBoxMenuItem(
|
||||||
|
"Show Version");
|
||||||
|
public final JCheckBoxMenuItem decodefinally = new JCheckBoxMenuItem(
|
||||||
|
"Decode Finally");
|
||||||
|
public final JCheckBoxMenuItem tidymonitors = new JCheckBoxMenuItem(
|
||||||
|
"Tidy Monitors");
|
||||||
public final JCheckBoxMenuItem lenient = new JCheckBoxMenuItem("Lenient");
|
public final JCheckBoxMenuItem lenient = new JCheckBoxMenuItem("Lenient");
|
||||||
public final JCheckBoxMenuItem dumpclasspath = new JCheckBoxMenuItem("Dump Classpath");
|
public final JCheckBoxMenuItem dumpclasspath = new JCheckBoxMenuItem(
|
||||||
|
"Dump Classpath");
|
||||||
public final JCheckBoxMenuItem comments = new JCheckBoxMenuItem("Comments");
|
public final JCheckBoxMenuItem comments = new JCheckBoxMenuItem("Comments");
|
||||||
public final JCheckBoxMenuItem forcetopsort = new JCheckBoxMenuItem("Force Top Sort");
|
public final JCheckBoxMenuItem forcetopsort = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem forcetopsortaggress = new JCheckBoxMenuItem("Force Top Sort Aggress");
|
"Force Top Sort");
|
||||||
public final JCheckBoxMenuItem stringbuffer = new JCheckBoxMenuItem("String Buffer");
|
public final JCheckBoxMenuItem forcetopsortaggress = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem stringbuilder = new JCheckBoxMenuItem("String Builder");
|
"Force Top Sort Aggress");
|
||||||
|
public final JCheckBoxMenuItem stringbuffer = new JCheckBoxMenuItem(
|
||||||
|
"String Buffer");
|
||||||
|
public final JCheckBoxMenuItem stringbuilder = new JCheckBoxMenuItem(
|
||||||
|
"String Builder");
|
||||||
public final JCheckBoxMenuItem silent = new JCheckBoxMenuItem("Silent");
|
public final JCheckBoxMenuItem silent = new JCheckBoxMenuItem("Silent");
|
||||||
public final JCheckBoxMenuItem recover = new JCheckBoxMenuItem("Recover");
|
public final JCheckBoxMenuItem recover = new JCheckBoxMenuItem("Recover");
|
||||||
public final JCheckBoxMenuItem eclipse = new JCheckBoxMenuItem("Eclipse");
|
public final JCheckBoxMenuItem eclipse = new JCheckBoxMenuItem("Eclipse");
|
||||||
public final JCheckBoxMenuItem override = new JCheckBoxMenuItem("Override");
|
public final JCheckBoxMenuItem override = new JCheckBoxMenuItem("Override");
|
||||||
public final JCheckBoxMenuItem showinferrable = new JCheckBoxMenuItem("Show Inferrable");
|
public final JCheckBoxMenuItem showinferrable = new JCheckBoxMenuItem(
|
||||||
|
"Show Inferrable");
|
||||||
public final JCheckBoxMenuItem aexagg = new JCheckBoxMenuItem("Aexagg");
|
public final JCheckBoxMenuItem aexagg = new JCheckBoxMenuItem("Aexagg");
|
||||||
public final JCheckBoxMenuItem forcecondpropagate = new JCheckBoxMenuItem("Force Cond Propagate");
|
public final JCheckBoxMenuItem forcecondpropagate = new JCheckBoxMenuItem(
|
||||||
|
"Force Cond Propagate");
|
||||||
public final JCheckBoxMenuItem hideutf = new JCheckBoxMenuItem("Hide UTF");
|
public final JCheckBoxMenuItem hideutf = new JCheckBoxMenuItem("Hide UTF");
|
||||||
public final JCheckBoxMenuItem hidelongstrings = new JCheckBoxMenuItem("Hide Long Strings");
|
public final JCheckBoxMenuItem hidelongstrings = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem commentmonitor = new JCheckBoxMenuItem("Comment Monitors");
|
"Hide Long Strings");
|
||||||
public final JCheckBoxMenuItem allowcorrecting = new JCheckBoxMenuItem("Allow Correcting");
|
public final JCheckBoxMenuItem commentmonitor = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem labelledblocks = new JCheckBoxMenuItem("Labelled Blocks");
|
"Comment Monitors");
|
||||||
public final JCheckBoxMenuItem j14classobj = new JCheckBoxMenuItem("J14ClassOBJ");
|
public final JCheckBoxMenuItem allowcorrecting = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem hidelangimports = new JCheckBoxMenuItem("Hide Lang Imports");
|
"Allow Correcting");
|
||||||
public final JCheckBoxMenuItem recoverytypeclash = new JCheckBoxMenuItem("Recover Type Clash");
|
public final JCheckBoxMenuItem labelledblocks = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem recoverytypehints = new JCheckBoxMenuItem("Recover Type Hints");
|
"Labelled Blocks");
|
||||||
public final JCheckBoxMenuItem forceturningifs = new JCheckBoxMenuItem("Force Returning IFs");
|
public final JCheckBoxMenuItem j14classobj = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem forloopaggcapture = new JCheckBoxMenuItem("For Loop AGG Capture");
|
"J14ClassOBJ");
|
||||||
public final JCheckBoxMenuItem forceexceptionprune = new JCheckBoxMenuItem("Force Exception Prune");
|
public final JCheckBoxMenuItem hidelangimports = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem chckbxmntmShowDebugLine = new JCheckBoxMenuItem("Show Debug Line Numbers");
|
"Hide Lang Imports");
|
||||||
public final JCheckBoxMenuItem chckbxmntmSimplifyMemberReferences = new JCheckBoxMenuItem("Simplify Member References");
|
public final JCheckBoxMenuItem recoverytypeclash = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem mnMergeVariables = new JCheckBoxMenuItem("Merge Variables");
|
"Recover Type Clash");
|
||||||
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_1 = new JCheckBoxMenuItem("Unicode Output Enabled");
|
public final JCheckBoxMenuItem recoverytypehints = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_2 = new JCheckBoxMenuItem("Retain Pointless Switches");
|
"Recover Type Hints");
|
||||||
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_3 = new JCheckBoxMenuItem("Include Line Numbers In Bytecode");
|
public final JCheckBoxMenuItem forceturningifs = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_4 = new JCheckBoxMenuItem("Include Error Diagnostics");
|
"Force Returning IFs");
|
||||||
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_5 = new JCheckBoxMenuItem("Retain Redundant Casts");
|
public final JCheckBoxMenuItem forloopaggcapture = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_6 = new JCheckBoxMenuItem("Always Generate Exception Variable For Catch Blocks");
|
"For Loop AGG Capture");
|
||||||
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_7 = new JCheckBoxMenuItem("Show Synthetic Members");
|
public final JCheckBoxMenuItem forceexceptionprune = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_8 = new JCheckBoxMenuItem("Force Explicit Type Arguments");
|
"Force Exception Prune");
|
||||||
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_9 = new JCheckBoxMenuItem("Force Explicit Imports");
|
public final JCheckBoxMenuItem chckbxmntmShowDebugLine = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_10 = new JCheckBoxMenuItem("Flatten Switch Blocks");
|
"Show Debug Line Numbers");
|
||||||
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_11 = new JCheckBoxMenuItem("Exclude Nested Types");
|
public final JCheckBoxMenuItem chckbxmntmSimplifyMemberReferences = new JCheckBoxMenuItem(
|
||||||
public final JCheckBoxMenuItem chckbxmntmAppendBrackets = new JCheckBoxMenuItem("Append Brackets To Labels");
|
"Simplify Member References");
|
||||||
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_12 = new JCheckBoxMenuItem("Update Check");
|
public final JCheckBoxMenuItem mnMergeVariables = new JCheckBoxMenuItem(
|
||||||
|
"Merge Variables");
|
||||||
|
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_1 = new JCheckBoxMenuItem(
|
||||||
|
"Unicode Output Enabled");
|
||||||
|
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_2 = new JCheckBoxMenuItem(
|
||||||
|
"Retain Pointless Switches");
|
||||||
|
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_3 = new JCheckBoxMenuItem(
|
||||||
|
"Include Line Numbers In Bytecode");
|
||||||
|
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_4 = new JCheckBoxMenuItem(
|
||||||
|
"Include Error Diagnostics");
|
||||||
|
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_5 = new JCheckBoxMenuItem(
|
||||||
|
"Retain Redundant Casts");
|
||||||
|
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_6 = new JCheckBoxMenuItem(
|
||||||
|
"Always Generate Exception Variable For Catch Blocks");
|
||||||
|
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_7 = new JCheckBoxMenuItem(
|
||||||
|
"Show Synthetic Members");
|
||||||
|
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_8 = new JCheckBoxMenuItem(
|
||||||
|
"Force Explicit Type Arguments");
|
||||||
|
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_9 = new JCheckBoxMenuItem(
|
||||||
|
"Force Explicit Imports");
|
||||||
|
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_10 = new JCheckBoxMenuItem(
|
||||||
|
"Flatten Switch Blocks");
|
||||||
|
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_11 = new JCheckBoxMenuItem(
|
||||||
|
"Exclude Nested Types");
|
||||||
|
public final JCheckBoxMenuItem chckbxmntmAppendBrackets = new JCheckBoxMenuItem(
|
||||||
|
"Append Brackets To Labels");
|
||||||
|
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_12 = new JCheckBoxMenuItem(
|
||||||
|
"Update Check");
|
||||||
private final JMenuItem mntmNewMenuItem_5 = new JMenuItem("EZ Inject");
|
private final JMenuItem mntmNewMenuItem_5 = new JMenuItem("EZ Inject");
|
||||||
private final JMenu mnNewMenu_5 = new JMenu("Obfuscate");
|
private final JMenu mnNewMenu_5 = new JMenu("Obfuscate");
|
||||||
private final JMenuItem mntmNewMenuItem_6 = new JMenuItem("Rename Fields");
|
private final JMenuItem mntmNewMenuItem_6 = new JMenuItem("Rename Fields");
|
||||||
private final JMenuItem mntmNewMenuItem_7 = new JMenuItem("Rename Methods");
|
private final JMenuItem mntmNewMenuItem_7 = new JMenuItem("Rename Methods");
|
||||||
private final JMenuItem mntmNewMenuItem_8 = new JMenuItem("Move All Classes Into Root Package");
|
private final JMenuItem mntmNewMenuItem_8 = new JMenuItem(
|
||||||
|
"Move All Classes Into Root Package");
|
||||||
private final JMenuItem mntmNewMenuItem_9 = new JMenuItem("Control Flow");
|
private final JMenuItem mntmNewMenuItem_9 = new JMenuItem("Control Flow");
|
||||||
private final JMenuItem mntmNewMenuItem_10 = new JMenuItem("Junk Code");
|
private final JMenuItem mntmNewMenuItem_10 = new JMenuItem("Junk Code");
|
||||||
public final ButtonGroup obfuscatorGroup = new ButtonGroup();
|
public final ButtonGroup obfuscatorGroup = new ButtonGroup();
|
||||||
public final JRadioButtonMenuItem strongObf = new JRadioButtonMenuItem("Strong Obfuscation");
|
public final JRadioButtonMenuItem strongObf = new JRadioButtonMenuItem(
|
||||||
public final JRadioButtonMenuItem lightObf = new JRadioButtonMenuItem("Light Obfuscation");
|
"Strong Obfuscation");
|
||||||
|
public final JRadioButtonMenuItem lightObf = new JRadioButtonMenuItem(
|
||||||
|
"Light Obfuscation");
|
||||||
private final JMenuItem mntmNewMenuItem_11 = new JMenuItem("Rename Classes");
|
private final JMenuItem mntmNewMenuItem_11 = new JMenuItem("Rename Classes");
|
||||||
private final JSeparator separator_2 = new JSeparator();
|
private final JSeparator separator_2 = new JSeparator();
|
||||||
|
public final ButtonGroup decompilerGroup1 = new ButtonGroup();
|
||||||
|
public final ButtonGroup decompilerGroup2 = new ButtonGroup();
|
||||||
|
public final ButtonGroup decompilerGroup3 = new ButtonGroup();
|
||||||
|
private final JMenu mnNewMenu_6 = new JMenu("View");
|
||||||
|
private final JMenu mnNewMenu_7 = new JMenu("Pane 1");
|
||||||
|
private final JMenu mnNewMenu_8 = new JMenu("Pane 2");
|
||||||
|
private final JMenu mnNewMenu_9 = new JMenu("Pane 3");
|
||||||
|
public final JRadioButtonMenuItem panel1None = new JRadioButtonMenuItem(
|
||||||
|
"None");
|
||||||
|
public final JRadioButtonMenuItem panel1Hexcode = new JRadioButtonMenuItem(
|
||||||
|
"Hexcode");
|
||||||
|
public final JRadioButtonMenuItem panel1Bytecode = new JRadioButtonMenuItem(
|
||||||
|
"Bytecode");
|
||||||
|
public final JRadioButtonMenuItem panel1Fern = new JRadioButtonMenuItem(
|
||||||
|
"FernFlower");
|
||||||
|
public final JRadioButtonMenuItem panel1CFR = new JRadioButtonMenuItem(
|
||||||
|
"CFR");
|
||||||
|
public final JRadioButtonMenuItem panel1Proc = new JRadioButtonMenuItem(
|
||||||
|
"Procyon");
|
||||||
|
public final JRadioButtonMenuItem panel2None = new JRadioButtonMenuItem(
|
||||||
|
"None");
|
||||||
|
public final JRadioButtonMenuItem panel2Proc = new JRadioButtonMenuItem(
|
||||||
|
"Procyon");
|
||||||
|
public final JRadioButtonMenuItem panel2CFR = new JRadioButtonMenuItem(
|
||||||
|
"CFR");
|
||||||
|
public final JRadioButtonMenuItem panel2Bytecode = new JRadioButtonMenuItem(
|
||||||
|
"Bytecode");
|
||||||
|
public final JRadioButtonMenuItem panel2Fern = new JRadioButtonMenuItem(
|
||||||
|
"FernFlower");
|
||||||
|
public final JRadioButtonMenuItem panel2Hexcode = new JRadioButtonMenuItem(
|
||||||
|
"Hexcode");
|
||||||
|
public final JRadioButtonMenuItem panel3None = new JRadioButtonMenuItem(
|
||||||
|
"None");
|
||||||
|
public final JRadioButtonMenuItem panel3Proc = new JRadioButtonMenuItem(
|
||||||
|
"Procyon");
|
||||||
|
public final JRadioButtonMenuItem panel3CFR = new JRadioButtonMenuItem(
|
||||||
|
"CFR");
|
||||||
|
public final JRadioButtonMenuItem panel3Fern = new JRadioButtonMenuItem(
|
||||||
|
"FernFlower");
|
||||||
|
public final JRadioButtonMenuItem panel3Bytecode = new JRadioButtonMenuItem(
|
||||||
|
"Bytecode");
|
||||||
|
public final JRadioButtonMenuItem panel3Hexcode = new JRadioButtonMenuItem(
|
||||||
|
"Hexcode");
|
||||||
|
|
||||||
public void setC(boolean busy) {
|
public void setC(boolean busy) {
|
||||||
if (busy) {
|
if (busy) {
|
||||||
|
@ -193,7 +306,8 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
if (c instanceof WorkPane) {
|
if (c instanceof WorkPane) {
|
||||||
WorkPane w = (WorkPane) c;
|
WorkPane w = (WorkPane) c;
|
||||||
for (Component c2 : w.tabs.getComponents())
|
for (Component c2 : w.tabs.getComponents())
|
||||||
c2.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
c2.setCursor(Cursor
|
||||||
|
.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -209,7 +323,8 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
if (c instanceof WorkPane) {
|
if (c instanceof WorkPane) {
|
||||||
WorkPane w = (WorkPane) c;
|
WorkPane w = (WorkPane) c;
|
||||||
for (Component c2 : w.tabs.getComponents())
|
for (Component c2 : w.tabs.getComponents())
|
||||||
c2.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
c2.setCursor(Cursor
|
||||||
|
.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,9 +335,13 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (busy) {
|
if (busy) {
|
||||||
try {
|
try {
|
||||||
mntmNewMenuItem_4.setIcon(new ImageIcon(getClass().getResource("/resources/1.gif")));
|
mntmNewMenuItem_4.setIcon(new ImageIcon(getClass()
|
||||||
|
.getResource("/resources/1.gif")));
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
mntmNewMenuItem_4.setIcon(new ImageIcon(BytecodeViewer.b642IMG("R0lGODlhEAALAPQAAP///wAAANra2tDQ0Orq6gcHBwAAAC8vL4KCgmFhYbq6uiMjI0tLS4qKimVlZb6+vicnJwUFBU9PT+bm5tjY2PT09Dk5Odzc3PLy8ra2tqCgoMrKyu7u7gAAAAAAAAAAACH5BAkLAAAAIf4aQ3JlYXRlZCB3aXRoIGFqYXhsb2FkLmluZm8AIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAEAALAAAFLSAgjmRpnqSgCuLKAq5AEIM4zDVw03ve27ifDgfkEYe04kDIDC5zrtYKRa2WQgAh+QQJCwAAACwAAAAAEAALAAAFJGBhGAVgnqhpHIeRvsDawqns0qeN5+y967tYLyicBYE7EYkYAgAh+QQJCwAAACwAAAAAEAALAAAFNiAgjothLOOIJAkiGgxjpGKiKMkbz7SN6zIawJcDwIK9W/HISxGBzdHTuBNOmcJVCyoUlk7CEAAh+QQJCwAAACwAAAAAEAALAAAFNSAgjqQIRRFUAo3jNGIkSdHqPI8Tz3V55zuaDacDyIQ+YrBH+hWPzJFzOQQaeavWi7oqnVIhACH5BAkLAAAALAAAAAAQAAsAAAUyICCOZGme1rJY5kRRk7hI0mJSVUXJtF3iOl7tltsBZsNfUegjAY3I5sgFY55KqdX1GgIAIfkECQsAAAAsAAAAABAACwAABTcgII5kaZ4kcV2EqLJipmnZhWGXaOOitm2aXQ4g7P2Ct2ER4AMul00kj5g0Al8tADY2y6C+4FIIACH5BAkLAAAALAAAAAAQAAsAAAUvICCOZGme5ERRk6iy7qpyHCVStA3gNa/7txxwlwv2isSacYUc+l4tADQGQ1mvpBAAIfkECQsAAAAsAAAAABAACwAABS8gII5kaZ7kRFGTqLLuqnIcJVK0DeA1r/u3HHCXC/aKxJpxhRz6Xi0ANAZDWa+kEAA7"), ""));
|
mntmNewMenuItem_4.setIcon(new ImageIcon(
|
||||||
|
BytecodeViewer
|
||||||
|
.b642IMG("R0lGODlhEAALAPQAAP///wAAANra2tDQ0Orq6gcHBwAAAC8vL4KCgmFhYbq6uiMjI0tLS4qKimVlZb6+vicnJwUFBU9PT+bm5tjY2PT09Dk5Odzc3PLy8ra2tqCgoMrKyu7u7gAAAAAAAAAAACH5BAkLAAAAIf4aQ3JlYXRlZCB3aXRoIGFqYXhsb2FkLmluZm8AIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAEAALAAAFLSAgjmRpnqSgCuLKAq5AEIM4zDVw03ve27ifDgfkEYe04kDIDC5zrtYKRa2WQgAh+QQJCwAAACwAAAAAEAALAAAFJGBhGAVgnqhpHIeRvsDawqns0qeN5+y967tYLyicBYE7EYkYAgAh+QQJCwAAACwAAAAAEAALAAAFNiAgjothLOOIJAkiGgxjpGKiKMkbz7SN6zIawJcDwIK9W/HISxGBzdHTuBNOmcJVCyoUlk7CEAAh+QQJCwAAACwAAAAAEAALAAAFNSAgjqQIRRFUAo3jNGIkSdHqPI8Tz3V55zuaDacDyIQ+YrBH+hWPzJFzOQQaeavWi7oqnVIhACH5BAkLAAAALAAAAAAQAAsAAAUyICCOZGme1rJY5kRRk7hI0mJSVUXJtF3iOl7tltsBZsNfUegjAY3I5sgFY55KqdX1GgIAIfkECQsAAAAsAAAAABAACwAABTcgII5kaZ4kcV2EqLJipmnZhWGXaOOitm2aXQ4g7P2Ct2ER4AMul00kj5g0Al8tADY2y6C+4FIIACH5BAkLAAAALAAAAAAQAAsAAAUvICCOZGme5ERRk6iy7qpyHCVStA3gNa/7txxwlwv2isSacYUc+l4tADQGQ1mvpBAAIfkECQsAAAAsAAAAABAACwAABS8gII5kaZ7kRFGTqLLuqnIcJVK0DeA1r/u3HHCXC/aKxJpxhRz6Xi0ANAZDWa+kEAA7"),
|
||||||
|
""));
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
mntmNewMenuItem_4.setIcon(null);
|
mntmNewMenuItem_4.setIcon(null);
|
||||||
|
@ -233,10 +352,27 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
|
|
||||||
public MainViewerGUI() {
|
public MainViewerGUI() {
|
||||||
this.setIconImages(BytecodeViewer.iconList);
|
this.setIconImages(BytecodeViewer.iconList);
|
||||||
decompilerGroup.add(fernflowerDec);
|
decompilerGroup1.add(panel1None);
|
||||||
decompilerGroup.add(procyonDec);
|
decompilerGroup1.add(panel1Fern);
|
||||||
decompilerGroup.add(cfrDec);
|
decompilerGroup1.add(panel1Proc);
|
||||||
decompilerGroup.setSelected(procyonDec.getModel(), true);
|
decompilerGroup1.add(panel1CFR);
|
||||||
|
decompilerGroup1.add(panel1Bytecode);
|
||||||
|
decompilerGroup1.add(panel1Hexcode);
|
||||||
|
decompilerGroup1.setSelected(panel1Proc.getModel(), true);
|
||||||
|
decompilerGroup2.add(panel2None);
|
||||||
|
decompilerGroup2.add(panel2Fern);
|
||||||
|
decompilerGroup2.add(panel2Proc);
|
||||||
|
decompilerGroup2.add(panel2CFR);
|
||||||
|
decompilerGroup2.add(panel2Bytecode);
|
||||||
|
decompilerGroup2.add(panel2Hexcode);
|
||||||
|
decompilerGroup2.setSelected(panel2Bytecode.getModel(), true);
|
||||||
|
decompilerGroup3.add(panel3None);
|
||||||
|
decompilerGroup3.add(panel3Fern);
|
||||||
|
decompilerGroup3.add(panel3Proc);
|
||||||
|
decompilerGroup3.add(panel3CFR);
|
||||||
|
decompilerGroup3.add(panel3Bytecode);
|
||||||
|
decompilerGroup3.add(panel3Hexcode);
|
||||||
|
decompilerGroup3.setSelected(panel3None.getModel(), true);
|
||||||
obfuscatorGroup.add(strongObf);
|
obfuscatorGroup.add(strongObf);
|
||||||
obfuscatorGroup.add(lightObf);
|
obfuscatorGroup.add(lightObf);
|
||||||
obfuscatorGroup.setSelected(strongObf.getModel(), true);
|
obfuscatorGroup.setSelected(strongObf.getModel(), true);
|
||||||
|
@ -253,8 +389,6 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
fdi.setSelected(true);
|
fdi.setSelected(true);
|
||||||
asc.setSelected(false);
|
asc.setSelected(false);
|
||||||
debugHelpers.setSelected(true);
|
debugHelpers.setSelected(true);
|
||||||
sourcePane.setSelected(true);
|
|
||||||
bytecodePane.setSelected(true);
|
|
||||||
// cfr
|
// cfr
|
||||||
decodeenumswitch.setSelected(true);
|
decodeenumswitch.setSelected(true);
|
||||||
sugarenums.setSelected(true);
|
sugarenums.setSelected(true);
|
||||||
|
@ -330,7 +464,8 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
if (returnVal == JFileChooser.APPROVE_OPTION)
|
if (returnVal == JFileChooser.APPROVE_OPTION)
|
||||||
try {
|
try {
|
||||||
BytecodeViewer.viewer.setC(true);
|
BytecodeViewer.viewer.setC(true);
|
||||||
BytecodeViewer.openFiles(new File[]{fc.getSelectedFile()});
|
BytecodeViewer.openFiles(new File[] { fc
|
||||||
|
.getSelectedFile() });
|
||||||
BytecodeViewer.viewer.setC(false);
|
BytecodeViewer.viewer.setC(false);
|
||||||
} catch (Exception e1) {
|
} catch (Exception e1) {
|
||||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1);
|
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1);
|
||||||
|
@ -352,7 +487,8 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||||
File file = fc.getSelectedFile();
|
File file = fc.getSelectedFile();
|
||||||
BytecodeViewer.viewer.setC(true);
|
BytecodeViewer.viewer.setC(true);
|
||||||
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), file.getAbsolutePath());
|
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(),
|
||||||
|
file.getAbsolutePath());
|
||||||
BytecodeViewer.viewer.setC(false);
|
BytecodeViewer.viewer.setC(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -387,17 +523,69 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
int returnVal = fc.showSaveDialog(MainViewerGUI.this);
|
int returnVal = fc.showSaveDialog(MainViewerGUI.this);
|
||||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||||
File file = fc.getSelectedFile();
|
File file = fc.getSelectedFile();
|
||||||
BytecodeViewer.viewer.setC(true);
|
BytecodeViewer.viewer.setIcon(true);
|
||||||
String path = file.getAbsolutePath();
|
final String path = appendZip(file);// cheap hax cause
|
||||||
if(!path.endsWith(".zip"))
|
// string is final
|
||||||
path = path + ".zip";
|
|
||||||
if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.fernflowerDec.getModel()))
|
JOptionPane pane = new JOptionPane(
|
||||||
ff_dc.decompileToZip(path);
|
"What decompiler will you use?");
|
||||||
else if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.procyonDec.getModel()))
|
Object[] options = new String[] { "Procyon", "CFR",
|
||||||
|
"Fernflower", "Cancel" };
|
||||||
|
pane.setOptions(options);
|
||||||
|
JDialog dialog = pane.createDialog(BytecodeViewer.viewer,
|
||||||
|
"Bytecode Viewer - Select Decompiler");
|
||||||
|
dialog.setVisible(true);
|
||||||
|
Object obj = pane.getValue();
|
||||||
|
int result = -1;
|
||||||
|
for (int k = 0; k < options.length; k++)
|
||||||
|
if (options[k].equals(obj))
|
||||||
|
result = k;
|
||||||
|
|
||||||
|
if (result == 0) {
|
||||||
|
Thread t = new Thread() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
proc_dc.decompileToZip(path);
|
proc_dc.decompileToZip(path);
|
||||||
else if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.cfrDec.getModel()))
|
BytecodeViewer.viewer.setIcon(false);
|
||||||
|
} catch (Exception e) {
|
||||||
|
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(
|
||||||
|
e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
t.start();
|
||||||
|
}
|
||||||
|
if (result == 1) {
|
||||||
|
Thread t = new Thread() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
cfr_dc.decompileToZip(path);
|
cfr_dc.decompileToZip(path);
|
||||||
BytecodeViewer.viewer.setC(false);
|
BytecodeViewer.viewer.setIcon(false);
|
||||||
|
} catch (Exception e) {
|
||||||
|
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(
|
||||||
|
e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
t.start();
|
||||||
|
}
|
||||||
|
if (result == 2) {
|
||||||
|
Thread t = new Thread() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
ff_dc.decompileToZip(path);
|
||||||
|
BytecodeViewer.viewer.setIcon(false);
|
||||||
|
} catch (Exception e) {
|
||||||
|
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(
|
||||||
|
e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
t.start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -425,10 +613,12 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
mntmExit.addActionListener(new ActionListener() {
|
mntmExit.addActionListener(new ActionListener() {
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
JOptionPane pane = new JOptionPane("Are you sure you want to exit?");
|
JOptionPane pane = new JOptionPane(
|
||||||
|
"Are you sure you want to exit?");
|
||||||
Object[] options = new String[] { "Yes", "No" };
|
Object[] options = new String[] { "Yes", "No" };
|
||||||
pane.setOptions(options);
|
pane.setOptions(options);
|
||||||
JDialog dialog = pane.createDialog(BytecodeViewer.viewer, "Bytecode Viewer - Exit");
|
JDialog dialog = pane.createDialog(BytecodeViewer.viewer,
|
||||||
|
"Bytecode Viewer - Exit");
|
||||||
dialog.show();
|
dialog.show();
|
||||||
Object obj = pane.getValue();
|
Object obj = pane.getValue();
|
||||||
int result = -1;
|
int result = -1;
|
||||||
|
@ -436,7 +626,6 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
if (options[k].equals(obj))
|
if (options[k].equals(obj))
|
||||||
result = k;
|
result = k;
|
||||||
|
|
||||||
|
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
@ -444,20 +633,49 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
});
|
});
|
||||||
mnNewMenu.add(mntmExit);
|
mnNewMenu.add(mntmExit);
|
||||||
|
|
||||||
JMenu mnView = new JMenu("View");
|
menuBar.add(mnNewMenu_6);
|
||||||
menuBar.add(mnView);
|
|
||||||
|
|
||||||
mnView.add(sourcePane);
|
mnNewMenu_6.add(mnNewMenu_7);
|
||||||
mnView.add(bytecodePane);
|
|
||||||
mnView.add(hexPane);
|
|
||||||
|
|
||||||
menuBar.add(mnNewMenu_2);
|
mnNewMenu_7.add(panel1None);
|
||||||
|
|
||||||
mnNewMenu_2.add(procyonDec);
|
mnNewMenu_7.add(panel1Proc);
|
||||||
|
|
||||||
mnNewMenu_2.add(cfrDec);
|
mnNewMenu_7.add(panel1CFR);
|
||||||
|
|
||||||
mnNewMenu_2.add(fernflowerDec);
|
mnNewMenu_7.add(panel1Fern);
|
||||||
|
|
||||||
|
mnNewMenu_7.add(panel1Bytecode);
|
||||||
|
|
||||||
|
mnNewMenu_7.add(panel1Hexcode);
|
||||||
|
|
||||||
|
mnNewMenu_6.add(mnNewMenu_8);
|
||||||
|
|
||||||
|
mnNewMenu_8.add(panel2None);
|
||||||
|
|
||||||
|
mnNewMenu_8.add(panel2Proc);
|
||||||
|
|
||||||
|
mnNewMenu_8.add(panel2CFR);
|
||||||
|
|
||||||
|
mnNewMenu_8.add(panel2Fern);
|
||||||
|
|
||||||
|
mnNewMenu_8.add(panel2Bytecode);
|
||||||
|
|
||||||
|
mnNewMenu_8.add(panel2Hexcode);
|
||||||
|
|
||||||
|
mnNewMenu_6.add(mnNewMenu_9);
|
||||||
|
|
||||||
|
mnNewMenu_9.add(panel3None);
|
||||||
|
|
||||||
|
mnNewMenu_9.add(panel3Proc);
|
||||||
|
|
||||||
|
mnNewMenu_9.add(panel3CFR);
|
||||||
|
|
||||||
|
mnNewMenu_9.add(panel3Fern);
|
||||||
|
|
||||||
|
mnNewMenu_9.add(panel3Bytecode);
|
||||||
|
|
||||||
|
mnNewMenu_9.add(panel3Hexcode);
|
||||||
|
|
||||||
menuBar.add(mnNewMenu_4);
|
menuBar.add(mnNewMenu_4);
|
||||||
|
|
||||||
|
@ -615,14 +833,14 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
|
|
||||||
mnBytecodeDecompilerSettings.add(chckbxmntmAppendBrackets);
|
mnBytecodeDecompilerSettings.add(chckbxmntmAppendBrackets);
|
||||||
|
|
||||||
mnBytecodeDecompilerSettings.add(chckbxmntmNewCheckItem);
|
|
||||||
mnNewMenu_5.setVisible(false);
|
mnNewMenu_5.setVisible(false);
|
||||||
|
|
||||||
menuBar.add(mnNewMenu_5);
|
menuBar.add(mnNewMenu_5);
|
||||||
mntmNewMenuItem_6.addActionListener(new ActionListener() {
|
mntmNewMenuItem_6.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
if (BytecodeViewer.runningObfuscation) {
|
if (BytecodeViewer.runningObfuscation) {
|
||||||
BytecodeViewer.showMessage("You're currently running an obfuscation task, wait for this to finish.");
|
BytecodeViewer
|
||||||
|
.showMessage("You're currently running an obfuscation task, wait for this to finish.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new RenameFields().start();
|
new RenameFields().start();
|
||||||
|
@ -642,7 +860,8 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
mntmNewMenuItem_7.addActionListener(new ActionListener() {
|
mntmNewMenuItem_7.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
if (BytecodeViewer.runningObfuscation) {
|
if (BytecodeViewer.runningObfuscation) {
|
||||||
BytecodeViewer.showMessage("You're currently running an obfuscation task, wait for this to finish.");
|
BytecodeViewer
|
||||||
|
.showMessage("You're currently running an obfuscation task, wait for this to finish.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new RenameMethods().start();
|
new RenameMethods().start();
|
||||||
|
@ -653,7 +872,8 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
mntmNewMenuItem_11.addActionListener(new ActionListener() {
|
mntmNewMenuItem_11.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
if (BytecodeViewer.runningObfuscation) {
|
if (BytecodeViewer.runningObfuscation) {
|
||||||
BytecodeViewer.showMessage("You're currently running an obfuscation task, wait for this to finish.");
|
BytecodeViewer
|
||||||
|
.showMessage("You're currently running an obfuscation task, wait for this to finish.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new RenameClasses().start();
|
new RenameClasses().start();
|
||||||
|
@ -681,8 +901,10 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
if (!BytecodeViewer.loadedClasses.isEmpty())
|
if (!BytecodeViewer.loadedClasses.isEmpty())
|
||||||
new ReplaceStringsOptions().setVisible(true);
|
new ReplaceStringsOptions().setVisible(true);
|
||||||
else {
|
else {
|
||||||
System.out.println("Plugin not ran, put some classes in first.");
|
System.out
|
||||||
BytecodeViewer.showMessage("Plugin not ran, put some classes in first.");
|
.println("Plugin not ran, put some classes in first.");
|
||||||
|
BytecodeViewer
|
||||||
|
.showMessage("Plugin not ran, put some classes in first.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -695,8 +917,10 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
if (!BytecodeViewer.loadedClasses.isEmpty())
|
if (!BytecodeViewer.loadedClasses.isEmpty())
|
||||||
new EZInjectionOptions().setVisible(true);
|
new EZInjectionOptions().setVisible(true);
|
||||||
else {
|
else {
|
||||||
System.out.println("Plugin not ran, put some classes in first.");
|
System.out
|
||||||
BytecodeViewer.showMessage("Plugin not ran, put some classes in first.");
|
.println("Plugin not ran, put some classes in first.");
|
||||||
|
BytecodeViewer
|
||||||
|
.showMessage("Plugin not ran, put some classes in first.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -705,7 +929,6 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
|
|
||||||
menuBar.add(mntmNewMenuItem_4);
|
menuBar.add(mntmNewMenuItem_4);
|
||||||
|
|
||||||
|
|
||||||
mntmStartExternalPlugin.addActionListener(new ActionListener() {
|
mntmStartExternalPlugin.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
JFileChooser fc = new JFileChooser();
|
JFileChooser fc = new JFileChooser();
|
||||||
|
@ -739,8 +962,10 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
if (!BytecodeViewer.loadedClasses.isEmpty())
|
if (!BytecodeViewer.loadedClasses.isEmpty())
|
||||||
new MaliciousCodeScannerOptions().setVisible(true);
|
new MaliciousCodeScannerOptions().setVisible(true);
|
||||||
else {
|
else {
|
||||||
System.out.println("Plugin not ran, put some classes in first.");
|
System.out
|
||||||
BytecodeViewer.showMessage("Plugin not ran, put some classes in first.");
|
.println("Plugin not ran, put some classes in first.");
|
||||||
|
BytecodeViewer
|
||||||
|
.showMessage("Plugin not ran, put some classes in first.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -757,8 +982,9 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
});
|
});
|
||||||
|
|
||||||
setSize(new Dimension(800, 400));
|
setSize(new Dimension(800, 400));
|
||||||
setTitle("Bytecode Viewer " + BytecodeViewer.version + " - http://the.bytecode.club - @Konloch");
|
setTitle("Bytecode Viewer 2.3.0 - https://the.bytecode.club - @Konloch");
|
||||||
getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.X_AXIS));
|
getContentPane().setLayout(
|
||||||
|
new BoxLayout(getContentPane(), BoxLayout.X_AXIS));
|
||||||
|
|
||||||
// scrollPane.setViewportView(tree);
|
// scrollPane.setViewportView(tree);
|
||||||
FileNavigationPane cn = new FileNavigationPane(this);
|
FileNavigationPane cn = new FileNavigationPane(this);
|
||||||
|
@ -785,6 +1011,13 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
this.setLocationRelativeTo(null);
|
this.setLocationRelativeTo(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String appendZip(File file) {
|
||||||
|
String path = file.getAbsolutePath();
|
||||||
|
if (!path.endsWith(".zip"))
|
||||||
|
path = path + ".zip";
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openClassFile(final String name, final ClassNode cn) {
|
public void openClassFile(final String name, final ClassNode cn) {
|
||||||
for (final VisibleComponent vc : rfComps) {
|
for (final VisibleComponent vc : rfComps) {
|
||||||
|
@ -809,9 +1042,9 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
|
|
||||||
String extension = getExtension(f);
|
String extension = getExtension(f);
|
||||||
if (extension != null)
|
if (extension != null)
|
||||||
return (extension.equals("gy") || extension.equals("groovy") ||
|
return (extension.equals("gy") || extension.equals("groovy")
|
||||||
extension.equals("py") || extension.equals("python") ||
|
|| extension.equals("py") || extension.equals("python")
|
||||||
extension.equals("rb") || extension.equals("ruby"));
|
|| extension.equals("rb") || extension.equals("ruby"));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -841,7 +1074,8 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
||||||
|
|
||||||
String extension = getExtension(f);
|
String extension = getExtension(f);
|
||||||
if (extension != null)
|
if (extension != null)
|
||||||
return (extension.equals("jar") || extension.equals("zip") || extension.equals("class"));
|
return (extension.equals("jar") || extension.equals("zip") || extension
|
||||||
|
.equals("class"));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,8 @@ public class MaliciousCodeScannerOptions extends JFrame {
|
||||||
setTitle("Malicious Code Scanner Options");
|
setTitle("Malicious Code Scanner Options");
|
||||||
getContentPane().setLayout(null);
|
getContentPane().setLayout(null);
|
||||||
|
|
||||||
final JCheckBox chckbxJavalangreflection = new JCheckBox("java/lang/reflection");
|
final JCheckBox chckbxJavalangreflection = new JCheckBox(
|
||||||
|
"java/lang/reflection");
|
||||||
chckbxJavalangreflection.setSelected(true);
|
chckbxJavalangreflection.setSelected(true);
|
||||||
chckbxJavalangreflection.setBounds(6, 7, 232, 23);
|
chckbxJavalangreflection.setBounds(6, 7, 232, 23);
|
||||||
getContentPane().add(chckbxJavalangreflection);
|
getContentPane().add(chckbxJavalangreflection);
|
||||||
|
@ -36,27 +37,32 @@ public class MaliciousCodeScannerOptions extends JFrame {
|
||||||
chckbxJavaio.setBounds(6, 85, 232, 23);
|
chckbxJavaio.setBounds(6, 85, 232, 23);
|
||||||
getContentPane().add(chckbxJavaio);
|
getContentPane().add(chckbxJavaio);
|
||||||
|
|
||||||
final JCheckBox chckbxJavalangruntime = new JCheckBox("java/lang/Runtime");
|
final JCheckBox chckbxJavalangruntime = new JCheckBox(
|
||||||
|
"java/lang/Runtime");
|
||||||
chckbxJavalangruntime.setSelected(true);
|
chckbxJavalangruntime.setSelected(true);
|
||||||
chckbxJavalangruntime.setBounds(6, 33, 232, 23);
|
chckbxJavalangruntime.setBounds(6, 33, 232, 23);
|
||||||
getContentPane().add(chckbxJavalangruntime);
|
getContentPane().add(chckbxJavalangruntime);
|
||||||
|
|
||||||
final JCheckBox chckbxLdcContainswww = new JCheckBox("LDC contains 'www.'");
|
final JCheckBox chckbxLdcContainswww = new JCheckBox(
|
||||||
|
"LDC contains 'www.'");
|
||||||
chckbxLdcContainswww.setSelected(true);
|
chckbxLdcContainswww.setSelected(true);
|
||||||
chckbxLdcContainswww.setBounds(6, 111, 232, 23);
|
chckbxLdcContainswww.setBounds(6, 111, 232, 23);
|
||||||
getContentPane().add(chckbxLdcContainswww);
|
getContentPane().add(chckbxLdcContainswww);
|
||||||
|
|
||||||
final JCheckBox chckbxLdcContainshttp = new JCheckBox("LDC contains 'http://'");
|
final JCheckBox chckbxLdcContainshttp = new JCheckBox(
|
||||||
|
"LDC contains 'http://'");
|
||||||
chckbxLdcContainshttp.setSelected(true);
|
chckbxLdcContainshttp.setSelected(true);
|
||||||
chckbxLdcContainshttp.setBounds(6, 137, 232, 23);
|
chckbxLdcContainshttp.setBounds(6, 137, 232, 23);
|
||||||
getContentPane().add(chckbxLdcContainshttp);
|
getContentPane().add(chckbxLdcContainshttp);
|
||||||
|
|
||||||
final JCheckBox chckbxLdcContainshttps = new JCheckBox("LDC contains 'https://'");
|
final JCheckBox chckbxLdcContainshttps = new JCheckBox(
|
||||||
|
"LDC contains 'https://'");
|
||||||
chckbxLdcContainshttps.setSelected(true);
|
chckbxLdcContainshttps.setSelected(true);
|
||||||
chckbxLdcContainshttps.setBounds(6, 163, 232, 23);
|
chckbxLdcContainshttps.setBounds(6, 163, 232, 23);
|
||||||
getContentPane().add(chckbxLdcContainshttps);
|
getContentPane().add(chckbxLdcContainshttps);
|
||||||
|
|
||||||
final JCheckBox chckbxLdcMatchesIp = new JCheckBox("LDC matches IP regex");
|
final JCheckBox chckbxLdcMatchesIp = new JCheckBox(
|
||||||
|
"LDC matches IP regex");
|
||||||
chckbxLdcMatchesIp.setSelected(true);
|
chckbxLdcMatchesIp.setSelected(true);
|
||||||
chckbxLdcMatchesIp.setBounds(6, 189, 232, 23);
|
chckbxLdcMatchesIp.setBounds(6, 189, 232, 23);
|
||||||
getContentPane().add(chckbxLdcMatchesIp);
|
getContentPane().add(chckbxLdcMatchesIp);
|
||||||
|
@ -64,10 +70,14 @@ public class MaliciousCodeScannerOptions extends JFrame {
|
||||||
JButton btnNewButton = new JButton("Start Scanning");
|
JButton btnNewButton = new JButton("Start Scanning");
|
||||||
btnNewButton.addActionListener(new ActionListener() {
|
btnNewButton.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
PluginManager.runPlugin(new MaliciousCodeScanner(chckbxJavalangreflection.isSelected(),
|
PluginManager.runPlugin(new MaliciousCodeScanner(
|
||||||
chckbxJavalangruntime.isSelected(), chckbxJavanet.isSelected(), chckbxJavaio.isSelected(),
|
chckbxJavalangreflection.isSelected(),
|
||||||
chckbxLdcContainswww.isSelected(), chckbxLdcContainshttp.isSelected(), chckbxLdcContainshttps.isSelected(),
|
chckbxJavalangruntime.isSelected(), chckbxJavanet
|
||||||
chckbxLdcMatchesIp.isSelected()));
|
.isSelected(), chckbxJavaio.isSelected(),
|
||||||
|
chckbxLdcContainswww.isSelected(),
|
||||||
|
chckbxLdcContainshttp.isSelected(),
|
||||||
|
chckbxLdcContainshttps.isSelected(), chckbxLdcMatchesIp
|
||||||
|
.isSelected()));
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -57,13 +57,17 @@ public class ReplaceStringsOptions extends JFrame {
|
||||||
getContentPane().add(textField_2);
|
getContentPane().add(textField_2);
|
||||||
textField_2.setColumns(10);
|
textField_2.setColumns(10);
|
||||||
|
|
||||||
final JCheckBox chckbxNewCheckBox = new JCheckBox("Replace All Contains");
|
final JCheckBox chckbxNewCheckBox = new JCheckBox(
|
||||||
chckbxNewCheckBox.setToolTipText("If it's unticked, it will check if the string equals, if its ticked it will check if it contains, then replace the original LDC part of the string.");
|
"Replace All Contains");
|
||||||
|
chckbxNewCheckBox
|
||||||
|
.setToolTipText("If it's unticked, it will check if the string equals, if its ticked it will check if it contains, then replace the original LDC part of the string.");
|
||||||
chckbxNewCheckBox.setBounds(6, 7, 232, 23);
|
chckbxNewCheckBox.setBounds(6, 7, 232, 23);
|
||||||
getContentPane().add(chckbxNewCheckBox);
|
getContentPane().add(chckbxNewCheckBox);
|
||||||
btnNewButton.addActionListener(new ActionListener() {
|
btnNewButton.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
PluginManager.runPlugin(new ReplaceStrings(textField.getText(), textField_1.getText(), textField_2.getText(), chckbxNewCheckBox.isSelected()));
|
PluginManager.runPlugin(new ReplaceStrings(textField.getText(),
|
||||||
|
textField_1.getText(), textField_2.getText(),
|
||||||
|
chckbxNewCheckBox.isSelected()));
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -122,7 +122,8 @@ public class SearchingPane extends VisibleComponent {
|
||||||
public void actionPerformed(final ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
treeRoot.removeAllChildren();
|
treeRoot.removeAllChildren();
|
||||||
searchType = (SearchType) typeBox.getSelectedItem();
|
searchType = (SearchType) typeBox.getSelectedItem();
|
||||||
final SearchRadius radius = (SearchRadius) searchRadiusBox.getSelectedItem();
|
final SearchRadius radius = (SearchRadius) searchRadiusBox
|
||||||
|
.getSelectedItem();
|
||||||
final SearchResultNotifier srn = new SearchResultNotifier() {
|
final SearchResultNotifier srn = new SearchResultNotifier() {
|
||||||
@Override
|
@Override
|
||||||
public void notifyOfResult(String debug) {
|
public void notifyOfResult(String debug) {
|
||||||
|
@ -134,27 +135,36 @@ public class SearchingPane extends VisibleComponent {
|
||||||
t = new BackgroundSearchThread() {
|
t = new BackgroundSearchThread() {
|
||||||
@Override
|
@Override
|
||||||
public void doSearch() {
|
public void doSearch() {
|
||||||
for (ClassNode cln : BytecodeViewer.getLoadedClasses())
|
for (ClassNode cln : BytecodeViewer
|
||||||
searchType.details.search(cln, srn, exact.isSelected());
|
.getLoadedClasses())
|
||||||
|
searchType.details.search(cln, srn,
|
||||||
|
exact.isSelected());
|
||||||
|
|
||||||
MainViewerGUI.getComponent(SearchingPane.class).search.setEnabled(true);
|
MainViewerGUI.getComponent(SearchingPane.class).search
|
||||||
MainViewerGUI.getComponent(SearchingPane.class).search.setText("Search");
|
.setEnabled(true);
|
||||||
tree.expandPath(new TreePath(tree.getModel().getRoot()));
|
MainViewerGUI.getComponent(SearchingPane.class).search
|
||||||
|
.setText("Search");
|
||||||
|
tree.expandPath(new TreePath(tree.getModel()
|
||||||
|
.getRoot()));
|
||||||
tree.updateUI();
|
tree.updateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
MainViewerGUI.getComponent(SearchingPane.class).search.setEnabled(false);
|
MainViewerGUI.getComponent(SearchingPane.class).search
|
||||||
MainViewerGUI.getComponent(SearchingPane.class).search.setText("Searching, please wait..");
|
.setEnabled(false);
|
||||||
|
MainViewerGUI.getComponent(SearchingPane.class).search
|
||||||
|
.setText("Searching, please wait..");
|
||||||
t.start();
|
t.start();
|
||||||
} else { // this should really never be called.
|
} else { // this should really never be called.
|
||||||
BytecodeViewer.showMessage("You currently have a search performing in the background, please wait for that to finish.");
|
BytecodeViewer
|
||||||
|
.showMessage("You currently have a search performing in the background, please wait for that to finish.");
|
||||||
}
|
}
|
||||||
}
|
} else if (radius == SearchRadius.Current_Class) {
|
||||||
else if (radius == SearchRadius.Current_Class) {
|
final ClassViewer cv = MainViewerGUI.getComponent(
|
||||||
final ClassViewer cv = MainViewerGUI.getComponent(WorkPane.class).getCurrentClass();
|
WorkPane.class).getCurrentClass();
|
||||||
if (cv != null) {
|
if (cv != null) {
|
||||||
searchType.details.search(cv.cn, srn, exact.isSelected());
|
searchType.details.search(cv.cn, srn,
|
||||||
|
exact.isSelected());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,7 +187,8 @@ public class SearchingPane extends VisibleComponent {
|
||||||
String className = path.split(", ")[1].split("\\.")[0];
|
String className = path.split(", ")[1].split("\\.")[0];
|
||||||
final ClassNode fN = BytecodeViewer.getClassNode(className);
|
final ClassNode fN = BytecodeViewer.getClassNode(className);
|
||||||
if (fN != null) {
|
if (fN != null) {
|
||||||
MainViewerGUI.getComponent(FileNavigationPane.class).openClassFileToWorkSpace(className, fN);
|
MainViewerGUI.getComponent(FileNavigationPane.class)
|
||||||
|
.openClassFileToWorkSpace(className, fN);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println(className);
|
System.out.println(className);
|
||||||
|
@ -189,10 +200,8 @@ public class SearchingPane extends VisibleComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SearchType {
|
public enum SearchType {
|
||||||
LDC (new LDCSearch()),
|
LDC(new LDCSearch()), Regex(new RegexSearch()), MethodCall(
|
||||||
Regex (new RegexSearch()),
|
new MethodCallSearch()), FieldCall(new FieldCallSearch());
|
||||||
MethodCall (new MethodCallSearch()),
|
|
||||||
FieldCall (new FieldCallSearch());
|
|
||||||
|
|
||||||
public final SearchTypeDetails details;
|
public final SearchTypeDetails details;
|
||||||
|
|
||||||
|
@ -202,8 +211,7 @@ public class SearchingPane extends VisibleComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SearchRadius {
|
public enum SearchRadius {
|
||||||
All_Classes,
|
All_Classes, Current_Class;
|
||||||
Current_Class;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetWorkspace() {
|
public void resetWorkspace() {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
package the.bytecode.club.bytecodeviewer.gui;
|
package the.bytecode.club.bytecodeviewer.gui;
|
||||||
|
|
||||||
import java.awt.BasicStroke;
|
import java.awt.BasicStroke;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
|
@ -21,8 +22,7 @@ import javax.swing.JTabbedPane;
|
||||||
import javax.swing.plaf.basic.BasicButtonUI;
|
import javax.swing.plaf.basic.BasicButtonUI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component to be used as tabComponent;
|
* Component to be used as tabComponent; Contains a JLabel to show the text and
|
||||||
* Contains a JLabel to show the text and
|
|
||||||
* a JButton to close the tab it belongs to
|
* a JButton to close the tab it belongs to
|
||||||
*
|
*
|
||||||
* @author Konloch
|
* @author Konloch
|
||||||
|
@ -76,10 +76,22 @@ public class TabbedPane extends JPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override public void mouseEntered(MouseEvent arg0) {}
|
|
||||||
@Override public void mouseExited(MouseEvent arg0) {}
|
@Override
|
||||||
@Override public void mousePressed(MouseEvent arg0) {}
|
public void mouseEntered(MouseEvent arg0) {
|
||||||
@Override public void mouseReleased(MouseEvent e) {}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseExited(MouseEvent arg0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mousePressed(MouseEvent arg0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseReleased(MouseEvent e) {
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -134,8 +146,10 @@ public class TabbedPane extends JPanel {
|
||||||
g2.setColor(Color.MAGENTA);
|
g2.setColor(Color.MAGENTA);
|
||||||
}
|
}
|
||||||
final int delta = 6;
|
final int delta = 6;
|
||||||
g2.drawLine(delta, delta, getWidth() - delta - 1, getHeight() - delta - 1);
|
g2.drawLine(delta, delta, getWidth() - delta - 1, getHeight()
|
||||||
g2.drawLine(getWidth() - delta - 1, delta, delta, getHeight() - delta - 1);
|
- delta - 1);
|
||||||
|
g2.drawLine(getWidth() - delta - 1, delta, delta, getHeight()
|
||||||
|
- delta - 1);
|
||||||
g2.dispose();
|
g2.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,8 @@ import the.bytecode.club.bytecodeviewer.FileChangeNotifier;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public abstract class VisibleComponent extends JInternalFrame implements FileChangeNotifier {
|
public abstract class VisibleComponent extends JInternalFrame implements
|
||||||
|
FileChangeNotifier {
|
||||||
|
|
||||||
private static final long serialVersionUID = -6453413772343643526L;
|
private static final long serialVersionUID = -6453413772343643526L;
|
||||||
|
|
||||||
|
@ -25,11 +26,13 @@ public abstract class VisibleComponent extends JInternalFrame implements FileCha
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private VisibleComponent() { //because we want to enforce the title argument
|
private VisibleComponent() { // because we want to enforce the title
|
||||||
|
// argument
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openClassFile(final String name, final ClassNode cn) {}
|
public void openClassFile(final String name, final ClassNode cn) {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ public class WorkPane extends VisibleComponent implements ActionListener {
|
||||||
|
|
||||||
private static final long serialVersionUID = 6542337997679487946L;
|
private static final long serialVersionUID = 6542337997679487946L;
|
||||||
|
|
||||||
|
|
||||||
FileChangeNotifier fcn;
|
FileChangeNotifier fcn;
|
||||||
JTabbedPane tabs;
|
JTabbedPane tabs;
|
||||||
|
|
||||||
|
@ -93,12 +92,6 @@ public class WorkPane extends VisibleComponent implements ActionListener {
|
||||||
int tabCount = 0;
|
int tabCount = 0;
|
||||||
|
|
||||||
public void addWorkingFile(final String name, final ClassNode cn) {
|
public void addWorkingFile(final String name, final ClassNode cn) {
|
||||||
if(!BytecodeViewer.viewer.hexPane.isSelected() &&
|
|
||||||
!BytecodeViewer.viewer.sourcePane.isSelected() &&
|
|
||||||
!BytecodeViewer.viewer.bytecodePane.isSelected()) {
|
|
||||||
BytecodeViewer.showMessage("You currently have no viewing panes selected.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!workingOn.containsKey(name)) {
|
if (!workingOn.containsKey(name)) {
|
||||||
final Component tabComp = new ClassViewer(name, cn);
|
final Component tabComp = new ClassViewer(name, cn);
|
||||||
tabs.add(tabComp);
|
tabs.add(tabComp);
|
||||||
|
|
|
@ -17,9 +17,11 @@ public abstract class JavaObfuscator extends Thread {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStringLength() {
|
public int getStringLength() {
|
||||||
if(BytecodeViewer.viewer.obfuscatorGroup.isSelected(BytecodeViewer.viewer.strongObf.getModel())) {
|
if (BytecodeViewer.viewer.obfuscatorGroup
|
||||||
|
.isSelected(BytecodeViewer.viewer.strongObf.getModel())) {
|
||||||
return MAX_STRING_LENGTH;
|
return MAX_STRING_LENGTH;
|
||||||
} else { //if(BytecodeViewer.viewer.obfuscatorGroup.isSelected(BytecodeViewer.viewer.lightObf.getModel())) {
|
} else { // if(BytecodeViewer.viewer.obfuscatorGroup.isSelected(BytecodeViewer.viewer.lightObf.getModel()))
|
||||||
|
// {
|
||||||
return MIN_STRING_LENGTH;
|
return MIN_STRING_LENGTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,12 +32,14 @@ public abstract class JavaObfuscator extends Thread {
|
||||||
private static final String AB = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
private static final String AB = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||||
private static final String AN = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
private static final String AN = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
private static Random rnd = new Random();
|
private static Random rnd = new Random();
|
||||||
|
|
||||||
private static String randomString(int len) {
|
private static String randomString(int len) {
|
||||||
StringBuilder sb = new StringBuilder(len);
|
StringBuilder sb = new StringBuilder(len);
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
sb.append(AB.charAt(rnd.nextInt(AB.length())));
|
sb.append(AB.charAt(rnd.nextInt(AB.length())));
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String randomStringNum(int len) {
|
private static String randomStringNum(int len) {
|
||||||
StringBuilder sb = new StringBuilder(len);
|
StringBuilder sb = new StringBuilder(len);
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
|
|
|
@ -17,7 +17,8 @@ public class RenameFields extends JavaObfuscator {
|
||||||
for (Object o : c.fields.toArray()) {
|
for (Object o : c.fields.toArray()) {
|
||||||
FieldNode f = (FieldNode) o;
|
FieldNode f = (FieldNode) o;
|
||||||
String newName = generateUniqueName(stringLength);
|
String newName = generateUniqueName(stringLength);
|
||||||
ASMUtil_OLD.renameFieldNode(c.name,f.name,f.desc, null, newName, null);
|
ASMUtil_OLD.renameFieldNode(c.name, f.name, f.desc, null,
|
||||||
|
newName, null);
|
||||||
f.name = newName;
|
f.name = newName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,21 +17,26 @@ public class RenameMethods extends JavaObfuscator {
|
||||||
for (ClassNode c : BytecodeViewer.getLoadedClasses()) {
|
for (ClassNode c : BytecodeViewer.getLoadedClasses()) {
|
||||||
for (Object o : c.methods.toArray()) {
|
for (Object o : c.methods.toArray()) {
|
||||||
MethodNode m = (MethodNode) o;
|
MethodNode m = (MethodNode) o;
|
||||||
if( m.access != Opcodes.ACC_ABSTRACT &&
|
if (m.access != Opcodes.ACC_ABSTRACT
|
||||||
m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC &&
|
&& m.access != Opcodes.ACC_ABSTRACT
|
||||||
m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC + Opcodes.ACC_PUBLIC &&
|
+ Opcodes.ACC_STATIC
|
||||||
m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC + Opcodes.ACC_PRIVATE &&
|
&& m.access != Opcodes.ACC_ABSTRACT
|
||||||
m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC + Opcodes.ACC_PROTECTED &&
|
+ Opcodes.ACC_STATIC + Opcodes.ACC_PUBLIC
|
||||||
m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_PUBLIC &&
|
&& m.access != Opcodes.ACC_ABSTRACT
|
||||||
m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_PRIVATE &&
|
+ Opcodes.ACC_STATIC + Opcodes.ACC_PRIVATE
|
||||||
m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_PROTECTED)
|
&& m.access != Opcodes.ACC_ABSTRACT
|
||||||
{
|
+ Opcodes.ACC_STATIC + Opcodes.ACC_PROTECTED
|
||||||
if(!m.name.equals("main") &&
|
&& m.access != Opcodes.ACC_ABSTRACT
|
||||||
!m.name.equals("<init>") &&
|
+ Opcodes.ACC_PUBLIC
|
||||||
!m.name.equals("<clinit>"))
|
&& m.access != Opcodes.ACC_ABSTRACT
|
||||||
{
|
+ Opcodes.ACC_PRIVATE
|
||||||
|
&& m.access != Opcodes.ACC_ABSTRACT
|
||||||
|
+ Opcodes.ACC_PROTECTED) {
|
||||||
|
if (!m.name.equals("main") && !m.name.equals("<init>")
|
||||||
|
&& !m.name.equals("<clinit>")) {
|
||||||
String newName = generateUniqueName(stringLength);
|
String newName = generateUniqueName(stringLength);
|
||||||
ASMUtil_OLD.renameMethodNode(c.name,m.name,m.desc,null,newName,null);
|
ASMUtil_OLD.renameMethodNode(c.name, m.name, m.desc,
|
||||||
|
null, newName, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,15 +20,16 @@ import the.bytecode.club.bytecodeviewer.api.PluginConsole;
|
||||||
import the.bytecode.club.bytecodeviewer.gui.GraphicialReflectionKit;
|
import the.bytecode.club.bytecodeviewer.gui.GraphicialReflectionKit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EZ Injection - This plugin is designed to provide a graphical way for the user to
|
* EZ Injection - This plugin is designed to provide a graphical way for the
|
||||||
* easily change the access modifiers of all fields/methods, insert hooks into all
|
* user to easily change the access modifiers of all fields/methods, insert
|
||||||
* functions, and invoke the main function. It also contains an option to launch the
|
* hooks into all functions, and invoke the main function. It also contains an
|
||||||
* graphical reflection kit, which is pretty much a GUI for reflection.
|
* option to launch the graphical reflection kit, which is pretty much a GUI for
|
||||||
|
* reflection.
|
||||||
*
|
*
|
||||||
* @author Konloch
|
* @author Konloch
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO: figure out a way to block runtime.exec without java agents,
|
||||||
* figure out a way to block runtime.exec without java agents, maybe by replacing the method call?
|
* maybe by replacing the method call?
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -36,37 +37,30 @@ public class EZInjection extends Plugin {
|
||||||
|
|
||||||
public static ArrayList<BytecodeHook> hookArray = new ArrayList<BytecodeHook>();
|
public static ArrayList<BytecodeHook> hookArray = new ArrayList<BytecodeHook>();
|
||||||
private static String version = "1.0";
|
private static String version = "1.0";
|
||||||
private static PluginConsole gui = new PluginConsole("EZ Injection v"+version);
|
private static PluginConsole gui = new PluginConsole("EZ Injection v"
|
||||||
private boolean
|
+ version);
|
||||||
accessModifiers,
|
private boolean accessModifiers, injectHooks, invokeMethod, useProxy,
|
||||||
injectHooks,
|
launchKit, console;
|
||||||
invokeMethod,
|
public static boolean sandboxSystem, sandboxRuntime, printCmdL;
|
||||||
useProxy,
|
private static boolean debugHooks, all = false;
|
||||||
launchKit,
|
private String invokeMethodInformation, proxy;
|
||||||
console;
|
|
||||||
public static boolean
|
|
||||||
sandboxSystem,
|
|
||||||
sandboxRuntime,
|
|
||||||
printCmdL;
|
|
||||||
private static boolean
|
|
||||||
debugHooks,
|
|
||||||
all = false;
|
|
||||||
private String
|
|
||||||
invokeMethodInformation,
|
|
||||||
proxy;
|
|
||||||
|
|
||||||
private static String[] debugClasses;
|
private static String[] debugClasses;
|
||||||
|
|
||||||
public EZInjection(boolean accessModifiers, boolean injectHooks, boolean debugHooks,
|
public EZInjection(boolean accessModifiers, boolean injectHooks,
|
||||||
boolean invokeMethod, String invokeMethodInformation, boolean sandboxRuntime,
|
boolean debugHooks, boolean invokeMethod,
|
||||||
boolean sandboxSystem, String debugClasses, String proxy, boolean useProxy,
|
String invokeMethodInformation, boolean sandboxRuntime,
|
||||||
boolean launchKit, boolean console, boolean printCmdL) {
|
boolean sandboxSystem, String debugClasses, String proxy,
|
||||||
the.bytecode.club.bytecodeviewer.api.BytecodeViewer.createNewClassNodeLoaderInstance();
|
boolean useProxy, boolean launchKit, boolean console,
|
||||||
|
boolean printCmdL) {
|
||||||
|
the.bytecode.club.bytecodeviewer.api.BytecodeViewer
|
||||||
|
.createNewClassNodeLoaderInstance();
|
||||||
this.accessModifiers = accessModifiers;
|
this.accessModifiers = accessModifiers;
|
||||||
this.injectHooks = injectHooks;
|
this.injectHooks = injectHooks;
|
||||||
EZInjection.debugHooks = debugHooks;
|
EZInjection.debugHooks = debugHooks;
|
||||||
this.invokeMethod = invokeMethod;
|
this.invokeMethod = invokeMethod;
|
||||||
this.invokeMethodInformation = invokeMethodInformation+"([Ljava/lang/String;)V";
|
this.invokeMethodInformation = invokeMethodInformation
|
||||||
|
+ "([Ljava/lang/String;)V";
|
||||||
EZInjection.sandboxRuntime = sandboxRuntime;
|
EZInjection.sandboxRuntime = sandboxRuntime;
|
||||||
EZInjection.sandboxSystem = sandboxSystem;
|
EZInjection.sandboxSystem = sandboxSystem;
|
||||||
if (debugClasses.equals("*"))
|
if (debugClasses.equals("*"))
|
||||||
|
@ -87,6 +81,7 @@ public class EZInjection extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String lastMessage = "";
|
private static String lastMessage = "";
|
||||||
|
|
||||||
public static void hook(String info) {
|
public static void hook(String info) {
|
||||||
for (BytecodeHook hook : hookArray)
|
for (BytecodeHook hook : hookArray)
|
||||||
hook.callHook(info);
|
hook.callHook(info);
|
||||||
|
@ -120,14 +115,18 @@ public class EZInjection extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void exit(int i) {
|
public static void exit(int i) {
|
||||||
print("[SANDBOX] Tried to call on System.exit("+i+"), it's been blocked.");
|
print("[SANDBOX] Tried to call on System.exit(" + i
|
||||||
|
+ "), it's been blocked.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void exitR(int i) {
|
public static void exitR(int i) {
|
||||||
print("[SANDBOX] Tried to call on Runtime.exit("+i+"), it's been blocked.");
|
print("[SANDBOX] Tried to call on Runtime.exit(" + i
|
||||||
|
+ "), it's been blocked.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void announceSystem(String s) {
|
public static void announceSystem(String s) {
|
||||||
print("[SANDBOX] Tried to call on Runtime.exec("+s+"), it's been blocked.");
|
print("[SANDBOX] Tried to call on Runtime.exec(" + s
|
||||||
|
+ "), it's been blocked.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
@ -150,7 +149,8 @@ public class EZInjection extends Plugin {
|
||||||
else
|
else
|
||||||
print("Hooks are disabled completely.");
|
print("Hooks are disabled completely.");
|
||||||
if (sandboxRuntime || sandboxSystem)
|
if (sandboxRuntime || sandboxSystem)
|
||||||
print("Sandboxing runtime: " + sandboxRuntime+", system: " +sandboxSystem+".");
|
print("Sandboxing runtime: " + sandboxRuntime + ", system: "
|
||||||
|
+ sandboxSystem + ".");
|
||||||
else
|
else
|
||||||
print("WARNING: Sandboxing is disabled, this is NOT SAFE!");
|
print("WARNING: Sandboxing is disabled, this is NOT SAFE!");
|
||||||
if (useProxy)
|
if (useProxy)
|
||||||
|
@ -163,72 +163,111 @@ public class EZInjection extends Plugin {
|
||||||
FieldNode f = (FieldNode) o;
|
FieldNode f = (FieldNode) o;
|
||||||
|
|
||||||
if (accessModifiers) {
|
if (accessModifiers) {
|
||||||
if(f.access == Opcodes.ACC_PRIVATE || f.access == Opcodes.ACC_PROTECTED)
|
if (f.access == Opcodes.ACC_PRIVATE
|
||||||
|
|| f.access == Opcodes.ACC_PROTECTED)
|
||||||
f.access = Opcodes.ACC_PUBLIC;
|
f.access = Opcodes.ACC_PUBLIC;
|
||||||
|
|
||||||
if(f.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_STATIC || f.access == Opcodes.ACC_PROTECTED + Opcodes.ACC_STATIC)
|
if (f.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_STATIC
|
||||||
|
|| f.access == Opcodes.ACC_PROTECTED
|
||||||
|
+ Opcodes.ACC_STATIC)
|
||||||
f.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC;
|
f.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC;
|
||||||
|
|
||||||
if(f.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL || f.access == Opcodes.ACC_PROTECTED + Opcodes.ACC_FINAL)
|
if (f.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL
|
||||||
|
|| f.access == Opcodes.ACC_PROTECTED
|
||||||
|
+ Opcodes.ACC_FINAL)
|
||||||
f.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL;
|
f.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL;
|
||||||
|
|
||||||
if(f.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC || f.access == Opcodes.ACC_PROTECTED + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC)
|
if (f.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL
|
||||||
f.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC;
|
+ Opcodes.ACC_STATIC
|
||||||
|
|| f.access == Opcodes.ACC_PROTECTED
|
||||||
|
+ Opcodes.ACC_FINAL + Opcodes.ACC_STATIC)
|
||||||
|
f.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL
|
||||||
|
+ Opcodes.ACC_STATIC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Object o : classNode.methods.toArray()) {
|
for (Object o : classNode.methods.toArray()) {
|
||||||
MethodNode m = (MethodNode) o;
|
MethodNode m = (MethodNode) o;
|
||||||
|
|
||||||
if (accessModifiers) {
|
if (accessModifiers) {
|
||||||
if(m.access == Opcodes.ACC_PRIVATE || m.access == Opcodes.ACC_PROTECTED)
|
if (m.access == Opcodes.ACC_PRIVATE
|
||||||
|
|| m.access == Opcodes.ACC_PROTECTED)
|
||||||
m.access = Opcodes.ACC_PUBLIC;
|
m.access = Opcodes.ACC_PUBLIC;
|
||||||
|
|
||||||
if(m.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_STATIC || m.access == Opcodes.ACC_PROTECTED + Opcodes.ACC_STATIC)
|
if (m.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_STATIC
|
||||||
|
|| m.access == Opcodes.ACC_PROTECTED
|
||||||
|
+ Opcodes.ACC_STATIC)
|
||||||
m.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC;
|
m.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC;
|
||||||
|
|
||||||
if(m.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL || m.access == Opcodes.ACC_PROTECTED + Opcodes.ACC_FINAL)
|
if (m.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL
|
||||||
|
|| m.access == Opcodes.ACC_PROTECTED
|
||||||
|
+ Opcodes.ACC_FINAL)
|
||||||
m.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL;
|
m.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL;
|
||||||
|
|
||||||
if(m.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC || m.access == Opcodes.ACC_PROTECTED + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC)
|
if (m.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL
|
||||||
m.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC;
|
+ Opcodes.ACC_STATIC
|
||||||
|
|| m.access == Opcodes.ACC_PROTECTED
|
||||||
|
+ Opcodes.ACC_FINAL + Opcodes.ACC_STATIC)
|
||||||
|
m.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL
|
||||||
|
+ Opcodes.ACC_STATIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(injectHooks && m.access != Opcodes.ACC_ABSTRACT &&
|
if (injectHooks
|
||||||
m.access != Opcodes.ACC_PUBLIC+Opcodes.ACC_ABSTRACT &&
|
&& m.access != Opcodes.ACC_ABSTRACT
|
||||||
m.access != Opcodes.ACC_PRIVATE+Opcodes.ACC_ABSTRACT &&
|
&& m.access != Opcodes.ACC_PUBLIC
|
||||||
m.access != Opcodes.ACC_PROTECTED+Opcodes.ACC_ABSTRACT &&
|
+ Opcodes.ACC_ABSTRACT
|
||||||
m.access != Opcodes.ACC_FINAL+Opcodes.ACC_ABSTRACT &&
|
&& m.access != Opcodes.ACC_PRIVATE
|
||||||
m.access != Opcodes.ACC_PUBLIC+Opcodes.ACC_FINAL+Opcodes.ACC_ABSTRACT &&
|
+ Opcodes.ACC_ABSTRACT
|
||||||
m.access != Opcodes.ACC_PRIVATE+Opcodes.ACC_FINAL+Opcodes.ACC_ABSTRACT &&
|
&& m.access != Opcodes.ACC_PROTECTED
|
||||||
m.access != Opcodes.ACC_PROTECTED+Opcodes.ACC_FINAL+Opcodes.ACC_ABSTRACT &&
|
+ Opcodes.ACC_ABSTRACT
|
||||||
m.access != Opcodes.ACC_PUBLIC+Opcodes.ACC_FINAL+Opcodes.ACC_STATIC+Opcodes.ACC_ABSTRACT &&
|
&& m.access != Opcodes.ACC_FINAL + Opcodes.ACC_ABSTRACT
|
||||||
m.access != Opcodes.ACC_PRIVATE+Opcodes.ACC_FINAL+Opcodes.ACC_STATIC+Opcodes.ACC_ABSTRACT &&
|
&& m.access != Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL
|
||||||
m.access != Opcodes.ACC_PROTECTED+Opcodes.ACC_FINAL+Opcodes.ACC_STATIC+Opcodes.ACC_ABSTRACT)
|
+ Opcodes.ACC_ABSTRACT
|
||||||
{
|
&& m.access != Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL
|
||||||
|
+ Opcodes.ACC_ABSTRACT
|
||||||
|
&& m.access != Opcodes.ACC_PROTECTED
|
||||||
|
+ Opcodes.ACC_FINAL + Opcodes.ACC_ABSTRACT
|
||||||
|
&& m.access != Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL
|
||||||
|
+ Opcodes.ACC_STATIC + Opcodes.ACC_ABSTRACT
|
||||||
|
&& m.access != Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL
|
||||||
|
+ Opcodes.ACC_STATIC + Opcodes.ACC_ABSTRACT
|
||||||
|
&& m.access != Opcodes.ACC_PROTECTED
|
||||||
|
+ Opcodes.ACC_FINAL + Opcodes.ACC_STATIC
|
||||||
|
+ Opcodes.ACC_ABSTRACT) {
|
||||||
boolean inject = true;
|
boolean inject = true;
|
||||||
if(m.instructions.size() >= 2 && m.instructions.get(1) instanceof MethodInsnNode) {
|
if (m.instructions.size() >= 2
|
||||||
MethodInsnNode mn = (MethodInsnNode)m.instructions.get(1);
|
&& m.instructions.get(1) instanceof MethodInsnNode) {
|
||||||
if(mn.owner.equals("the/bytecode/club/bytecodeviewer/plugins/EZInjection")) //already been injected
|
MethodInsnNode mn = (MethodInsnNode) m.instructions
|
||||||
|
.get(1);
|
||||||
|
if (mn.owner
|
||||||
|
.equals("the/bytecode/club/bytecodeviewer/plugins/EZInjection")) // already
|
||||||
|
// been
|
||||||
|
// injected
|
||||||
inject = false;
|
inject = false;
|
||||||
}
|
}
|
||||||
if (inject) {
|
if (inject) {
|
||||||
// make this function grab parameters eventually
|
// make this function grab parameters eventually
|
||||||
m.instructions.insert(new MethodInsnNode(Opcodes.INVOKESTATIC,
|
m.instructions
|
||||||
|
.insert(new MethodInsnNode(
|
||||||
|
Opcodes.INVOKESTATIC,
|
||||||
"the/bytecode/club/bytecodeviewer/plugins/EZInjection",
|
"the/bytecode/club/bytecodeviewer/plugins/EZInjection",
|
||||||
"hook",
|
"hook", "(Ljava/lang/String;)V"));
|
||||||
"(Ljava/lang/String;)V"));
|
m.instructions.insert(new LdcInsnNode(classNode.name
|
||||||
m.instructions.insert(new LdcInsnNode(classNode.name+"."+m.name+m.desc));
|
+ "." + m.name + m.desc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sandboxRuntime) {
|
if (sandboxRuntime) {
|
||||||
ASMUtil_OLD.renameClassNode("java/lang/Runtime", "the/bytecode/club/bytecodeviewer/RuntimeOverride");
|
ASMUtil_OLD.renameClassNode("java/lang/Runtime",
|
||||||
|
"the/bytecode/club/bytecodeviewer/RuntimeOverride");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sandboxSystem) {
|
if (sandboxSystem) {
|
||||||
ASMUtil_OLD.renameMethodNode("java/lang/System", "exit", "(Ljava/lang/String;)V", "the/bytecode/club/bytecodeviewer/plugins/EZInjection", null, null);
|
ASMUtil_OLD.renameMethodNode("java/lang/System", "exit",
|
||||||
|
"(Ljava/lang/String;)V",
|
||||||
|
"the/bytecode/club/bytecodeviewer/plugins/EZInjection",
|
||||||
|
null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useProxy) {
|
if (useProxy) {
|
||||||
|
@ -245,22 +284,31 @@ public class EZInjection extends Plugin {
|
||||||
setFinished();
|
setFinished();
|
||||||
|
|
||||||
if (invokeMethod) {
|
if (invokeMethod) {
|
||||||
for(ClassNode cn : BytecodeViewer.getLoadedClasses()) //load all the classnodes into the classloader
|
for (ClassNode cn : BytecodeViewer.getLoadedClasses())
|
||||||
the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().addClass(cn);
|
// load all the classnodes into the classloader
|
||||||
|
the.bytecode.club.bytecodeviewer.api.BytecodeViewer
|
||||||
|
.getClassNodeLoader().addClass(cn);
|
||||||
|
|
||||||
print("Invoking " + invokeMethodInformation+":"+BytecodeViewer.nl+BytecodeViewer.nl);
|
print("Invoking " + invokeMethodInformation + ":"
|
||||||
|
+ BytecodeViewer.nl + BytecodeViewer.nl);
|
||||||
|
|
||||||
for (ClassNode classNode : classNodeList) {
|
for (ClassNode classNode : classNodeList) {
|
||||||
for (Object o : classNode.methods.toArray()) {
|
for (Object o : classNode.methods.toArray()) {
|
||||||
MethodNode m = (MethodNode) o;
|
MethodNode m = (MethodNode) o;
|
||||||
String methodInformation = classNode.name+"."+m.name+m.desc;
|
String methodInformation = classNode.name + "." + m.name
|
||||||
|
+ m.desc;
|
||||||
if (invokeMethodInformation.equals(methodInformation)) {
|
if (invokeMethodInformation.equals(methodInformation)) {
|
||||||
for(Method m2 : the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().nodeToClass(classNode).getMethods()) {
|
for (Method m2 : the.bytecode.club.bytecodeviewer.api.BytecodeViewer
|
||||||
|
.getClassNodeLoader().nodeToClass(classNode)
|
||||||
|
.getMethods()) {
|
||||||
if (m2.getName().equals(m.name)) {
|
if (m2.getName().equals(m.name)) {
|
||||||
try {
|
try {
|
||||||
m2.invoke(classNode.getClass().newInstance(), (Object[])new String[1]);
|
m2.invoke(classNode.getClass()
|
||||||
|
.newInstance(),
|
||||||
|
(Object[]) new String[1]);
|
||||||
if (launchKit)
|
if (launchKit)
|
||||||
new GraphicialReflectionKit().setVisible(true);
|
new GraphicialReflectionKit()
|
||||||
|
.setVisible(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
e.printStackTrace(new PrintWriter(sw));
|
e.printStackTrace(new PrintWriter(sw));
|
||||||
|
|
|
@ -15,8 +15,8 @@ import the.bytecode.club.bytecodeviewer.api.Plugin;
|
||||||
import the.bytecode.club.bytecodeviewer.api.PluginConsole;
|
import the.bytecode.club.bytecodeviewer.api.PluginConsole;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The idea/core was based off of J-RET's Malicious Code Searcher
|
* The idea/core was based off of J-RET's Malicious Code Searcher I improved it,
|
||||||
* I improved it, and added more stuff to search for.
|
* and added more stuff to search for.
|
||||||
*
|
*
|
||||||
* @author Konloch
|
* @author Konloch
|
||||||
* @author WaterWolf
|
* @author WaterWolf
|
||||||
|
@ -25,18 +25,10 @@ import the.bytecode.club.bytecodeviewer.api.PluginConsole;
|
||||||
|
|
||||||
public class MaliciousCodeScanner extends Plugin {
|
public class MaliciousCodeScanner extends Plugin {
|
||||||
|
|
||||||
public boolean
|
public boolean ORE, ONE, ORU, OIO, LWW, LHT, LHS, LIP;
|
||||||
ORE,
|
|
||||||
ONE,
|
|
||||||
ORU,
|
|
||||||
OIO,
|
|
||||||
LWW,
|
|
||||||
LHT,
|
|
||||||
LHS,
|
|
||||||
LIP;
|
|
||||||
|
|
||||||
public MaliciousCodeScanner(boolean reflect, boolean runtime, boolean net, boolean io,
|
public MaliciousCodeScanner(boolean reflect, boolean runtime, boolean net,
|
||||||
boolean www, boolean http, boolean https, boolean ip) {
|
boolean io, boolean www, boolean http, boolean https, boolean ip) {
|
||||||
ORE = reflect;
|
ORE = reflect;
|
||||||
ONE = net;
|
ONE = net;
|
||||||
ORU = runtime;
|
ORU = runtime;
|
||||||
|
@ -57,24 +49,30 @@ public class MaliciousCodeScanner extends Plugin {
|
||||||
Object v = f.value;
|
Object v = f.value;
|
||||||
if (v instanceof String) {
|
if (v instanceof String) {
|
||||||
String s = (String) v;
|
String s = (String) v;
|
||||||
if ((LWW && s.contains("www.")) ||
|
if ((LWW && s.contains("www."))
|
||||||
(LHT && s.contains("http://")) ||
|
|| (LHT && s.contains("http://"))
|
||||||
(LHS && s.contains("https://")) ||
|
|| (LHS && s.contains("https://"))
|
||||||
(ORE && s.contains("java/lang/Runtime")) ||
|
|| (ORE && s.contains("java/lang/Runtime"))
|
||||||
(ORE && s.contains("java.lang.Runtime")) ||
|
|| (ORE && s.contains("java.lang.Runtime"))
|
||||||
(LIP && s.matches("\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b")))
|
|| (LIP && s
|
||||||
sb.append("Found LDC \"" + s + "\" at field " + classNode.name + "." +f.name+"("+f.desc+")"+BytecodeViewer.nl);
|
.matches("\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b")))
|
||||||
|
sb.append("Found LDC \"" + s + "\" at field "
|
||||||
|
+ classNode.name + "." + f.name + "(" + f.desc
|
||||||
|
+ ")" + BytecodeViewer.nl);
|
||||||
}
|
}
|
||||||
if (v instanceof String[]) {
|
if (v instanceof String[]) {
|
||||||
for (int i = 0; i < ((String[]) v).length; i++) {
|
for (int i = 0; i < ((String[]) v).length; i++) {
|
||||||
String s = ((String[]) v)[i];
|
String s = ((String[]) v)[i];
|
||||||
if ((LWW && s.contains("www.")) ||
|
if ((LWW && s.contains("www."))
|
||||||
(LHT && s.contains("http://")) ||
|
|| (LHT && s.contains("http://"))
|
||||||
(LHS && s.contains("https://")) ||
|
|| (LHS && s.contains("https://"))
|
||||||
(ORE && s.contains("java/lang/Runtime")) ||
|
|| (ORE && s.contains("java/lang/Runtime"))
|
||||||
(ORE && s.contains("java.lang.Runtime")) ||
|
|| (ORE && s.contains("java.lang.Runtime"))
|
||||||
(LIP && s.matches("\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b")))
|
|| (LIP && s
|
||||||
sb.append("Found LDC \"" + s + "\" at field " + classNode.name + "." +f.name+"("+f.desc+")"+BytecodeViewer.nl);
|
.matches("\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b")))
|
||||||
|
sb.append("Found LDC \"" + s + "\" at field "
|
||||||
|
+ classNode.name + "." + f.name + "("
|
||||||
|
+ f.desc + ")" + BytecodeViewer.nl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,25 +84,30 @@ public class MaliciousCodeScanner extends Plugin {
|
||||||
for (AbstractInsnNode a : iList.toArray()) {
|
for (AbstractInsnNode a : iList.toArray()) {
|
||||||
if (a instanceof MethodInsnNode) {
|
if (a instanceof MethodInsnNode) {
|
||||||
final MethodInsnNode min = (MethodInsnNode) a;
|
final MethodInsnNode min = (MethodInsnNode) a;
|
||||||
if ((ORE && min.owner.startsWith("java/lang/reflect")) ||
|
if ((ORE && min.owner.startsWith("java/lang/reflect"))
|
||||||
(ONE && min.owner.startsWith("java/net")) ||
|
|| (ONE && min.owner.startsWith("java/net"))
|
||||||
(ORU && min.owner.equals("java/lang/Runtime")) ||
|
|| (ORU && min.owner
|
||||||
(OIO && min.owner.startsWith("java/io")))
|
.equals("java/lang/Runtime"))
|
||||||
{
|
|| (OIO && min.owner.startsWith("java/io"))) {
|
||||||
sb.append("Found Method call to " + min.owner + "." + min.name + "(" + min.desc + ") at " + classNode.name + "." +m.name+"("+m.desc+")"+BytecodeViewer.nl);
|
sb.append("Found Method call to " + min.owner + "."
|
||||||
|
+ min.name + "(" + min.desc + ") at "
|
||||||
|
+ classNode.name + "." + m.name + "("
|
||||||
|
+ m.desc + ")" + BytecodeViewer.nl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (a instanceof LdcInsnNode) {
|
if (a instanceof LdcInsnNode) {
|
||||||
if (((LdcInsnNode) a).cst instanceof String) {
|
if (((LdcInsnNode) a).cst instanceof String) {
|
||||||
final String s = (String) ((LdcInsnNode) a).cst;
|
final String s = (String) ((LdcInsnNode) a).cst;
|
||||||
if ((LWW && s.contains("www.")) ||
|
if ((LWW && s.contains("www."))
|
||||||
(LHT && s.contains("http://")) ||
|
|| (LHT && s.contains("http://"))
|
||||||
(LHS && s.contains("https://")) ||
|
|| (LHS && s.contains("https://"))
|
||||||
(ORE && s.contains("java/lang/Runtime")) ||
|
|| (ORE && s.contains("java/lang/Runtime"))
|
||||||
(ORE && s.contains("java.lang.Runtime")) ||
|
|| (ORE && s.contains("java.lang.Runtime"))
|
||||||
(LIP && s.matches("\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b")))
|
|| (LIP && s
|
||||||
{
|
.matches("\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b"))) {
|
||||||
sb.append("Found LDC \"" + s + "\" at method " + classNode.name + "." +m.name+"("+m.desc+")"+BytecodeViewer.nl);
|
sb.append("Found LDC \"" + s + "\" at method "
|
||||||
|
+ classNode.name + "." + m.name + "("
|
||||||
|
+ m.desc + ")" + BytecodeViewer.nl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,8 @@ public class PluginManager {
|
||||||
pluginInstance = newPluginInstance;
|
pluginInstance = newPluginInstance;
|
||||||
pluginInstance.start(); // start the thread
|
pluginInstance.start(); // start the thread
|
||||||
} else if (!pluginInstance.isFinished()) {
|
} else if (!pluginInstance.isFinished()) {
|
||||||
BytecodeViewer.showMessage("There is currently another plugin running right now, please wait for that to finish executing.");
|
BytecodeViewer
|
||||||
|
.showMessage("There is currently another plugin running right now, please wait for that to finish executing.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +51,7 @@ public class PluginManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads a groovy file as a Script
|
* Loads a groovy file as a Script
|
||||||
|
*
|
||||||
* @param file
|
* @param file
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
@ -59,16 +61,20 @@ public class PluginManager {
|
||||||
ScriptEngine engine = manager.getEngineByName("groovy");
|
ScriptEngine engine = manager.getEngineByName("groovy");
|
||||||
|
|
||||||
if (engine == null)
|
if (engine == null)
|
||||||
throw new Exception("Cannot find Groovy script engine! Please contact Konloch.");
|
throw new Exception(
|
||||||
|
"Cannot find Groovy script engine! Please contact Konloch.");
|
||||||
|
|
||||||
Reader reader = new FileReader(file);
|
Reader reader = new FileReader(file);
|
||||||
engine.eval(reader);
|
engine.eval(reader);
|
||||||
|
|
||||||
return (Plugin)engine.eval("new " + file.getName().replace(".gy", "").replace(".groovy", "") + "();");
|
return (Plugin) engine.eval("new "
|
||||||
|
+ file.getName().replace(".gy", "").replace(".groovy", "")
|
||||||
|
+ "();");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads a python file as a Script
|
* Loads a python file as a Script
|
||||||
|
*
|
||||||
* @param file
|
* @param file
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
@ -78,16 +84,20 @@ public class PluginManager {
|
||||||
ScriptEngine engine = manager.getEngineByName("python");
|
ScriptEngine engine = manager.getEngineByName("python");
|
||||||
|
|
||||||
if (engine == null)
|
if (engine == null)
|
||||||
throw new Exception("Cannot find Jython script engine! Please contact Konloch.");
|
throw new Exception(
|
||||||
|
"Cannot find Jython script engine! Please contact Konloch.");
|
||||||
|
|
||||||
Reader reader = new FileReader(file);
|
Reader reader = new FileReader(file);
|
||||||
engine.eval(reader);
|
engine.eval(reader);
|
||||||
|
|
||||||
return (Plugin)engine.eval(file.getName().replace(".py", "").replace(".python", "") + "()");
|
return (Plugin) engine.eval(file.getName().replace(".py", "")
|
||||||
|
.replace(".python", "")
|
||||||
|
+ "()");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads a ruby file as a Script
|
* Loads a ruby file as a Script
|
||||||
|
*
|
||||||
* @param file
|
* @param file
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
@ -97,11 +107,14 @@ public class PluginManager {
|
||||||
ScriptEngine engine = manager.getEngineByName("jruby");
|
ScriptEngine engine = manager.getEngineByName("jruby");
|
||||||
|
|
||||||
if (engine == null)
|
if (engine == null)
|
||||||
throw new Exception("Cannot find jRuby script engine! Please contact Konloch.");
|
throw new Exception(
|
||||||
|
"Cannot find jRuby script engine! Please contact Konloch.");
|
||||||
|
|
||||||
Reader reader = new FileReader(file);
|
Reader reader = new FileReader(file);
|
||||||
engine.eval(reader);
|
engine.eval(reader);
|
||||||
|
|
||||||
return (Plugin)engine.eval(file.getName().replace(".rb", "").replace(".ruby", "") + ".new");
|
return (Plugin) engine.eval(file.getName().replace(".rb", "")
|
||||||
|
.replace(".ruby", "")
|
||||||
|
+ ".new");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,8 @@ public class ReplaceStrings extends Plugin {
|
||||||
String className;
|
String className;
|
||||||
boolean contains;
|
boolean contains;
|
||||||
|
|
||||||
public ReplaceStrings(String originalLDC, String newLDC, String className, boolean contains) {
|
public ReplaceStrings(String originalLDC, String newLDC, String className,
|
||||||
|
boolean contains) {
|
||||||
this.originalLDC = originalLDC;
|
this.originalLDC = originalLDC;
|
||||||
this.newLDC = newLDC;
|
this.newLDC = newLDC;
|
||||||
this.className = className;
|
this.className = className;
|
||||||
|
@ -49,7 +50,6 @@ public class ReplaceStrings extends Plugin {
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void scanClassNode(ClassNode classNode) {
|
public void scanClassNode(ClassNode classNode) {
|
||||||
for (Object o : classNode.fields.toArray()) {
|
for (Object o : classNode.fields.toArray()) {
|
||||||
FieldNode f = (FieldNode) o;
|
FieldNode f = (FieldNode) o;
|
||||||
|
@ -58,7 +58,8 @@ public class ReplaceStrings extends Plugin {
|
||||||
String s = (String) v;
|
String s = (String) v;
|
||||||
if (contains) {
|
if (contains) {
|
||||||
if (s.contains(originalLDC))
|
if (s.contains(originalLDC))
|
||||||
f.value = ((String)f.value).replaceAll(originalLDC, newLDC);
|
f.value = ((String) f.value).replaceAll(originalLDC,
|
||||||
|
newLDC);
|
||||||
} else {
|
} else {
|
||||||
if (s.equals(originalLDC))
|
if (s.equals(originalLDC))
|
||||||
f.value = newLDC;
|
f.value = newLDC;
|
||||||
|
@ -69,15 +70,23 @@ public class ReplaceStrings extends Plugin {
|
||||||
String s = ((String[]) v)[i];
|
String s = ((String[]) v)[i];
|
||||||
if (contains) {
|
if (contains) {
|
||||||
if (s.contains(originalLDC)) {
|
if (s.contains(originalLDC)) {
|
||||||
f.value = ((String[])f.value)[i].replaceAll(originalLDC, newLDC);
|
f.value = ((String[]) f.value)[i].replaceAll(
|
||||||
String ugh = s.replaceAll("\\n", "\\\\n").replaceAll("\\r", "\\\\r");
|
originalLDC, newLDC);
|
||||||
frame.appendText(classNode.name + "." +f.name+""+f.desc+" -> \"" + ugh + "\" replaced with \"" + s.replaceAll(originalLDC, newLDC) + "\"");
|
String ugh = s.replaceAll("\\n", "\\\\n")
|
||||||
|
.replaceAll("\\r", "\\\\r");
|
||||||
|
frame.appendText(classNode.name + "." + f.name + ""
|
||||||
|
+ f.desc + " -> \"" + ugh
|
||||||
|
+ "\" replaced with \""
|
||||||
|
+ s.replaceAll(originalLDC, newLDC) + "\"");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (s.equals(originalLDC)) {
|
if (s.equals(originalLDC)) {
|
||||||
((String[]) f.value)[i] = newLDC;
|
((String[]) f.value)[i] = newLDC;
|
||||||
String ugh = s.replaceAll("\\n", "\\\\n").replaceAll("\\r", "\\\\r");
|
String ugh = s.replaceAll("\\n", "\\\\n")
|
||||||
frame.appendText(classNode.name + "." +f.name+""+f.desc+" -> \"" + ugh + "\" replaced with \"" + newLDC + "\"");
|
.replaceAll("\\r", "\\\\r");
|
||||||
|
frame.appendText(classNode.name + "." + f.name + ""
|
||||||
|
+ f.desc + " -> \"" + ugh
|
||||||
|
+ "\" replaced with \"" + newLDC + "\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,15 +103,39 @@ public class ReplaceStrings extends Plugin {
|
||||||
final String s = (String) ((LdcInsnNode) a).cst;
|
final String s = (String) ((LdcInsnNode) a).cst;
|
||||||
if (contains) {
|
if (contains) {
|
||||||
if (s.contains(originalLDC)) {
|
if (s.contains(originalLDC)) {
|
||||||
((LdcInsnNode)a).cst = ((String)((LdcInsnNode)a).cst).replaceAll(originalLDC, newLDC);
|
((LdcInsnNode) a).cst = ((String) ((LdcInsnNode) a).cst)
|
||||||
String ugh = s.replaceAll("\\n", "\\\\n").replaceAll("\\r", "\\\\r");
|
.replaceAll(originalLDC, newLDC);
|
||||||
frame.appendText(classNode.name + "." +m.name+""+m.desc+" -> \"" + ugh + "\" replaced with \"" + s.replaceAll(originalLDC, newLDC).replaceAll("\\n", "\\\\n").replaceAll("\\r", "\\\\r") + "\"");
|
String ugh = s.replaceAll("\\n", "\\\\n")
|
||||||
|
.replaceAll("\\r", "\\\\r");
|
||||||
|
frame.appendText(classNode.name
|
||||||
|
+ "."
|
||||||
|
+ m.name
|
||||||
|
+ ""
|
||||||
|
+ m.desc
|
||||||
|
+ " -> \""
|
||||||
|
+ ugh
|
||||||
|
+ "\" replaced with \""
|
||||||
|
+ s.replaceAll(originalLDC, newLDC)
|
||||||
|
.replaceAll("\\n", "\\\\n")
|
||||||
|
.replaceAll("\\r", "\\\\r")
|
||||||
|
+ "\"");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (s.equals(originalLDC)) {
|
if (s.equals(originalLDC)) {
|
||||||
((LdcInsnNode) a).cst = newLDC;
|
((LdcInsnNode) a).cst = newLDC;
|
||||||
String ugh = s.replaceAll("\\n", "\\\\n").replaceAll("\\r", "\\\\r");
|
String ugh = s.replaceAll("\\n", "\\\\n")
|
||||||
frame.appendText(classNode.name + "." +m.name+""+m.desc+" -> \"" + ugh + "\" replaced with \"" + newLDC.replaceAll("\\n", "\\\\n").replaceAll("\\r", "\\\\r") + "\"");
|
.replaceAll("\\r", "\\\\r");
|
||||||
|
frame.appendText(classNode.name
|
||||||
|
+ "."
|
||||||
|
+ m.name
|
||||||
|
+ ""
|
||||||
|
+ m.desc
|
||||||
|
+ " -> \""
|
||||||
|
+ ugh
|
||||||
|
+ "\" replaced with \""
|
||||||
|
+ newLDC.replaceAll("\\n", "\\\\n")
|
||||||
|
.replaceAll("\\r", "\\\\r")
|
||||||
|
+ "\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,13 +33,31 @@ public class ShowAllStrings extends Plugin {
|
||||||
if (v instanceof String) {
|
if (v instanceof String) {
|
||||||
String s = (String) v;
|
String s = (String) v;
|
||||||
if (!s.isEmpty())
|
if (!s.isEmpty())
|
||||||
sb.append(classNode.name + "." +f.name+""+f.desc+" -> \"" + s.replaceAll("\\n", "\\\\n").replaceAll("\\r", "\\\\r") + "\""+BytecodeViewer.nl);
|
sb.append(classNode.name
|
||||||
|
+ "."
|
||||||
|
+ f.name
|
||||||
|
+ ""
|
||||||
|
+ f.desc
|
||||||
|
+ " -> \""
|
||||||
|
+ s.replaceAll("\\n", "\\\\n").replaceAll(
|
||||||
|
"\\r", "\\\\r") + "\""
|
||||||
|
+ BytecodeViewer.nl);
|
||||||
}
|
}
|
||||||
if (v instanceof String[]) {
|
if (v instanceof String[]) {
|
||||||
for (int i = 0; i < ((String[]) v).length; i++) {
|
for (int i = 0; i < ((String[]) v).length; i++) {
|
||||||
String s = ((String[]) v)[i];
|
String s = ((String[]) v)[i];
|
||||||
if (!s.isEmpty())
|
if (!s.isEmpty())
|
||||||
sb.append(classNode.name + "." +f.name+""+f.desc+"["+i+"] -> \"" + s.replaceAll("\\n", "\\\\n").replaceAll("\\r", "\\\\r") + "\""+BytecodeViewer.nl);
|
sb.append(classNode.name
|
||||||
|
+ "."
|
||||||
|
+ f.name
|
||||||
|
+ ""
|
||||||
|
+ f.desc
|
||||||
|
+ "["
|
||||||
|
+ i
|
||||||
|
+ "] -> \""
|
||||||
|
+ s.replaceAll("\\n", "\\\\n").replaceAll(
|
||||||
|
"\\r", "\\\\r") + "\""
|
||||||
|
+ BytecodeViewer.nl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +71,15 @@ public class ShowAllStrings extends Plugin {
|
||||||
if (((LdcInsnNode) a).cst instanceof String) {
|
if (((LdcInsnNode) a).cst instanceof String) {
|
||||||
final String s = (String) ((LdcInsnNode) a).cst;
|
final String s = (String) ((LdcInsnNode) a).cst;
|
||||||
if (!s.isEmpty())
|
if (!s.isEmpty())
|
||||||
sb.append(classNode.name + "." +m.name+""+m.desc+" -> \"" + s.replaceAll("\\n", "\\\\n").replaceAll("\\r", "\\\\r") + "\""+BytecodeViewer.nl);
|
sb.append(classNode.name
|
||||||
|
+ "."
|
||||||
|
+ m.name
|
||||||
|
+ ""
|
||||||
|
+ m.desc
|
||||||
|
+ " -> \""
|
||||||
|
+ s.replaceAll("\\n", "\\\\n")
|
||||||
|
.replaceAll("\\r", "\\\\r")
|
||||||
|
+ "\"" + BytecodeViewer.nl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,10 @@ public class ShowMainMethods extends Plugin {
|
||||||
for (Object o : classNode.methods.toArray()) {
|
for (Object o : classNode.methods.toArray()) {
|
||||||
MethodNode m = (MethodNode) o;
|
MethodNode m = (MethodNode) o;
|
||||||
|
|
||||||
if(m.name.equals("main") && m.desc.equals("([Ljava/lang/String;)V"))
|
if (m.name.equals("main")
|
||||||
frame.appendText(classNode.name + "." +m.name+""+m.desc);
|
&& m.desc.equals("([Ljava/lang/String;)V"))
|
||||||
|
frame.appendText(classNode.name + "." + m.name + ""
|
||||||
|
+ m.desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
|
|
|
@ -27,7 +27,8 @@ import eu.bibl.banalysis.asm.desc.OpcodeInfo;
|
||||||
|
|
||||||
public class FieldCallSearch implements SearchTypeDetails {
|
public class FieldCallSearch implements SearchTypeDetails {
|
||||||
|
|
||||||
JTextField mOwner = new JTextField(""), mName = new JTextField(""), mDesc = new JTextField("");
|
JTextField mOwner = new JTextField(""), mName = new JTextField(""),
|
||||||
|
mDesc = new JTextField("");
|
||||||
JPanel myPanel = null;
|
JPanel myPanel = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -44,8 +45,10 @@ public class FieldCallSearch implements SearchTypeDetails {
|
||||||
|
|
||||||
return myPanel;
|
return myPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void search(final ClassNode node, final SearchResultNotifier srn, boolean exact) {
|
public void search(final ClassNode node, final SearchResultNotifier srn,
|
||||||
|
boolean exact) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
final Iterator<MethodNode> methods = node.methods.iterator();
|
final Iterator<MethodNode> methods = node.methods.iterator();
|
||||||
String owner = mOwner.getText();
|
String owner = mOwner.getText();
|
||||||
|
@ -65,7 +68,8 @@ public class FieldCallSearch implements SearchTypeDetails {
|
||||||
|
|
||||||
final InsnList insnlist = method.instructions;
|
final InsnList insnlist = method.instructions;
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
final ListIterator<AbstractInsnNode> instructions = insnlist.iterator();
|
final ListIterator<AbstractInsnNode> instructions = insnlist
|
||||||
|
.iterator();
|
||||||
while (instructions.hasNext()) {
|
while (instructions.hasNext()) {
|
||||||
final AbstractInsnNode insnNode = instructions.next();
|
final AbstractInsnNode insnNode = instructions.next();
|
||||||
if (insnNode instanceof FieldInsnNode) {
|
if (insnNode instanceof FieldInsnNode) {
|
||||||
|
@ -82,7 +86,13 @@ public class FieldCallSearch implements SearchTypeDetails {
|
||||||
if (desc != null && !desc.equals(min.desc)) {
|
if (desc != null && !desc.equals(min.desc)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
srn.notifyOfResult(node.name + "." + method.name + Type.getType(method.desc) + " > " + OpcodeInfo.OPCODES.get(insnNode.getOpcode()).toLowerCase());
|
srn.notifyOfResult(node.name
|
||||||
|
+ "."
|
||||||
|
+ method.name
|
||||||
|
+ Type.getType(method.desc)
|
||||||
|
+ " > "
|
||||||
|
+ OpcodeInfo.OPCODES.get(insnNode.getOpcode())
|
||||||
|
.toLowerCase());
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (name != null && !name.contains(min.name)) {
|
if (name != null && !name.contains(min.name)) {
|
||||||
|
@ -94,7 +104,13 @@ public class FieldCallSearch implements SearchTypeDetails {
|
||||||
if (desc != null && !desc.contains(min.desc)) {
|
if (desc != null && !desc.contains(min.desc)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
srn.notifyOfResult(node.name + "." + method.name + Type.getType(method.desc) + " > " + OpcodeInfo.OPCODES.get(insnNode.getOpcode()).toLowerCase());
|
srn.notifyOfResult(node.name
|
||||||
|
+ "."
|
||||||
|
+ method.name
|
||||||
|
+ Type.getType(method.desc)
|
||||||
|
+ " > "
|
||||||
|
+ OpcodeInfo.OPCODES.get(insnNode.getOpcode())
|
||||||
|
.toLowerCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,11 @@ public class LDCSearch implements SearchTypeDetails {
|
||||||
|
|
||||||
return myPanel;
|
return myPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void search(final ClassNode node, final SearchResultNotifier srn, boolean exact) {
|
public void search(final ClassNode node, final SearchResultNotifier srn,
|
||||||
|
boolean exact) {
|
||||||
final Iterator<MethodNode> methods = node.methods.iterator();
|
final Iterator<MethodNode> methods = node.methods.iterator();
|
||||||
final String srchText = searchText.getText();
|
final String srchText = searchText.getText();
|
||||||
if (srchText.isEmpty())
|
if (srchText.isEmpty())
|
||||||
|
@ -51,16 +53,19 @@ public class LDCSearch implements SearchTypeDetails {
|
||||||
final MethodNode method = methods.next();
|
final MethodNode method = methods.next();
|
||||||
|
|
||||||
final InsnList insnlist = method.instructions;
|
final InsnList insnlist = method.instructions;
|
||||||
final ListIterator<AbstractInsnNode> instructions = insnlist.iterator();
|
final ListIterator<AbstractInsnNode> instructions = insnlist
|
||||||
|
.iterator();
|
||||||
while (instructions.hasNext()) {
|
while (instructions.hasNext()) {
|
||||||
final AbstractInsnNode insnNode = instructions.next();
|
final AbstractInsnNode insnNode = instructions.next();
|
||||||
if (insnNode instanceof LdcInsnNode) {
|
if (insnNode instanceof LdcInsnNode) {
|
||||||
final LdcInsnNode ldcObject = ((LdcInsnNode) insnNode);
|
final LdcInsnNode ldcObject = ((LdcInsnNode) insnNode);
|
||||||
final String ldcString = ldcObject.cst.toString();
|
final String ldcString = ldcObject.cst.toString();
|
||||||
if ((exact && ldcString.equals(srchText)) ||
|
if ((exact && ldcString.equals(srchText))
|
||||||
(!exact && ldcString.contains(srchText)))
|
|| (!exact && ldcString.contains(srchText))) {
|
||||||
{
|
srn.notifyOfResult(node.name + "." + method.name
|
||||||
srn.notifyOfResult(node.name + "." + method.name + Type.getType(method.desc).getInternalName() + " -> \""+ldcString + "\" > " + ldcObject.cst.getClass().getCanonicalName());
|
+ Type.getType(method.desc).getInternalName()
|
||||||
|
+ " -> \"" + ldcString + "\" > "
|
||||||
|
+ ldcObject.cst.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +75,8 @@ public class LDCSearch implements SearchTypeDetails {
|
||||||
while (methods.hasNext()) {
|
while (methods.hasNext()) {
|
||||||
final FieldNode field = fields.next();
|
final FieldNode field = fields.next();
|
||||||
if (field.value instanceof String) {
|
if (field.value instanceof String) {
|
||||||
srn.notifyOfResult(node.name + "." + field.name + field.desc + " -> \"" + field.value + "\" > field");
|
srn.notifyOfResult(node.name + "." + field.name + field.desc
|
||||||
|
+ " -> \"" + field.value + "\" > field");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,8 @@ import eu.bibl.banalysis.asm.desc.OpcodeInfo;
|
||||||
|
|
||||||
public class MethodCallSearch implements SearchTypeDetails {
|
public class MethodCallSearch implements SearchTypeDetails {
|
||||||
|
|
||||||
JTextField mOwner = new JTextField(""), mName = new JTextField(""), mDesc = new JTextField("");
|
JTextField mOwner = new JTextField(""), mName = new JTextField(""),
|
||||||
|
mDesc = new JTextField("");
|
||||||
JPanel myPanel = null;
|
JPanel myPanel = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -47,7 +48,8 @@ public class MethodCallSearch implements SearchTypeDetails {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void search(final ClassNode node, final SearchResultNotifier srn, boolean exact) {
|
public void search(final ClassNode node, final SearchResultNotifier srn,
|
||||||
|
boolean exact) {
|
||||||
final Iterator<MethodNode> methods = node.methods.iterator();
|
final Iterator<MethodNode> methods = node.methods.iterator();
|
||||||
String owner = mOwner.getText();
|
String owner = mOwner.getText();
|
||||||
if (owner.isEmpty()) {
|
if (owner.isEmpty()) {
|
||||||
|
@ -66,7 +68,8 @@ public class MethodCallSearch implements SearchTypeDetails {
|
||||||
final MethodNode method = methods.next();
|
final MethodNode method = methods.next();
|
||||||
|
|
||||||
final InsnList insnlist = method.instructions;
|
final InsnList insnlist = method.instructions;
|
||||||
final ListIterator<AbstractInsnNode> instructions = insnlist.iterator();
|
final ListIterator<AbstractInsnNode> instructions = insnlist
|
||||||
|
.iterator();
|
||||||
while (instructions.hasNext()) {
|
while (instructions.hasNext()) {
|
||||||
final AbstractInsnNode insnNode = instructions.next();
|
final AbstractInsnNode insnNode = instructions.next();
|
||||||
if (insnNode instanceof MethodInsnNode) {
|
if (insnNode instanceof MethodInsnNode) {
|
||||||
|
@ -83,7 +86,13 @@ public class MethodCallSearch implements SearchTypeDetails {
|
||||||
if (desc != null && !desc.equals(min.desc)) {
|
if (desc != null && !desc.equals(min.desc)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
srn.notifyOfResult(node.name + "." + method.name + Type.getType(method.desc) + " > " + OpcodeInfo.OPCODES.get(insnNode.getOpcode()).toLowerCase());
|
srn.notifyOfResult(node.name
|
||||||
|
+ "."
|
||||||
|
+ method.name
|
||||||
|
+ Type.getType(method.desc)
|
||||||
|
+ " > "
|
||||||
|
+ OpcodeInfo.OPCODES.get(insnNode.getOpcode())
|
||||||
|
.toLowerCase());
|
||||||
} else {
|
} else {
|
||||||
if (name != null && !name.contains(min.name)) {
|
if (name != null && !name.contains(min.name)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -94,7 +103,13 @@ public class MethodCallSearch implements SearchTypeDetails {
|
||||||
if (desc != null && !desc.contains(min.desc)) {
|
if (desc != null && !desc.contains(min.desc)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
srn.notifyOfResult(node.name + "." + method.name + Type.getType(method.desc) + " > " + OpcodeInfo.OPCODES.get(insnNode.getOpcode()).toLowerCase());
|
srn.notifyOfResult(node.name
|
||||||
|
+ "."
|
||||||
|
+ method.name
|
||||||
|
+ Type.getType(method.desc)
|
||||||
|
+ " > "
|
||||||
|
+ OpcodeInfo.OPCODES.get(insnNode.getOpcode())
|
||||||
|
.toLowerCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,12 +118,15 @@ public class RegexInsnFinder {
|
||||||
"INVOKEDYNAMIC", "NEW", "NEWARRAY", "ANEWARRAY", "ARRAYLENGTH",
|
"INVOKEDYNAMIC", "NEW", "NEWARRAY", "ANEWARRAY", "ARRAYLENGTH",
|
||||||
"ATHROW", "CHECKCAST", "INSTANCEOF", "MONITORENTER", "MONITOREXIT",
|
"ATHROW", "CHECKCAST", "INSTANCEOF", "MONITORENTER", "MONITOREXIT",
|
||||||
"MULTIANEWARRAY", "IFNULL", "IFNONNULL" };
|
"MULTIANEWARRAY", "IFNULL", "IFNONNULL" };
|
||||||
private static String opcodesAnys = buildRegexItems(opcodesAny, false, false);
|
private static String opcodesAnys = buildRegexItems(opcodesAny, false,
|
||||||
|
false);
|
||||||
|
|
||||||
private static String buildRegexItems(final String[] items, final boolean capture, final boolean stdRepl) {
|
private static String buildRegexItems(final String[] items,
|
||||||
|
final boolean capture, final boolean stdRepl) {
|
||||||
if (items.length == 0)
|
if (items.length == 0)
|
||||||
return "()";
|
return "()";
|
||||||
String result = (stdRepl ? "\\b" : "") + "(" + (capture ? "" : "?:") + items[0];
|
String result = (stdRepl ? "\\b" : "") + "(" + (capture ? "" : "?:")
|
||||||
|
+ items[0];
|
||||||
for (int i = 1; i < items.length; i++) {
|
for (int i = 1; i < items.length; i++) {
|
||||||
result += "|" + items[i];
|
result += "|" + items[i];
|
||||||
}
|
}
|
||||||
|
@ -138,21 +141,24 @@ public class RegexInsnFinder {
|
||||||
private static String processRegex(final String regex) {
|
private static String processRegex(final String regex) {
|
||||||
String result = regex.trim();
|
String result = regex.trim();
|
||||||
result = result.replaceAll("\\bANYINSN *", opcodesAnys);
|
result = result.replaceAll("\\bANYINSN *", opcodesAnys);
|
||||||
result = result.replaceAll(opcodesInts + "\\\\\\{\\s*(\\d+)\\s*\\\\\\} *",
|
result = result.replaceAll(opcodesInts
|
||||||
"$1\\\\{$2\\\\} ");
|
+ "\\\\\\{\\s*(\\d+)\\s*\\\\\\} *", "$1\\\\{$2\\\\} ");
|
||||||
result = result.replaceAll(opcodesInts + " *", "$1\\\\{\\\\d+\\\\} ");
|
result = result.replaceAll(opcodesInts + " *", "$1\\\\{\\\\d+\\\\} ");
|
||||||
result = result.replaceAll("\\bLDC\\\\\\{(.*?)\\\\\\}(?<!\\\\\\\\\\}) *",
|
result = result.replaceAll(
|
||||||
|
"\\bLDC\\\\\\{(.*?)\\\\\\}(?<!\\\\\\\\\\}) *",
|
||||||
"LDC\\\\{$1\\\\}(?<!\\\\\\\\\\\\}) ");
|
"LDC\\\\{$1\\\\}(?<!\\\\\\\\\\\\}) ");
|
||||||
result = result.replaceAll("\\bLDC *", "LDC\\\\{.*?\\\\}(?<!\\\\\\\\\\\\}) ");
|
result = result.replaceAll("\\bLDC *",
|
||||||
|
"LDC\\\\{.*?\\\\}(?<!\\\\\\\\\\\\}) ");
|
||||||
result = result.replaceAll(opcodeVars + "(_\\d+) *", "$1$2 ");
|
result = result.replaceAll(opcodeVars + "(_\\d+) *", "$1$2 ");
|
||||||
result = result.replaceAll(opcodeVars + "(?!_) *", "$1_\\\\d+ ");
|
result = result.replaceAll(opcodeVars + "(?!_) *", "$1_\\\\d+ ");
|
||||||
result = result.replaceAll("\\bIINC\\\\\\{\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\\\\\} *",
|
result = result.replaceAll(
|
||||||
|
"\\bIINC\\\\\\{\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\\\\\} *",
|
||||||
"IINC\\\\{$1,$2\\\\} ");
|
"IINC\\\\{$1,$2\\\\} ");
|
||||||
result = result.replaceAll("\\bIINC\\\\\\{\\s*(\\d+)\\s*\\\\\\} *",
|
result = result.replaceAll("\\bIINC\\\\\\{\\s*(\\d+)\\s*\\\\\\} *",
|
||||||
"IINC\\\\{\\d+,$1\\\\} ");
|
"IINC\\\\{\\d+,$1\\\\} ");
|
||||||
result = result.replaceAll("\\bIINC *", "IINC\\\\{\\d+,\\d+\\\\} ");
|
result = result.replaceAll("\\bIINC *", "IINC\\\\{\\d+,\\d+\\\\} ");
|
||||||
result = result.replaceAll(opcodesFields +
|
result = result.replaceAll(opcodesFields
|
||||||
"\\\\\\{\\s*(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*\\\\\\} *",
|
+ "\\\\\\{\\s*(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*\\\\\\} *",
|
||||||
"$1\\\\{$2,$3,$4\\\\} ");
|
"$1\\\\{$2,$3,$4\\\\} ");
|
||||||
result = result.replaceAll(opcodesFields
|
result = result.replaceAll(opcodesFields
|
||||||
+ "\\\\\\{((?:.(?!,))*)\\\\\\} *", "$1\\\\{$2,.*?,.*?\\\\} ");
|
+ "\\\\\\{((?:.(?!,))*)\\\\\\} *", "$1\\\\{$2,.*?,.*?\\\\} ");
|
||||||
|
@ -164,14 +170,18 @@ public class RegexInsnFinder {
|
||||||
+ "\\\\\\{((?:.(?!,))*)\\\\\\} *", "$1\\\\{$2,.*?,.*?\\\\} ");
|
+ "\\\\\\{((?:.(?!,))*)\\\\\\} *", "$1\\\\{$2,.*?,.*?\\\\} ");
|
||||||
result = result.replaceAll(opcodesMethods + " *",
|
result = result.replaceAll(opcodesMethods + " *",
|
||||||
"$1\\\\{.*?,.*?,.*?\\\\} ");
|
"$1\\\\{.*?,.*?,.*?\\\\} ");
|
||||||
result = result.replaceAll(opcodesTypes + "\\\\\\{\\s*(.*?)\\s*\\\\\\} +",
|
result = result.replaceAll(opcodesTypes
|
||||||
"$1\\\\{$2\\\\} ");
|
+ "\\\\\\{\\s*(.*?)\\s*\\\\\\} +", "$1\\\\{$2\\\\} ");
|
||||||
result = result.replaceAll(opcodesTypes + " +", "$1\\\\{\\\\.*?\\\\} ");
|
result = result.replaceAll(opcodesTypes + " +", "$1\\\\{\\\\.*?\\\\} ");
|
||||||
result = result.replaceAll("\\bMULTIANEWARRAY\\\\\\{\\s*(\\d+)\\s*,\\s*(.*?)\\s*\\\\\\} *",
|
result = result
|
||||||
|
.replaceAll(
|
||||||
|
"\\bMULTIANEWARRAY\\\\\\{\\s*(\\d+)\\s*,\\s*(.*?)\\s*\\\\\\} *",
|
||||||
"MULTIANEWARRAY\\\\{$1,$2\\\\} ");
|
"MULTIANEWARRAY\\\\{$1,$2\\\\} ");
|
||||||
result = result.replaceAll("\\bMULTIANEWARRAY\\\\\\{\\s*(.*?)\\s*\\\\\\} *",
|
result = result.replaceAll(
|
||||||
|
"\\bMULTIANEWARRAY\\\\\\{\\s*(.*?)\\s*\\\\\\} *",
|
||||||
"MULTIANEWARRAY\\\\{\\d+,$1\\\\} ");
|
"MULTIANEWARRAY\\\\{\\d+,$1\\\\} ");
|
||||||
result = result.replaceAll("\\bMULTIANEWARRAY *", "MULTIANEWARRAY\\\\{\\\\\\d+,.*?\\\\} ");
|
result = result.replaceAll("\\bMULTIANEWARRAY *",
|
||||||
|
"MULTIANEWARRAY\\\\{\\\\\\d+,.*?\\\\} ");
|
||||||
result = result.replaceAll("\\bIFINSN *", opcodesIfs + " ");
|
result = result.replaceAll("\\bIFINSN *", opcodesIfs + " ");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -201,7 +211,8 @@ public class RegexInsnFinder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refreshes the internal instruction list when you have made changes to the method.
|
* Refreshes the internal instruction list when you have made changes to the
|
||||||
|
* method.
|
||||||
*/
|
*/
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
origInstructions = cleanInsn(mn.instructions);
|
origInstructions = cleanInsn(mn.instructions);
|
||||||
|
@ -299,7 +310,9 @@ public class RegexInsnFinder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for a regex in the instruction list and returns the first match.
|
* Searches for a regex in the instruction list and returns the first match.
|
||||||
* @param regex the regular expression
|
*
|
||||||
|
* @param regex
|
||||||
|
* the regular expression
|
||||||
* @return the matching instructions
|
* @return the matching instructions
|
||||||
*/
|
*/
|
||||||
public AbstractInsnNode[] find(final String regex) {
|
public AbstractInsnNode[] find(final String regex) {
|
||||||
|
@ -316,7 +329,9 @@ public class RegexInsnFinder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches a regex in an instruction list and returns all matches.
|
* Searches a regex in an instruction list and returns all matches.
|
||||||
* @param regex the regular expression
|
*
|
||||||
|
* @param regex
|
||||||
|
* the regular expression
|
||||||
* @return a list with all sets of matching instructions
|
* @return a list with all sets of matching instructions
|
||||||
*/
|
*/
|
||||||
public List<AbstractInsnNode[]> findAll(final String regex) {
|
public List<AbstractInsnNode[]> findAll(final String regex) {
|
||||||
|
@ -334,8 +349,11 @@ public class RegexInsnFinder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for a regex in the instruction list and returns all groups for the first match.
|
* Searches for a regex in the instruction list and returns all groups for
|
||||||
* @param regex the regular expression
|
* the first match.
|
||||||
|
*
|
||||||
|
* @param regex
|
||||||
|
* the regular expression
|
||||||
* @return the groups with matching instructions
|
* @return the groups with matching instructions
|
||||||
*/
|
*/
|
||||||
public AbstractInsnNode[][] findGroups(final String regex) {
|
public AbstractInsnNode[][] findGroups(final String regex) {
|
||||||
|
@ -343,9 +361,11 @@ public class RegexInsnFinder {
|
||||||
final Matcher regexMatcher = Pattern.compile(processRegex(regex),
|
final Matcher regexMatcher = Pattern.compile(processRegex(regex),
|
||||||
Pattern.MULTILINE).matcher(insnString);
|
Pattern.MULTILINE).matcher(insnString);
|
||||||
if (regexMatcher.find()) {
|
if (regexMatcher.find()) {
|
||||||
final AbstractInsnNode[][] result = new AbstractInsnNode[regexMatcher.groupCount() + 1][0];
|
final AbstractInsnNode[][] result = new AbstractInsnNode[regexMatcher
|
||||||
|
.groupCount() + 1][0];
|
||||||
for (int i = 0; i <= regexMatcher.groupCount(); i++) {
|
for (int i = 0; i <= regexMatcher.groupCount(); i++) {
|
||||||
result[i] = makeResult(regexMatcher.start(i), regexMatcher.end(i));
|
result[i] = makeResult(regexMatcher.start(i),
|
||||||
|
regexMatcher.end(i));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -356,8 +376,11 @@ public class RegexInsnFinder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for a regex in the instruction list and returns all groups for all matches.
|
* Searches for a regex in the instruction list and returns all groups for
|
||||||
* @param regex the regular expression
|
* all matches.
|
||||||
|
*
|
||||||
|
* @param regex
|
||||||
|
* the regular expression
|
||||||
* @return a list with all sets of groups with matching instructions
|
* @return a list with all sets of groups with matching instructions
|
||||||
*/
|
*/
|
||||||
public List<AbstractInsnNode[][]> findAllGroups(final String regex) {
|
public List<AbstractInsnNode[][]> findAllGroups(final String regex) {
|
||||||
|
@ -366,9 +389,11 @@ public class RegexInsnFinder {
|
||||||
final Matcher regexMatcher = Pattern.compile(processRegex(regex),
|
final Matcher regexMatcher = Pattern.compile(processRegex(regex),
|
||||||
Pattern.MULTILINE).matcher(insnString);
|
Pattern.MULTILINE).matcher(insnString);
|
||||||
if (regexMatcher.find()) {
|
if (regexMatcher.find()) {
|
||||||
final AbstractInsnNode[][] result = new AbstractInsnNode[regexMatcher.groupCount() + 1][0];
|
final AbstractInsnNode[][] result = new AbstractInsnNode[regexMatcher
|
||||||
|
.groupCount() + 1][0];
|
||||||
for (int i = 0; i <= regexMatcher.groupCount(); i++) {
|
for (int i = 0; i <= regexMatcher.groupCount(); i++) {
|
||||||
result[i] = makeResult(regexMatcher.start(i), regexMatcher.end(i));
|
result[i] = makeResult(regexMatcher.start(i),
|
||||||
|
regexMatcher.end(i));
|
||||||
}
|
}
|
||||||
results.add(result);
|
results.add(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,8 @@ public class RegexSearch implements SearchTypeDetails {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void search(final ClassNode node, final SearchResultNotifier srn, boolean exact) {
|
public void search(final ClassNode node, final SearchResultNotifier srn,
|
||||||
|
boolean exact) {
|
||||||
final Iterator<MethodNode> methods = node.methods.iterator();
|
final Iterator<MethodNode> methods = node.methods.iterator();
|
||||||
final String srchText = searchText.getText();
|
final String srchText = searchText.getText();
|
||||||
if (srchText.isEmpty())
|
if (srchText.isEmpty())
|
||||||
|
@ -48,8 +49,7 @@ public class RegexSearch implements SearchTypeDetails {
|
||||||
|
|
||||||
if (regexFinder == null) {
|
if (regexFinder == null) {
|
||||||
regexFinder = new RegexInsnFinder(node, method);
|
regexFinder = new RegexInsnFinder(node, method);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
regexFinder.setMethod(node, method);
|
regexFinder.setMethod(node, method);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue