views:

902

answers:

5

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?

Sorry, forgot the Java stuff.

A: 

That is not something that requires a different library. It's usually part of the standard socket library on the platform, like Winsock or Berkeley sockets. The relevant option is often called ASOCK_RAW.

unwind
A: 

See my question here

Brian R. Bondy
A: 

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.

rmeador
I was looking to run this in a Linux environment.
Javamann
+1  A: 

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.

Mike
A: 

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.

Gilbeg