ddos-mlp-mitigation

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

commit 94eb6f3b6dd7df8c4540a2e6200d8fc531cf4f9d
parent 0c6854220f3f23f51bf0d4b59fc3aa8862a8b5f0
Author: Cody Lewis <cody@codymlewis.com>
Date:   Wed,  8 Apr 2020 20:22:26 +1000

No longer writes useless data

Diffstat:
Mnetwork_controller.py | 13+++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/network_controller.py b/network_controller.py @@ -203,12 +203,13 @@ class Controller(object): Write the current six-tuple and label to a data file ''' six_tuple = self.calc_tuple() - six_tuple.append(self.label) - LOG.debug("Writing some training data") - LOG.debug("Current tuple: %s", six_tuple) - with open("training_data.txt", "a") as f: - f.write(" ".join(map(str, six_tuple)) + "\n") - LOG.debug("Written.") + if six_tuple != [0 for _ in range(6)]: + six_tuple.append(self.label) + LOG.debug("Writing some training data") + LOG.debug("Current tuple: %s", six_tuple) + with open("training_data.txt", "a") as f: + f.write(" ".join(map(str, six_tuple)) + "\n") + LOG.debug("Written.") def clean_flows(self): '''