Cyber security · GCSE · OCR J277 1.4.2, AQA 8525 3.6.3, Edexcel 1CP2 4.2.1 · about 15 min
Firewalls, anti-malware, access levels, updates, backups, penetration testing and policies.
[1 mark]What does a firewall do?
[1 mark]What is penetration testing?
[1 mark]Why are user access levels useful?
[1 mark]Why do automatic updates help security?
[1 mark]What is a network policy?
Complete the firewall. For each packet in packets (an address and a port), check the rules in order and take the action of the first rule that matches. A rule matches if its port is any or equals the packet's port, and its address is any or equals the packet's address. Print <address>:<port> -> allow or -> block, and at the end print blocked <n> of <total>.
# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()
# each rule: (action, address, port). First match wins.
rules = [
("allow", "10.0.0.9", 22),
("block", "any", 22),
("allow", "any", 443),
("allow", "any", 80),
("block", "any", "any"),
]
# each packet: (address, port)
packets = [("10.0.0.9", 22), ("10.0.0.5", 22), ("10.0.0.5", 443), ("10.0.0.2", 8080), ("10.0.0.5", 80)]Plan your program here, then type it in and press Run.