-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
57 lines (47 loc) · 2.05 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 23 12:24:18 2021
@author: eslam
"""
import netaddr
import csv
from DAAS import DAAS
from KiplingTrafficFlow import KiplingTrafficFlow
from StaticPolicyAgent import StaticPolicyAgent
from SecurityFeeds import SecurityFeeds
from MLPolicies import MLPolicies
from DataCleaning import DataCleaning
if __name__ == "__main__":
rawFileName = "RawStaticPolicyAgentPolicies - Copy.csv"
policiesFileName = "StaticPolicyAgentPolicies - Copy.csv"
testingPoliciesFileName = "TestingPolicies - Copy.csv"
securityFeedsFileName = "SecurityFeeds - Copy.csv"
MLpoliciesFileName = "StaticPolicyAgentPolicies - Copy.csv"
# rawFileName = "RawStaticPolicyAgentPolicies.csv"
# policiesFileName = "StaticPolicyAgentPolicies.csv"
# testingPoliciesFileName = "TestingPolicies.csv"
# securityFeedsFileName = "SecurityFeeds.csv"
# MLpoliciesFileName = "StaticPolicyAgentPolicies.csv"
# Data cleaning
data = DataCleaning(rawFileName, policiesFileName)
# Read Cleaned Policies
with open(testingPoliciesFileName) as f:
testingDict = [{k: v for k, v in row.items()}
for row in csv.DictReader(f, skipinitialspace=True)]
# Static Policies
print("Static Policies Action")
policy = StaticPolicyAgent()
for flow in testingDict:
# print (flow)
policyFlow = KiplingTrafficFlow(flow)
print (policy.validateFlow(policyFlow, policiesFileName = policiesFileName))
# Security Feeds
print("Security Feeds Action")
policy = SecurityFeeds()
for flow in testingDict:
policyFlow = KiplingTrafficFlow(flow)
print (policy.validateFlow(policyFlow, policiesFileName = securityFeedsFileName))
# Machine Learning Policies
print("Machine Learning Action")
policy = MLPolicies()
policy.validateFlow(testingPoliciesFileName = testingPoliciesFileName, policiesFileName = MLpoliciesFileName)