网络(TCP-IP或套接字编程) [英] Networking (TCP-IP or Socket Programming)

查看:69
本文介绍了网络(TCP-IP或套接字编程)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何使用任何编程语言将wireshark捕获的数据包发送到一个确定的端口?

我使用Wireshark捕获了数据包。现在我必须将这些数据包分析为3类IP并将这些数据包发送到不同的端口。我怎么能这样做?

如果有人知道答案,请花一些时间给我发电子邮件[edit]删除电子邮件[/ edit]

How can we send packets captured by wireshark to a definite port using any programming language?
I have captured packets using Wireshark. Now I have to analyze those packets into 3 classes of IPs and send those packets to different ports. How can I do that?
If anyone knows the answer, please take some time to email me at [edit]Removed email[/edit]

推荐答案

假设您已将它们保存在文件中,并且您知道它的位置。你可以试试这个:



Assuming that you have them saved in a file and you know the location to it. You could try this:

public string ReadFile(string Location)
{
  using(StreamReader Reader = new StreamReader(Location))
   {
     return Reader.ReadToEnd();
   }
}

public byte[] GetPacket(string Packet)
{
  return Encoding.ASCII.GetBytes(Packet);
}

void WhenToSend()
{
  SendPacket(GetPacket(ReadFile(Location)));
}


这篇关于网络(TCP-IP或套接字编程)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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