The solution is implemented using python3.
firewall.py: implements the solution using dataframe for rules.
firewall_approach2.py: implements the solution using a static dictionary for saving rules. This will reduce the search time but is not dynamic for protocols.
pandas (>= 0.25.1)
pip install pandas
python3 firewall.py
python3 firewall_approach2.py
Rules file path: Enter full path to csv file containing rules (eg path\\to\\file\\networkrules.csv).
If not entered, it is defaulted to networkrules.csv file in the same folder
direction: Enter packet direction ("inbound" or "outbound")
protocol: Enter packet protocol ("tcp" or "udp")
port: Enter port (integer in range [1, 65535])
ip: Enter ip address (IPv4 address)
Returns boolean value. True if packet satisfies any of the rules; False otherwise.
The code is tested against the given test inputs.
I would like to join any of the 3 teams in the preference order - platform team, policy team, data team.