Skip to content

Instantly share code, notes, and snippets.

View ehindiayleau's full-sized avatar
☂️
I may be slow to respond.

Ehindiayleau ehindiayleau

☂️
I may be slow to respond.
  • EiuNET (Owner/Operator)
  • Everywhere and Nowhere
View GitHub Profile
@ehindiayleau
ehindiayleau / multiple_ip_to_fw_rule.bat
Last active June 3, 2024 23:33
Inject Multiple IP Addresses Into A Single Windows Firewall Rule With A Batch and Text File
@echo off
if "%1"=="list" (
netsh advfirewall firewall show rule multiple_ip_to_fw_rule | findstr RemoteIP
exit/b
)
netsh advfirewall firewall delete rule name="multiple_ip_to_fw_rule"
for /f %%i in (C:\PATH_TO_TEXT_FILE_WITH_IP_ADDRESSES\multiple_ip_to_fw_rule.txt) do (
netsh advfirewall firewall add rule name="multiple_ip_to_fw_rule" protocol=any dir=in action=block remoteip=%%i