This script adds an outbound block rule to your windows firewall. It uses the feodo tracker list that gets updated every 5 minutes.
Powershell needs to be run as admin:
py ip_blocker.py
This can be added as a Schedueled task on your Windows PC to periodically update your firewall settings.
You can also add this rule to the code to block inbound traffic:
...
if ip != "dst_ip":
print("Added Outbound Rule to block:", ip)
outbound_rule = "netsh advfirewall firewall add rule name='BadIP' Dir=Out Action=Block RemoteIP=" + ip
subprocess.run(["Powershell", "-Command", outbound_rule])
print("Added Inbound Rule to block:", ip)
inbound_rule = "netsh advfirewall firewall add rule name='BadIP' Dir=In Action=Block RemoteIP=" + ip
subprocess.run(["Powershell", "-Command", inbound_rule])
- Idea came from The PC Security Channel, but had some modification in the code, such as using the plain-text the website provides rather than csv.
- Feodo tracker list
- Thanks to Abuse for compiling this list.