mirror of
https://github.com/TheOfficialFloW/bd-jb
synced 2025-02-14 06:10:14 -05:00
Improve screen printing.
This commit is contained in:
parent
20c77c4f47
commit
f3a31c611e
@ -23,6 +23,8 @@ class Loader implements Runnable {
|
|||||||
private static final String MAIN_METHOD_NAME = "main";
|
private static final String MAIN_METHOD_NAME = "main";
|
||||||
private static final String PRINTLN_METHOD_NAME = "println";
|
private static final String PRINTLN_METHOD_NAME = "println";
|
||||||
|
|
||||||
|
private static final int JAR_PORT = 9025;
|
||||||
|
|
||||||
static void startJarLoader() {
|
static void startJarLoader() {
|
||||||
new Thread(new Loader()).start();
|
new Thread(new Loader()).start();
|
||||||
}
|
}
|
||||||
@ -31,10 +33,10 @@ class Loader implements Runnable {
|
|||||||
Screen.println("[+] bd-jb by theflow");
|
Screen.println("[+] bd-jb by theflow");
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
Screen.println("[*] Listening for remote JAR on port 9025...");
|
Screen.println("[*] Listening for JAR on port " + JAR_PORT + "...");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ServerSocket serverSocket = new ServerSocket(9025);
|
ServerSocket serverSocket = new ServerSocket(JAR_PORT);
|
||||||
Socket socket = serverSocket.accept();
|
Socket socket = serverSocket.accept();
|
||||||
InputStream inputStream = socket.getInputStream();
|
InputStream inputStream = socket.getInputStream();
|
||||||
OutputStream outputStream = new FileOutputStream(MNT_ADA_JAR_FILE);
|
OutputStream outputStream = new FileOutputStream(MNT_ADA_JAR_FILE);
|
||||||
@ -49,7 +51,7 @@ class Loader implements Runnable {
|
|||||||
|
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
|
socket.close();
|
||||||
serverSocket.close();
|
serverSocket.close();
|
||||||
|
|
||||||
Screen.println("[+] Received " + total + " bytes");
|
Screen.println("[+] Received " + total + " bytes");
|
||||||
@ -59,10 +61,10 @@ class Loader implements Runnable {
|
|||||||
DVBClassLoader dvbClassLoader =
|
DVBClassLoader dvbClassLoader =
|
||||||
DVBClassLoader.newInstance(new URL[] {new URL("file://" + MNT_ADA_JAR_FILE)});
|
DVBClassLoader.newInstance(new URL[] {new URL("file://" + MNT_ADA_JAR_FILE)});
|
||||||
Class exploitClass = dvbClassLoader.loadClass(EXPLOIT_CLASS_NAME);
|
Class exploitClass = dvbClassLoader.loadClass(EXPLOIT_CLASS_NAME);
|
||||||
Method main = exploitClass.getMethod(MAIN_METHOD_NAME, new Class[] {Method.class});
|
Method exploitMain = exploitClass.getMethod(MAIN_METHOD_NAME, new Class[] {Method.class});
|
||||||
Method screenPrintln =
|
Method screenPrintln =
|
||||||
Screen.class.getMethod(PRINTLN_METHOD_NAME, new Class[] {String.class});
|
Screen.class.getMethod(PRINTLN_METHOD_NAME, new Class[] {String.class});
|
||||||
main.invoke(null, new Object[] {screenPrintln});
|
exploitMain.invoke(null, new Object[] {screenPrintln});
|
||||||
|
|
||||||
Screen.println("[+] JAR exited");
|
Screen.println("[+] JAR exited");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -12,19 +12,22 @@ import java.awt.Container;
|
|||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class Screen extends Container {
|
public class Screen extends Container {
|
||||||
private static final long serialVersionUID = 0x4141414141414141L;
|
private static final long serialVersionUID = 0x4141414141414141L;
|
||||||
|
|
||||||
private static final Font FONT = new Font(null, Font.PLAIN, 40);
|
private static final int MAX_LINES = 32;
|
||||||
|
|
||||||
private static final ArrayList messages = new ArrayList();
|
private static final Font FONT = new Font(null, Font.PLAIN, 32);
|
||||||
|
|
||||||
|
private static final String[] lines = new String[MAX_LINES];
|
||||||
|
|
||||||
private static final Screen instance = new Screen();
|
private static final Screen instance = new Screen();
|
||||||
|
|
||||||
private static Method remoteScreenPrintln = null;
|
private static Method remoteScreenPrintln = null;
|
||||||
|
|
||||||
|
private static int currentLine = 0;
|
||||||
|
|
||||||
public static Screen getInstance() {
|
public static Screen getInstance() {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
@ -33,7 +36,7 @@ public class Screen extends Container {
|
|||||||
remoteScreenPrintln = screenPrintln;
|
remoteScreenPrintln = screenPrintln;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void println(String msg) {
|
public static synchronized void println(String msg) {
|
||||||
if (remoteScreenPrintln != null) {
|
if (remoteScreenPrintln != null) {
|
||||||
try {
|
try {
|
||||||
remoteScreenPrintln.invoke(null, new Object[] {msg});
|
remoteScreenPrintln.invoke(null, new Object[] {msg});
|
||||||
@ -41,7 +44,8 @@ public class Screen extends Container {
|
|||||||
// Ignore.
|
// Ignore.
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
messages.add(msg);
|
lines[currentLine] = msg;
|
||||||
|
currentLine = (currentLine + 1) % MAX_LINES;
|
||||||
instance.repaint();
|
instance.repaint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,14 +53,13 @@ public class Screen extends Container {
|
|||||||
public void paint(Graphics g) {
|
public void paint(Graphics g) {
|
||||||
g.setFont(FONT);
|
g.setFont(FONT);
|
||||||
g.setColor(Color.WHITE);
|
g.setColor(Color.WHITE);
|
||||||
|
g.clearRect(0, 0, getWidth(), getHeight());
|
||||||
|
|
||||||
int x = 80;
|
int x = 64;
|
||||||
int y = 80;
|
int y = 64;
|
||||||
int height = g.getFontMetrics().getHeight();
|
int height = g.getFontMetrics().getHeight();
|
||||||
for (int i = 0; i < messages.size(); i++) {
|
for (int i = 0; i < lines.length; i++) {
|
||||||
String msg = (String) messages.get(i);
|
g.drawString(lines[i], x, y + i * height);
|
||||||
g.drawString(msg, x, y);
|
|
||||||
y += height;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user