Ultimate.Hosts.Blacklist
Ultimate.Hosts.Blacklist copied to clipboard
Windows deny file
You can use powershell to import and create a rule to block the IPs.
https://portal.databasemart.com/kb/a327/how-to-block-ip-in-windows-firewall.aspx
Do you know if this is possible on home/pro as well or only in the server versions?
I tested this on both Home and Pro using the powershell version and it works. Using the old netsh doesn't work since it doesn't support variables. There is a caveat though and that is the text file lines have to be in CIDR format, 192.168.0.0/22 etc and only works as admin.
$IP = get-content c:\temp\ip.txt New-NetFirewallRule -DisplayName "_Block Rule" -Direction Inbound –LocalPort Any -Protocol TCP -Action Block -RemoteAddress $IP
Cool, have you tested it with IPv6 too?
This would require yet another output format....
I can test that tonight.
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10
From: spirillen [email protected] Sent: Tuesday, May 5, 2020 1:34:14 PM To: mitchellkrogza/Ultimate.Hosts.Blacklist [email protected] Cc: xbbdc [email protected]; Assign [email protected] Subject: Re: [mitchellkrogza/Ultimate.Hosts.Blacklist] Windows deny file (#576)
Cool, have you tested it with IPv6 too?
This would require yet another output format....
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHubhttps://github.com/mitchellkrogza/Ultimate.Hosts.Blacklist/issues/576#issuecomment-624262229, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOIJZQG4RG2BUGP4WO22Y43RQBS3NANCNFSM4MJATDRA.
Would be great :+1:
Hey there sorry for the delay. It would be the same command and you can use the same text file, it just has to be in one of these formats:
https://docs.microsoft.com/en-us/powershell/module/netsecurity/new-netfirewallrule?view=win10-ps#parameters Single IPv4 Address: 1.2.3.4 Single IPv6 Address: fe80::1 IPv4 Subnet (by network bit count): 1.2.3.4/24 IPv6 Subnet (by network bit count): fe80::1/48 IPv4 Subnet (by network mask): 1.2.3.4/255.255.255.0 IPv4 Range: 1.2.3.4-1.2.3.7 IPv6 Range: fe80::1-fe80::9
If I put these in a text file and changing one example of the subnet by network mask:
1.2.3.4 fe80::1 1.2.3.4/24 fe80::1/48 2.3.4.5/255.255.255.0 1.2.3.4-1.2.3.7 fe80::1-fe80::9
I can run this command:
$IP = get-content c:\temp\ip.txt New-NetFirewallRule -DisplayName "_Block Rule-example" -Direction Inbound –LocalPort Any -Protocol TCP -Action Block -RemoteAddress $IP
I get the following output showing me they've all been added:
$FormatEnumerationLimit =-1 Get-NetFirewallRule -DisplayName "_Block Rule-example" | Get-NetFirewallAddressFilter
LocalAddress : Any RemoteAddress : {1.2.3.4-1.2.3.7, 1.2.3.0/255.255.255.0, 2.3.4.0/255.255.255.0, 1.2.3.4, fe80::1, fe80::1-fe80::9, fe80::1/48}
Use this topic to help manage Windows and Windows Server technologies with Windows PowerShell.
Hey @xbbdc would you be up for writing a little wiki or blog(howto) on this at my site?
wiki https://www.mypdns.org/w/
blog https://www.mypdns.org/phame/
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Thanks @stalebot but I want to keep this open for information!
Hey, i have made a PowerShell script that does exactly that. It can take the enormous list file from Ultimate.Hosts.Blacklist IPs. It adds multiple block rules in the windows firewall. https://github.com/MdeeDev/firewall-IpBlockList
Hey, i have made a PowerShell script that does exactly that. It can take the enormous list file from Ultimate.Hosts.Blacklist IPs. It adds multiple block rules in the windows firewall. https://github.com/MdeeDev/firewall-IpBlockList
Do it also cleanup old records on each run?
Hey, i have made a PowerShell script that does exactly that. It can take the enormous list file from Ultimate.Hosts.Blacklist IPs. It adds multiple block rules in the windows firewall. https://github.com/MdeeDev/firewall-IpBlockList
Do it also cleanup old records on each run?
Yes , there is an "Update" option. As long as you provide it with the correct firewall rule name.