Linux:如何将整个数据包发送到另一台主机上的特定端口? [英] Linux: How to send a whole packet to a specific port on another host?

查看:742
本文介绍了Linux:如何将整个数据包发送到另一台主机上的特定端口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用libpcap捕获了一个TCP数据包,我想将整个数据包(不进行修改)发送到另一台主机上的特定端口(另一台监听该端口的嗅探器).

I have captured a TCP packet using libpcap, and I want to send this whole packet(without modifying it) to a specific port on another host(which has another sniffer listening to that port).

有什么办法可以做到这一点?

Is there any way I can do this?

非常感谢!

推荐答案

在这种情况下,netcat可能会起作用,尽管我认为您可能必须重构标头,但尚未尝试过.

netcat may work in this case although I think you may have to reconstruct the header, have not tried.

如何在netcat中转义十六进制值

另一种选择是使用iptables将数据包发送到另一个嗅探器,同时仍将其捕获到包分析器中

The other option is to use iptables to tee the packet to the other sniffer while still catching it in you package analyzer

http://www. bjou.de/blog/2008/05/howto-copyteeclone-network-traffic-using-iptables/

另一种选择是使用端口镜像,根据所使用的交换机,它具有几个不同的名称,但是它允许您将交换机上的端口设置为本质上是集线器.

Another option is using a port mirror, this goes by a few differnt names depending on the switch being used but it allows you to set a port on a a switch to be essentially a hub.

我认为,如果无法使netcat正常工作,最好的选择是使用iptables,甚至可以为其添加过滤器.

I think your best bet if you can't get netcat to work is to use iptables and you can add filters to that even.

这篇关于Linux:如何将整个数据包发送到另一台主机上的特定端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