Example #1
0
        public int ScanDevice(string start_IP, string end_IP)
        {
            string[] sArray_startIP = start_IP.Split('.');
            string[] sArray_endIP   = end_IP.Split('.');
            string   unchange_part  = sArray_startIP[0] + "." + sArray_startIP[1] + "." + sArray_startIP[2] + ".";

            int start  = Int32.Parse(sArray_startIP[3]);
            int end    = Int32.Parse(sArray_endIP[3]);
            int IP_num = end - start;

            List <string> dev_IP_list = new List <string>();

            for (int count = 0; count + start <= end; count++)
            {
                dev_IP_list.Add(unchange_part + Convert.ToString(count + start));
            }

            foreach (string dev_IP in dev_IP_list)
            {
#if debug
                Console.WriteLine(dev_IP);
#endif
                DeviceForm devform       = new DeviceForm(dev_IP, 33333);
                SendInfo   sendcheckInfo = new SendInfo(devform);
                sendcheckInfo.SendCheckInfo();
            }

            return(IP_num);
        }
Example #2
0
        public bool ClearAllRules(string dev_IP)
        {
            DeviceForm devform = new DeviceForm(dev_IP, 22222);

            ConfigDPIRules configDevice = new ConfigDPIRules(devform);

            return(configDevice.ClearAllRules());
        }
Example #3
0
        public bool ChangeWhiteLists(string dst_IP, string src_IP, string dev_IP, string dst_port, string src_port, bool log_record, bool add_delete)
        {
            WhiteLists lists = new WhiteLists();

            lists.setIPAndPort(dst_IP, src_IP, dst_port, src_port);

            DeviceForm   devform      = new DeviceForm(dev_IP, 22222);
            IConfigRules configDevice = new ConfigRules(devform);

            return(configDevice.ConfigWhiteLists(lists, add_delete));
        }
Example #4
0
        public bool ChangeOPCRules(string dst_IP, string src_IP, string dev_IP, bool log_record, bool add_delete)
        {
            OPCRulesForm orf = new OPCRulesForm();

            orf.setDst_IPAndSrc_IP(dst_IP, src_IP);

            DeviceForm devform = new DeviceForm(dev_IP, 22222);

            ConfigDPIRules configDevice = new ConfigDPIRules(devform);

            return(configDevice.ConfigOPCRules(orf, log_record, add_delete));
        }
Example #5
0
        public bool ChangeModbusTcpRules(string dst_IP, string src_IP, string min_addr, string max_addr, int func, int Min_data, int Max_data, string dev_IP, bool log_record, bool add_delete)
        {
            ModbusTcpRulesForm mtrf = new ModbusTcpRulesForm();

            mtrf.setIP_Addr_Funcode(dst_IP, src_IP, min_addr, max_addr, func, Min_data, Max_data);

            DeviceForm devform = new DeviceForm(dev_IP, 22222);

            ConfigDPIRules configDevice = new ConfigDPIRules(devform);

            return(configDevice.ConfigModbusTcpRules(mtrf, log_record, add_delete));
        }
Example #6
0
        public bool ChangeDNP3Rules(string dst_IP, string src_IP, string dev_IP, bool log_record, bool add_delete)
        {
            DNP3RulesForm dnp3rf = new DNP3RulesForm();

            dnp3rf.setDst_IPAndSrc_IP(dst_IP, src_IP);

            DeviceForm devform = new DeviceForm(dev_IP, 22222);

            IConfigRules configDevice = new ConfigRules(devform);

            return(configDevice.ConfigDNP3Rules(dnp3rf, add_delete));
        }
Example #7
0
 public APCRulesManage()
 {
     this.db_operate    = new DBOperation();
     this.devform       = new DeviceForm("0.0.0.0", 22222);
     this.protocol_port = new Dictionary <string, string>()
     {
         { "ftp", "21" },
         { "http", "80" },
         { "telnet", "23" },
         { "smtp", "25" },
         { "pop3", "110" },
         { "ssh", "22" }
     };
 }
Example #8
0
 /*初始化设备*/
 public SendInfo(DeviceForm devform)
 {
     this.devform = devform;
 }
Example #9
0
 public ARPProtect()
 {
     this.devform   = new DeviceForm("0.0.0.0", 22222);
     this.dboperate = new DBOperation();
 }
Example #10
0
 public STDRulesManage()
 {
     this.db_operate = new DBOperation();
     this.devform    = new DeviceForm("0.0.0.0", 22222);
 }
