From ffbe17dc14282850c933951bce7d6a3eebb2c183 Mon Sep 17 00:00:00 2001 From: Paradox Date: Tue, 10 Dec 2013 00:30:16 +0100 Subject: [PATCH] Revert "Added Matt's proxy and mac changer" This reverts commit e18a64970f7b96e0970c03345b79385c2b5a3c35. --- .../org/matt123337/patcher/ClassRemapper.java | 25 -- .../src/org/matt123337/proxy/ProxySocket.java | 217 ------------------ .../src/org/matt123337/proxy/ProxyType.java | 5 - .../matt123337/spoofer/NetworkInterface.java | 22 -- parabotv2/src/org/parabot/Landing.java | 11 +- 5 files changed, 2 insertions(+), 278 deletions(-) delete mode 100644 parabotv2/src/org/matt123337/patcher/ClassRemapper.java delete mode 100755 parabotv2/src/org/matt123337/proxy/ProxySocket.java delete mode 100755 parabotv2/src/org/matt123337/proxy/ProxyType.java delete mode 100644 parabotv2/src/org/matt123337/spoofer/NetworkInterface.java diff --git a/parabotv2/src/org/matt123337/patcher/ClassRemapper.java b/parabotv2/src/org/matt123337/patcher/ClassRemapper.java deleted file mode 100644 index 6bef33f..0000000 --- a/parabotv2/src/org/matt123337/patcher/ClassRemapper.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.matt123337.patcher; - -import org.objectweb.asm.commons.Remapper; - -import java.util.HashMap; - -public class ClassRemapper extends Remapper { - private static HashMap remapNames = new HashMap(); - static { - remapNames.put("java/net/Socket", "org/matt123337/proxy/ProxySocket"); - remapNames.put("java/net/NetworkInterface", - "org/matt123337/spoofer/NetworkInterface"); - } - - @Override - public String map(String str) { - String s = remapNames.get(str); - if (s != null) { - System.out.println("[CLASS_REMAP] " + str + " => " + s); - return s; - } else { - return str; - } - } -} \ No newline at end of file diff --git a/parabotv2/src/org/matt123337/proxy/ProxySocket.java b/parabotv2/src/org/matt123337/proxy/ProxySocket.java deleted file mode 100755 index 3bf7622..0000000 --- a/parabotv2/src/org/matt123337/proxy/ProxySocket.java +++ /dev/null @@ -1,217 +0,0 @@ -package org.matt123337.proxy; - -import java.io.BufferedReader; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.net.SocketAddress; -import java.net.UnknownHostException; -import java.nio.channels.SocketChannel; - -public class ProxySocket extends Socket { - - private static ProxyType proxyType = ProxyType.HTTP; - - private static int proxyPort = -1; - - private InetAddress addr; - private int port; - - private static InetAddress proxyInetAddress = null; - - private InetSocketAddress cachedAddr; - - public ProxySocket(InetAddress addr, int port) throws IOException { - super(addr, port); - } - - public ProxySocket() { - super(); - } - - public ProxySocket(String host, int port) throws IOException { - super(host, port); - } - - public static void setProxy(ProxyType type,String host, int port) { - try { - proxyInetAddress = InetAddress.getByName(host); - proxyType = type; - } catch (UnknownHostException e) { - // ignored - } - } - - @Override - public void connect(SocketAddress addr) throws IOException { - if (addr instanceof InetSocketAddress) { - InetSocketAddress isa = (InetSocketAddress) addr; - this.addr = InetAddress.getByName(isa.getHostString()); - this.port = isa.getPort(); - } - if (proxyInetAddress != null && proxyPort != -1) { - super.connect(cachedAddr = new InetSocketAddress(proxyInetAddress, - proxyPort)); - initProxy(); - } else - super.connect(addr); - } - - private void initProxy() throws IOException { - System.out.println("[SOCKET_HOOK] Proxying:" + addr + ":" + port - + " Over:" + proxyInetAddress + ":" + proxyPort + " Type:" - + proxyType); - switch (proxyType) { - case HTTP: - http_connect(); - break; - case SOCKS4: - socks4_connect(); - break; - case SOCKS5: - socks5_connect(); - break; - default: - throw new IOException("Unsupported proxy type:" + proxyType); - } - } - - private void http_connect() throws IOException { - InputStream in = getInputStream(); - BufferedReader br = new BufferedReader(new InputStreamReader(in)); - OutputStream out = getOutputStream(); - out.write(("CONNECT " + addr.getHostAddress() + ":" + port + "\r\n") - .getBytes()); - // out.write("Connection:keep-alive\r\n".getBytes()); - out.write("\r\n".getBytes()); - String str; - while ((str = br.readLine()) != null) { - if (str.length() == 0) - break; - if (!str.startsWith("HTTP")) - continue; - int code = Integer.parseInt(str.substring(9, 12)); - switch (code) { - case 404: - throw new IOException( - "Proxy seems to think we're connecting to a webpage..."); - case 403: - throw new IOException( - "Proxy doesn't support connecting to port:" + port); - } - if (code / 100 != 2) - throw new IOException( - "Unable to connect to server! Error Code:" + code); - } - } - - private void socks4_connect() throws IOException { - DataOutputStream out = new DataOutputStream(getOutputStream()); - DataInputStream in = new DataInputStream(getInputStream()); - - out.write(0x04); - out.write(0x01); // connection type (TCP stream) - out.writeShort(port); - byte[] b = addr.getAddress(); - if (b.length != 4) - throw new IOException("Unsupported IP type for socksv4!"); - out.write(b); - out.write(0); // the userID stuff, 0 means end of string (null - // terminated) - out.flush(); - - if (in.read() != 0x00) // null byte - throw new IOException("Proxy server dun goofed"); - if (in.read() != 0x5a) - throw new IOException( - "Proxy server was unable to connect to server!"); - - in.readShort(); // ignored - in.readFully(b); // ignored - } - - private void socks5_connect() throws IOException { - DataOutputStream out = new DataOutputStream(getOutputStream()); - DataInputStream in = new DataInputStream(getInputStream()); - out.write(0x05); // the version - out.write(1); // number of authentication methods (no auth for now) - out.write(0); // the authentication (none) - out.flush(); - - if (in.read() != 0x05) // remote proxy version - throw new IOException("Proxy server is not supported!"); - if (in.read() != 0x00) // make sure shit is a vaild request - throw new IOException("Proxy server declined request!"); - - // now to write the actual request - out.write(0x05); // again the socks version - out.write(0x01); // the connection type (0x01 = TCP Connection) - out.write(0x00); // the reserve byte, un-used - byte[] b = addr.getAddress(); - out.write(b.length == 4 ? 0x01 : 0x04); // if ipv4 or ipv6 (0x03 = - // domain name, but that's - // unsupported as of yet) - out.write(b); - out.writeShort(port); - out.flush(); - - // now to read the server's reply - if (in.read() != 0x05) // socks version (again) - throw new IOException("Proxy server dun goofed"); - int reply = in.read(); - if (reply == 0x08) - throw new IOException("Bad address sent to proxy server"); - if (reply != 0x00) - throw new IOException("Unable to connect to server!"); - in.read(); // reserve byte - int addrType = in.read(); - b = new byte[4]; - switch (addrType) { - case 0x01: - b = new byte[4]; - break; - case 0x04: - b = new byte[16]; - break; - default: - throw new IOException("Bad address type from proxy server!"); - } - in.readFully(b); - in.readShort(); // the returned port #, ignored - } - - @Override - public int getPort() { - if (super.getInetAddress().equals(proxyInetAddress)) - return port; - return super.getPort(); - } - - @Override - public InetAddress getInetAddress() { - if (super.getInetAddress().equals(proxyInetAddress)) - return addr; - return super.getInetAddress(); - } - - @Override - public SocketAddress getRemoteSocketAddress() { - if (super.getInetAddress().equals(proxyInetAddress)) - return cachedAddr; - return super.getRemoteSocketAddress(); - } - - @Override - public SocketChannel getChannel() { - if (super.getInetAddress().equals(proxyInetAddress)) - return null; - return super.getChannel(); - } - -} diff --git a/parabotv2/src/org/matt123337/proxy/ProxyType.java b/parabotv2/src/org/matt123337/proxy/ProxyType.java deleted file mode 100755 index d954f7b..0000000 --- a/parabotv2/src/org/matt123337/proxy/ProxyType.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.matt123337.proxy; - -public enum ProxyType { - SOCKS5,SOCKS4,HTTP -} diff --git a/parabotv2/src/org/matt123337/spoofer/NetworkInterface.java b/parabotv2/src/org/matt123337/spoofer/NetworkInterface.java deleted file mode 100644 index d365805..0000000 --- a/parabotv2/src/org/matt123337/spoofer/NetworkInterface.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.matt123337.spoofer; - -import java.net.InetAddress; - -public class NetworkInterface { - - private byte[] mac = new byte[]{11,11,11,11,11,11}; - - private static NetworkInterface cached; - - public byte[] getHardwareAddress(){ - System.out.println("[NI_HOOK] Mac Address Spoofed!"); - return mac; - } - - public static NetworkInterface getByInetAddress(InetAddress addr){ - if(cached == null) - cached = new NetworkInterface(); - return cached; - } - -} diff --git a/parabotv2/src/org/parabot/Landing.java b/parabotv2/src/org/parabot/Landing.java index c1185ad..041e6db 100644 --- a/parabotv2/src/org/parabot/Landing.java +++ b/parabotv2/src/org/parabot/Landing.java @@ -1,11 +1,9 @@ package org.parabot; -import org.matt123337.patcher.ClassRemapper; -import org.objectweb.asm.commons.RemappingClassAdapter; -import org.objectweb.asm.tree.ClassNode; import org.parabot.core.Core; import org.parabot.core.Directories; import org.parabot.core.forum.AccountManager; +import org.parabot.core.spoofing.Ip; import org.parabot.core.ui.LoginUI; import org.parabot.core.ui.ServerSelector; import org.parabot.core.ui.utils.UILog; @@ -87,16 +85,11 @@ public final class Landing { password = args[++i]; break; case "-proxy": + Ip.spoofIP(args[++i], args[++i]); break; } } } - public ClassNode remapClasses(ClassNode c){ - ClassNode ret = new ClassNode(); - RemappingClassAdapter adapter = new RemappingClassAdapter(ret,new ClassRemapper()); - c.accept(adapter); - return ret; - } }