创建原始数据包来欺骗 UDP 数据包
我正在寻找使用 Java 欺骗 UDP 数据包。 有没有好的 Java 库可以让您创建自己的原始套接字?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我将使用包装 libpcap 的 Java API。
libpcap 有一个“注入”功能,允许您发送原始数据包。 (当然,您必须在尝试发送数据包的计算机上拥有 root 或管理员权限。)有许多可用的 Java API,例如 jNetPcap 或 jpacp。 例如,jpcap 有一个 类,允许您发送任何数据包。
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.
这不需要不同的库。 它通常是平台上标准套接字库的一部分,例如 Winsock或伯克利套接字。 相关选项通常称为
ASOCK_RAW
。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
.在 Windows XP SP2(可能还有更高版本,包括 vista,但我不确定)中,原始套接字被禁用。 这些限制对于 UDP 套接字来说不如 TCP 套接字那么严格,因此您仍然可以执行您想要执行的操作。 该链接包含有关您可以做什么以及如何做的信息,这些信息可能会对您有所帮助,或者至少可以帮助您确定是否可行。
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.
如果您想编写一个 java 程序来欺骗 UDP 数据包,那么我会按照 Mike 的建议使用 jNetPcap 或 jpcap。 如果你只是想欺骗(而不是编写程序)那么我会尝试 wireshark。
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.