- May
- 13,199
- 180
I have this alias.
If, for example, I do
the firewall rule gets the name "103.0.0.0" and the remoteip "103.0.0.0/8". Both are understandable; %1 is "103.0.0.0" and %2, which is "/8", is appended to the end.
I also have this plugin function.
Here's the strange part. If I
the resulting firewall rules have names with the full string (e.g, "58.0.0.0/7").
What's the difference. Here's an actual comparison.
Code:
v:\> alias ipblock
netsh advfirewall firewall add rule name=aablock_%1 dir=in action=block enable=yes localip=any remoteip=%1
If, for example, I do
Code:
ipblock 103.0.0.0/8
I also have this plugin function.
Code:
v:\> echo %@IPTOCIDR[58.0.0.0,61.255.255.255]
58.0.0.0/7 60.0.0.0/7
Here's the strange part. If I
Code:
do ip in /L %@IPTOCIDR[58.0.0.0,61.255.255.255] ( ipblock %ip )
What's the difference. Here's an actual comparison.
Code:
v:\> ipblock 14.0.0.0/8
Ok.
v:\> netsh advfirewall firewall show rule name=aablock_14.0.0.0/8
No rules match the specified criteria.
v:\> netsh advfirewall firewall show rule name=aablock_14.0.0.0 | grep Name
Rule Name: aablock_14.0.0.0
v:\> echo %@IPTOCIDR[14.0.0.0,14.255.255.255]
14.0.0.0/8
v:\> do ip in /L %@IPTOCIDR[14.0.0.0,14.255.255.255] ( ipblock %ip )
Ok.
v:\> netsh advfirewall firewall show rule name=aablock_14.0.0.0/8 | grep Name
Rule Name: aablock_14.0.0.0/8