Question

I'm trying to recreate something I found on the internet called the upside-down ternet. It's for usage on my home network. Essentially, the idea is to use ARP Spoofing to change internet stealers' internet results, to make them stop. I just can't seem to get it working. It reads the to and from addresses of all incoming/outgoing arp packets as of now, but I can't seem to get it sending any packets, or at least my computer, when web browsing doesn't parse them properly. The problem seems to lye somewhere in the tcp/ip packet sending:

public void sendTCPForKittens(IPPacket p) {
        if (p.src_ip.getAddress().equals(
                Util.get_inet4(devices[0]).address.getAddress()))
            return;
        String incoming = Util.parseBytes(p.data);
        System.out.println("Packet from: " + p.src_ip.toString() + "\nData: "
                + incoming);
        IPPacket falsep2 = p;
        // p.datalink = ethpack;
        if (p.src_ip.getAddress() == Util.encodeStringToByte("192.168.1.1")) {
            falsep2.src_ip = p.src_ip;
            falsep2.dst_ip = p.dst_ip;
            falsep2.data = Util.encodeStringToByte("www.twitter.com");
            outgoing.sendPacket(falsep2);
        }
        // spoofed packet
        /*
         * System.out.println("SPOOFED IP DATA: ");
         * System.out.println("Packet from: " + falsep2.src_ip.toString() +
         * " To: " + falsep2.dst_ip.toString() + "\nData: " +
         * Util.parseBytes(falsep2.data));
         */
        p.data = new byte[] { 0 };
        p.header = new byte[] { 0 };
        outgoing.sendPacket(p);
    }
Was it helpful?

Solution

The original page you refer to does not mention ARP spoofing at all, and I am not sure what are you trying to rewrite in java. The system has 5 components:

  1. Detect unauthorized users (original solution used DHCP)
  2. Forward their traffic to special server (original solution used iptables)
  3. Parse and rewrite the TCP streams (original solution used iptables + linux kernel)
  4. Proxy HTTP protocol (original solution uses squid)
  5. Turn images upside down (original solution used perl + imagemagick)

Since you are talking about ARP, it looks like you want to re-write (1) and (2). I would recommend against this. You seem to be heavily confused about network protocols (you talk about ARP, the function has TCP in the name, you use improperly-encoded hostnames which belong in DNS protocol only, you do not set packet type, etc...).

I recommend to start with working solution and slowly rewrite stuff in java:

  • Get yourself a Linux/OpenWRT router, then setup firewall NAT rules such that all unauthorized web connections go your main computer. Even better, your current router may already support OpenWRT, then you will not have to buy anything. This will immediately take care of hardest parts - (1) (2) and (3). You should immediately see all unauthorized traffic going to your machine.
  • Install Squid (for step 4). All unauthorized traffic will go thru the squid.
  • Implement rotating images upside down in Java (step 5).
  • When this works, you can add Java HTTP proxy so you do not have to use Squid anymore.

If you want to go that way, I can describe the steps in more details.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top