Skip to main content

Block / unblock ips using the Windows Firewall

Project description

Block / unblock ips using the Windows Firewall

Tested against Windows 10 / Python 3.11 / Anaconda

pip install blockunblockips

from blockunblockips import unblock_out, unblock_in, block_out, block_in

# Example 1: Unblock outgoing traffic to a specific IP address
ip_to_unblock = "192.168.1.100"
unblock_out(ip_to_unblock)
# This will delete a Windows Firewall rule that allows outgoing traffic to IP 192.168.1.100.

# Example 2: Unblock incoming traffic from a specific IP address
ip_to_unblock = "10.0.0.5"
unblock_in(ip_to_unblock)
# This will delete a Windows Firewall rule that allows incoming traffic from IP 10.0.0.5.

# Example 3: Block outgoing traffic to a specific IP address
ip_to_block = "203.0.113.25"
block_out(ip_to_block)
# This will create a Windows Firewall rule to block outgoing traffic to IP 203.0.113.25.

# Example 4: Block incoming traffic from a specific IP address
ip_to_block = "172.16.0.50"
block_in(ip_to_block)
# This will create a Windows Firewall rule to block incoming traffic from IP 172.16.0.50.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blockunblockips-0.10.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

blockunblockips-0.10-py3-none-any.whl (5.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page