This is a simple Python-based firewall simulator that randomly generates IP addresses within the 192.168.1.0/24 range and checks whether they are allowed or blocked based on predefined firewall rules.
-
Generates random IP addresses dynamically.
-
Uses predefined firewall rules to allow or block specific IPs.
-
Displays the result with color-coded output (
redfor blocked,greenfor allowed). -
Assigns a random process ID for each IP request.
Ensure you have Python installed along with the required dependencies:
pip install colorama termcolor
Run the script using:
python firewall_simulator.py
-
The script generates 20 random IP addresses in the
192.168.1.0/24subnet. -
It checks each IP against the predefined firewall rules.
-
If the IP is in the blocklist, it prints the result in red.
-
If the IP is not in the blocklist, it prints the result in green.
-
A random process ID is assigned for each request.
The firewall currently blocks the following IPs:
192.168.1.3
192.168.1.5
192.168.1.9
192.168.1.12
192.168.1.14
192.168.1.18
192.168.1.23
192.168.1.35
Any other IPs are allowed by default.
IP: 192.168.1.7, Action: Allow, ProcessID: 3452 (Green)
IP: 192.168.1.5, Action: Block, ProcessID: 8723 (Red)
...
This project was created following a tutorial by faanross. I'll soon be making my own contributions to it ;)
This project is for educational purposes and is released under the MIT License.