Updated spoofers

This commit is contained in:
Jeroen Ketelaar
2014-02-18 19:26:55 +01:00
parent d176319dce
commit b06829b528
6 changed files with 76 additions and 35 deletions
@@ -1,23 +0,0 @@
package org.parabot.core.proxy;
/**
* User: Jeroen
* Date: 18/02/14
* Time: 16:54
*/
public class Proxy {
//public static Socks5Proxy proxy5;
//public static Socks4Proxy proxy4;
//public static void setProxy4() throws UnknownHostException {
//}
//public static void setProxy5() throws UnknownHostException {
// proxy5 = new Socks5Proxy("80.63.56.146", 1080);
//}
//public static void main(String[] args) throws UnknownHostException {
// setProxy5();
//}
}
@@ -0,0 +1,48 @@
package org.parabot.core.spoofer;
import java.net.InetAddress;
import java.net.SocketException;
import java.util.Enumeration;
public class MacAddress {
public static byte[] mac = new byte[] { 11, 11, 11, 11, 11, 11 };
private static byte[] realMac;
private static MacAddress cached;
static {
try {
mac = getRealHardwareAddress();
} catch (Exception ignored) {
}
}
public byte[] getHardwareAddress() {
return mac;
}
public static byte[] getRealHardwareAddress() throws SocketException {
if (realMac != null)
return realMac;
Enumeration<java.net.NetworkInterface> nis = java.net.NetworkInterface
.getNetworkInterfaces();
while (nis.hasMoreElements()) {
try {
byte[] b = nis.nextElement().getHardwareAddress();
if (b.length == 0)
continue;
return realMac = b;
} catch (Exception e) {
}
}
return mac;
}
public static MacAddress getByInetAddress(InetAddress addr) {
if (cached == null)
cached = new MacAddress();
return cached;
}
}
@@ -0,0 +1,14 @@
package org.parabot.core.spoofer;
/**
* User: Jeroen
* Date: 18/02/14
* Time: 16:54
*/
public class Proxy {
public static void setProxy(String host, int port){
System.getProperties().put("proxySet", "true");
System.getProperties().put("proxyHost", host);
System.getProperties().put("proxyPort", port);
}
}
+2 -1
View File
@@ -100,7 +100,8 @@ public class BotUI extends JFrame implements ActionListener {
System.exit(0);
break;
case "Network":
System.out.println("Starting up the proxy UI");
NetworkUI UI = new NetworkUI();
UI.frame.setVisible(true);
break;
default:
System.out.println("Invalid command: " + command);
@@ -1,5 +1,7 @@
package org.parabot.core.ui;
import org.parabot.core.spoofer.Proxy;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -8,7 +10,7 @@ import java.util.HashMap;
public class NetworkUI {
private JFrame frame;
public JFrame frame;
private JTextField proxyHostField;
private JTextField proxyPortField;
private HashMap<String, Integer> socksVersions = new HashMap<>();
@@ -92,7 +94,15 @@ public class NetworkUI {
JButton submit = new JButton("Submit");
submit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println(socksVersions.get(socksOptions.getSelectedItem()));
if (!proxyHostField.getText().isEmpty() && !proxyPortField.getText().isEmpty()){
try{
Integer.parseInt(proxyPortField.getText());
}catch (Exception ex){
System.out.println("The given port is not a numeric value");
return;
}
Proxy.setProxy(proxyHostField.getText(), Integer.parseInt(proxyPortField.getText()));
}
}
});
submit.setBounds(327, 243, 117, 29);
@@ -1,9 +0,0 @@
package org.parabot.core.ui.controllers;
/**
* User: Jeroen
* Date: 18/02/14
* Time: 17:52
*/
public class NetworkUIController {
}