【问题标题】:Port Knocking with Mono On Linux在 Linux 上使用 Mono 进行端口敲门
【发布时间】:2013-05-07 04:13:04
【问题描述】:

我正在 Linux 上使用 MonoDevelop 开发 Port Knocking 应用程序。 服务器应用程序使用 iptables 通过命令打开/关闭某些端口:

iptables -A INPUT -j DROP

它成功地应用了某些规则,例如:

iptables -A INPUT -p udp --dport 606:610 -j LOG

然后我用 UdpClient 创建了客户端应用程序来发送敲门请求

private static UdpClient udp;

public static void sendmessage (string message, string host, short port)
        {
            try 
            {
                IPAddress ip=IPAddress.Parse(host);
                if(udp==null)
                    udp=new UdpClient();

                byte[]  b=ASCIIEncoding.ASCII.GetBytes(message);
            udp.Send(b,b.Length,new IPEndPoint(ip,port));               
        } 

        catch (Exception exc) 
        {
            throw exc;
        }
    }

但是这个客户端应用程序崩溃了,似乎在服务器关闭每个端口时引发了异常。

有没有什么发送数据包的解决方案,不关心服务器是否关闭/打开某个端口?

【问题讨论】:

    标签: c# monodevelop


    【解决方案1】:

    尝试将超时设置为低并忽略异常而不是抛出它

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-21
      • 1970-01-01
      • 1970-01-01
      • 2020-03-25
      • 1970-01-01
      相关资源
      最近更新 更多