Example #11
0
 public ConfigDPIRules(DeviceForm devform)
 {
     this.devform       = devform;
     this.DPIdb_operate = new DBOperation();
 }
Example #12
0
 public ConfigWhiteLists()
 {
     this.devform = new DeviceForm("0.0.0.0", 22222);
 }
Example #13
0
 public ConfigDPIRules(DeviceForm devform)
 {
     this.devform = devform;
 }
Example #14
0
        static void Main(string[] args)
        {
            //IAPCRulesManage apc = new APCRulesManage();
            //apc.ApplicationProtocolControl("172.16.10.1", "http", true);
            //IARPProtect arp = new ARPProtect();
            //arp.configARPRules("172.16.10.1", "172.16.10.2", "172.16.10.254", false);
            //ICNCRulesManage cnc = new CNCRulesManage();
            //cnc.DelCNCRules("172.16.10.1", true, 52, "172.16.10.2", "172.16.10.3", "502", "205");
            DeviceForm   dev = new DeviceForm("172.16.10.1", 502);
            FWDeviceForm fw  = new FWDeviceForm("172.16.10.2", 22222, "ff:ff:ff:ff:ff:ff");
            //IConfigRules dpi = new ConfigDPIRules(dev);
            //ModbusTcpRulesForm modbus = new ModbusTcpRulesForm();
            //OPCRulesForm opc = new OPCRulesForm();
            //DNP3RulesForm dnp = new DNP3RulesForm();
            ////dpi.ConfigModbusTcpRules(modbus,true,false);
            ////dpi.ConfigOPCRules(opc,true,false);
            //dpi.ConfigDNP3Rules(dnp,true,false);
            IConfigureNAT nat = new ConfigureNAT();
            //nat.ConfigSNAT(fw,"eth0","192.168.10.3","172.16.10.3",false);
            //nat.ConfigDNAT(fw,"192.16.10.1","55","172.16.10.1","55",false);
            IConfigWhiteLists whl = new ConfigWhiteLists();
            //whl.ChangeWhiteLists("172.16.10.1", "172.16.10.2", "172.16.10.254","205","502",true,false);
            IPRTRulesManage prt = new PRTRulesManage();
            //prt.DefaultRouteConfig("172.16.10.1",false,"eth0","172.16.10.254");
            //prt.HostRouteConfig("172.16.10.1",false,"172.16.10.2","eth0","172.16.10.254");
            //prt.NetRouteConfig("172.16.10.1", false, "172.16.10.2", "255.255.255.0","eth0", "172.16.10.254");
            ISTDRulesManage std = new STDRulesManage();

            std.DelSTDRules("172.16.10.1", true, "tcp", "172.16.10.2", "172.16.10.3", "22222", "33333");
            //            IDevicesCheck devConfirm = new DevicesCheck();
            //            List<FWDeviceForm> fws = devConfirm.CheckDevices("172.16.10.9", "172.16.10.10");

            //            Console.WriteLine("打印扫描结果 :");
            //            IReceiveLog log = new ReceiveLog();
            //            log.Save_DisplayLog(true);
            //            foreach (FWDeviceForm fw in fws)
            //            {
            //                string fwip = fw.getDev_IP();
            //                string fwmac = fw.getDev_MAC();
            //                List<ProtecDeviceForm> protecDev_list = fw.getProtecDev_list();

            //                Console.WriteLine("防火墙设备IP : {0} 防火墙设备MAC : {1}", fwip, fwmac);

            //                Console.WriteLine("关联的受保护设备 :");

            //                if (fwip != "0.0.0.0")
            //                {

            //                    foreach (var item in protecDev_list)
            //                    {
            //                        string dev_type = item.getDev_type();
            //                        Console.WriteLine("IP {0}   MAC {1} 设备制造商 {2}", item.getDev_IP(), item.getDev_MAC(), dev_type);

            //                    }
            //                }
            //                else Console.WriteLine("防火墙为无IP模式");
            //            }

            //            //IARPProtect tes = new ARPProtect();
            //            //tes.configARPRules("172.16.10.9", "172.16.10.254", "08:57:00:e5:87:a7", true);

#if debug
            Console.ReadLine();
#endif
        }
Example #15
0
 public ConfigWhiteLists()
 {
     this.devform        = new DeviceForm("0.0.0.0", 22222);
     this.LISTdb_operate = new DBOperation();
 }
Example #16
0
 public CNCRulesManage()
 {
     this.devform = new DeviceForm("0.0.0.0", 22222);
 }
Example #17
0
 public ARPProtect()
 {
     this.devform = new DeviceForm("0.0.0.0", 22222);
 }