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);
}
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:
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:
If you want to go that way, I can describe the steps in more details.