I am looking to spoof UDP packets using Java. Are there any good Java libraries out there that allow you to create your own RAW SOCKETS?
4 Answers
I would use a Java API that wraps libpcap.
libpcap has an "inject" function that allows you to send a raw packet. (Of course, you must have root or administrator priveleges on the machine you're trying to send the packet from.) There are a number of Java APIs that are available, such as jNetPcap or jpacp. jpcap, for example, has a class that allows you to send any packet.

- 13,559
- 7
- 62
- 90
-
The link does not work http://netresearch.ics.uci.edu/kfujii/jpcap/doc/javadoc/jpcap/JpcapSender.html – Al-Alamin Nov 06 '17 at 13:29
In Windows XP SP2 (and presumably higher versions, including vista, but I'm not certain of that), raw sockets are disabled. These restrictions are somewhat less strict for UDP sockets than for TCP sockets, so you may still be able to do whatever you are trying to do. That link contains info on what you can do and how to do it that will probably help you, or at least help you determine if it's possible.

- 25,504
- 18
- 62
- 103
If you are looking to writing a java program to spoof the UDP packets then I would use jNetPcap or jpcap as suggested by Mike. If you just want to spoof (not to write the program) then I would try wireshark.

- 741
- 2
- 9
- 19
-
2By spoofing he imply creating packet not just capturing. Wireshark doesn't have a Packet Builder but JPcap and JNetPcap support the operation. – h3xStream Jan 06 '11 at 02:56