ddos-mlp-mitigation

git clone git://git.codymlewis.com/ddos-mlp-mitigation.git
Log | Files | Refs | Submodules | README | LICENSE

commit 0d787a4b8de19f84e8e20ff5c78c1bce40151246
parent 3d9957f9af419bf5d58ba6bbaf637685bd36b2f5
Author: Cody Lewis <cody@codymlewis.com>
Date:   Tue, 14 Apr 2020 20:39:14 +1000

Improved naming

Diffstat:
Mnetwork_controller.py | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/network_controller.py b/network_controller.py @@ -3,6 +3,8 @@ ''' The controller of the network. This also detects DDoS attacks. + +Cody Lewis ''' import sys @@ -22,7 +24,6 @@ import pox3.openflow.libopenflow_01 as of if __name__ != "__main__": - import pox3.forwarding.l2_learning as l2l LOG = core.getLogger() IPV4_PROTOCOLS = { @@ -98,7 +99,7 @@ class Controller(object): self.interval = interval if gen_data: self.data_timer = Timer(interval, self.write_data, recurring=True) - self.growth_timer = Timer(interval, self.detect_growth, recurring=True) + self.growth_timer = Timer(interval, self.reset_growth, recurring=True) self.clean_interval = clean_interval self.clean_timer = Timer(clean_interval, self.clean_flows, recurring=True) self.detect = detect @@ -191,7 +192,7 @@ class Controller(object): len(self.growing_ports) / self.interval, ] - def detect_growth(self): + def reset_growth(self): ''' Reset variables for detecting growth of them ''' @@ -219,7 +220,7 @@ class Controller(object): del_indices = [] for flow in self.flows.values(): if (current_time - flow.time_last_used) > self.clean_interval: - del_indices.append(str(flow)) + del_indices.append(str(flow)) for del_index in del_indices: del self.flows[del_index]