Project Name: ip_filter_tool.py
A Python-based script that enforces network access control by maintaining an allow-list of authorized IP addresses. Built as part of the Google Cybersecurity Certificate portfolio to demonstrate applied scripting in real-world data security scenarios.
This security tool automates the process of updating an IP address allow-list to ensure only authorized employees have network access to sensitive patient records. It minimizes human error by programmatically removing known unauthorized IP addresses while preserving legitimate ones.
- Safe file operations using
with open()(ensures automatic file closure) - Defensive programming via least privilege access (read/write separation)
- String parsing and list transformations (
.read(),.split(),.join()) - Conditional filtering and controlled list mutation (
for+if+.remove()) - Basic data sanitation (manual detection of malformed/duplicate entries—optional future upgrade)
- Reads a plaintext file named
allow_list.txtcontaining IP addresses separated by spaces. - Splits the string into a Python list of IPs.
- Iterates through the list and removes any IPs found in a predefined
remove_list. - Rewrites the sanitized list back into the original file.
1. Clone Repository
bash
git clone https://github.com/codebyangelo/ip-filter-tool.git cd ip-filter-tool
2. Prepare your allow_list.txt file
192.168.97.225 192.168.1.10 192.168.158.170 10.0.0.25 999.999.999.999 192.168.201.40 192.168.58.57 172.16.0.5 192.168.0.100
3. Run the Script
Make sure you have Python 3.x installed, then:
bash
python ip_filter_tool.py
| File Name | Description |
|---|---|
ip_filter_tool.py |
Python script implementing the filter logic |
allow_list.txt |
List of authorized IPs (user-editable) |
README.md |
Documentation for project and portfolio use |
- Duplicate IP entries in
remove_listrequire the script to run more than once to fully sanitize. This is a known limitation and can be enhanced using list comprehension or auxiliary filtering logic in future iterations. - Malformed IPs (e.g.,
999.999.999.999) are not filtered unless explicitly added to theremove_list. Format validation is intentionally omitted for this first build to maintain clarity and scope control.
- Implement duplicate-safe filtering using list comprehension or
filter() - Add optional IP format validation using regex or built-in
ipaddressmodule - Modularize logging for audit trails
- Expand to CSV or config-file support for enterprise-scale lists
This project was developed as part of the Google Cybersecurity Certificate. It reflects hands-on understanding of basic scripting, secure automation practices, and file-level access control. Demonstrating readiness for real-world infosec tasks.
Author: Angelo Ayton