mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-03 08:39:09 +00:00
Added option to randomize MAC address
This commit is contained in:
@@ -61,12 +61,12 @@ public class NetworkInterface {
|
||||
}
|
||||
|
||||
public static void setMac(byte[] mac2) {
|
||||
System.out.println("Setting mac address to:" + formatMac(mac2));
|
||||
System.out.println("Setting mac address to: " + formatMac(mac2));
|
||||
mac = mac2;
|
||||
}
|
||||
|
||||
public static String formatMac(byte[] mac){
|
||||
StringBuffer b = new StringBuffer();
|
||||
StringBuilder b = new StringBuilder();
|
||||
for(int i = 0; i < 6;i++){
|
||||
b.append(String.format("%02X", mac[i]));
|
||||
if(i < 5)
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.util.Random;
|
||||
|
||||
public class NetworkUI extends JFrame implements KeyListener, ActionListener,
|
||||
DocumentListener {
|
||||
@@ -36,6 +37,7 @@ public class NetworkUI extends JFrame implements KeyListener, ActionListener,
|
||||
private JCheckBox authCheckBox;
|
||||
private JTextField authUsername;
|
||||
private JPasswordField authPassword;
|
||||
private JButton randomize;
|
||||
|
||||
private NetworkUI() {
|
||||
initGUI();
|
||||
@@ -84,9 +86,25 @@ public class NetworkUI extends JFrame implements KeyListener, ActionListener,
|
||||
macList[i].setSelectedIndex(value);
|
||||
macScrollList[i] = new JScrollPane(macList[i]);
|
||||
macList[i].ensureIndexIsVisible(value > 0 ? value - 1 : value);
|
||||
|
||||
}
|
||||
|
||||
randomize = new JButton("Randomize MAC");
|
||||
randomize.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Random rand = new Random();
|
||||
byte[] macAddr = new byte[6];
|
||||
rand.nextBytes(macAddr);
|
||||
macAddr[0] = (byte)(macAddr[0] & (byte)254);
|
||||
for (int i = 0; i < macAddr.length; i++) {
|
||||
int value = macAddr[i] & 0xFF;
|
||||
macList[i].setSelectedIndex(value);
|
||||
macList[i].ensureIndexIsVisible(value > 0 ? value - 1 : value);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
authCheckBox = new JCheckBox("Auth");
|
||||
authCheckBox.setSelected(ProxySocket.auth);
|
||||
authCheckBox.addActionListener(this);
|
||||
@@ -143,6 +161,8 @@ public class NetworkUI extends JFrame implements KeyListener, ActionListener,
|
||||
}
|
||||
|
||||
Box submit = Box.createHorizontalBox();
|
||||
main.add(Box.createVerticalStrut(5));
|
||||
submit.add(randomize);
|
||||
submit.add(submitButton);
|
||||
|
||||
main.add(type);
|
||||
|
||||
@@ -98,7 +98,7 @@ public class Script implements Runnable {
|
||||
frameWorkType = TYPE_OTHER;
|
||||
}
|
||||
Core.verbose("Running script...");
|
||||
Logger.addMessage("Script started.");
|
||||
Logger.addMessage("Script started.", true);
|
||||
try {
|
||||
while(this.state != STATE_STOPPED) {
|
||||
if(context.getRandomHandler().checkAndRun()) {
|
||||
@@ -118,7 +118,7 @@ public class Script implements Runnable {
|
||||
}
|
||||
Core.verbose("Script stopped/finished, unloading and stopping...");
|
||||
onFinish();
|
||||
Logger.addMessage("Script stopped.");
|
||||
Logger.addMessage("Script stopped.", false);
|
||||
context.getServerProvider().unloadScript(this);
|
||||
this.state = STATE_STOPPED;
|
||||
context.setRunningScript(null);
|
||||
|
||||
@@ -90,7 +90,7 @@ public class RandomHandler {
|
||||
public boolean checkAndRun() {
|
||||
for(Random r : this.activeRandoms) {
|
||||
if(r.activate()) {
|
||||
Logger.addMessage("Running random '" + r.getName() + "'");
|
||||
Logger.addMessage("Running random '" + r.getName() + "'", true);
|
||||
r.execute();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class UlirathaClient extends Thread {
|
||||
case 75:
|
||||
valid = stream.readBoolean();
|
||||
if (valid) {
|
||||
Logger.addMessage("We're connected with the Uliratha server!");
|
||||
Logger.addMessage("We're connected with the Uliratha server!", false);
|
||||
connected = true;
|
||||
}else{
|
||||
socket.close();
|
||||
@@ -89,11 +89,11 @@ public class UlirathaClient extends Thread {
|
||||
|
||||
public void connectionBroken(NIOSocket nioSocket, Exception exception) {
|
||||
if (valid) {
|
||||
Logger.addMessage("We lost connection with the Uliratha server, reconnecting...");
|
||||
Logger.addMessage("We lost connection with the Uliratha server, reconnecting...", false);
|
||||
reconnect();
|
||||
connected = false;
|
||||
}else{
|
||||
Logger.addMessage("We're disconnected from the Uliratha server");
|
||||
Logger.addMessage("We're disconnected from the Uliratha server", false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user