private static bool filterListsContains(IPsec.FilterList[] filterLists, string name)
 {
     foreach (IPsec.FilterList filterList in filterLists)
         if (filterList.name == name)
             return true;
     return false;
 }
 private static bool filterActionsContains(IPsec.FilterAction[] filterActions, string name)
 {
     foreach (IPsec.FilterAction filterAction in filterActions)
         if (filterAction.name == name)
             return true;
     return false;
 }
 public void reloadFilterPolicy()
 {
     IPsec.FilterPolicy[] filterPolicies = IPsec.getFilterPolicies();
     if (!filterPoliciesContains(filterPolicies, "ddosMitigationPolicy"))
     {
         IPsec.addFilterPolicy(ddosMitigationFilterList, "ddosMitigationPolicy", "Filter policy used by ddosMitigator");
     }
     ddosMitigationFilterPolicy = IPsec.getFilterPolicy("ddosMitigationPolicy");
 }
 public void reloadFilterAction()
 {
     IPsec.FilterAction[] filterActions = IPsec.getFilterActions();
     if (!filterActionsContains(filterActions, "ddosMitigationBlock"))
     {
         IPsec.addAction("ddosMitigationBlock", "block", "IP Filter List used by ddosMitigator");
     }
     ddosMitigationFilterAction = IPsec.getFilterAction("ddosMitigationBlock");
 }
 public void reloadFilterList()
 {
     IPsec.FilterList[] filterLists = IPsec.getFilterLists();
     if (!filterListsContains(filterLists, "ddosMitigationList"))
     {
         IPsec.addFilterList("ddosMitigationList", "IP Filter List used by ddosMitigator");
     }
     ddosMitigationFilterList = IPsec.getFilterList("ddosMitigationList");
 }
Exemple #6
0
 public static FilterPolicy getFilterPolicy(string name)
 {
     FilterPolicy[] filterPolicies = IPsec.getFilterPolicies();
     foreach (FilterPolicy filterPolicy in filterPolicies)
     {
         if (filterPolicy.name == name)
         {
             return(filterPolicy);
         }
     }
     return(new FilterPolicy());
 }
Exemple #7
0
 public static FilterAction getFilterAction(string name)
 {
     FilterAction[] filterActions = IPsec.getFilterActions();
     foreach (FilterAction filterAction in filterActions)
     {
         if (filterAction.name == name)
         {
             return(filterAction);
         }
     }
     return(new FilterAction());
 }
Exemple #8
0
 public static FilterList getFilterList(string name)
 {
     FilterList[] filterLists = IPsec.getFilterLists();
     foreach (FilterList filterList in filterLists)
     {
         if (filterList.name == name)
         {
             return(filterList);
         }
     }
     return(new FilterList());
 }
        public void init()
        {
            reloadFilterList();
            reloadFilterAction();
            reloadFilterPolicy();

            if (ddosMitigationFilterPolicy.rules == 1)
            {
                IPsec.addFilter(ddosMitigationFilterList, "1.1.1.1");
                IPsec.addFilterRule("ddosMitigationRule", ddosMitigationFilterPolicy, ddosMitigationFilterList, ddosMitigationFilterAction);
            }
        }
Exemple #10
0
 private static bool filtersContains(IPsec.Filter[] filters, IPAddress address)
 {
     foreach (IPsec.Filter filter in filters)
         if (filter.address.ToString() == address.ToString())
             return true;
     return false;
 }
 private static bool filterRulesContains(IPsec.FilterRule[] filterRules, bool enabled)
 {
     foreach (IPsec.FilterRule filterRule in filterRules)
         if (filterRule.enabled == enabled)
             return true;
     return false;
 }
 private static bool filterPoliciesContains(IPsec.FilterPolicy[] filterPolicies, string name)
 {
     foreach (IPsec.FilterPolicy filterPolicy in filterPolicies)
         if (filterPolicy.name == name)
             return true;
     return false;
 }