Compare commits

..

No commits in common. "a4df335b4924e2e408f043cc2291a982ade8ce20" and "9cd6d3a7f531f00f430a6bfb0794f63af04dcb72" have entirely different histories.

7 changed files with 33 additions and 24 deletions

View file

@ -26,10 +26,7 @@ function BlockHost {
[object]$params [object]$params
) )
if ( $params.ContainsKey('file') ) { if ( $params.ContainsKey('file') ) {
if ( -not $params.ContainsKey('firewall') -or $params.firewall -eq "" ) { Foreach ($line in Get-Content $params.file ){ BlockHost -params @{host=$line;firewall=$params.firewall} }
$params.firewall = $false
}
Get-Content $params.file | where { $_ -notmatch "^#.*$|^$" } | Foreach{ BlockHost -params @{host=$_;firewall=$params.firewall} }
} }
elseif ( $params.ContainsKey('host') -and $params.host -ne "" ) { elseif ( $params.ContainsKey('host') -and $params.host -ne "" ) {
Write-Host "`n`tBlock host $($params.host) : " Write-Host "`n`tBlock host $($params.host) : "
@ -66,15 +63,14 @@ function BlockHostByIP {
param( param(
[string]$hostname [string]$hostname
) )
#$resolv = [system.net.Dns]::GetHostAddresses($hostname) | Select IPAddressToString $resolv = Resolve-DnsName $hostname -ErrorAction SilentlyContinue | select Address,Type | Where { $_.type -match "^A{1,4}$" }
$resolv = Resolve-DnsName $hostname -ErrorAction SilentlyContinue | Where { $_.type -match "^A{1,4}$" } | select Address
$resolv | Foreach { $resolv | Foreach {
Write-Host -NoNewLine "`t" Write-Host -NoNewLine "`t`t"
if ($_.Address -match $IP4_REGEX ) { Write-Debug "Found a valid IPv4 $($_.Address)" }
$ip = $_.Address $ip = $_.Address
Write-Debug "Found a valid IP $ip"
$rule = Get-NetFirewallAddressFilter | Where-Object { $_.RemoteAddress -eq $ip } | Get-NetFirewallRule $rule = Get-NetFirewallAddressFilter | Where-Object { $_.RemoteAddress -eq $ip } | Get-NetFirewallRule
if ( $rule ) { if ( $rule ) {
write-host -NoNewLine "`tFW Rule exist : " write-host -NoNewLine "FW Rule exist : "
write-host -ForegroundColor yellow $rule.name write-host -ForegroundColor yellow $rule.name
} }
else { else {
@ -111,10 +107,9 @@ function FwBlockOutputIP {
$name = $FW_RULE_NAME_PREFIX + "_IP_" + $params.name + "-" + $params.ip $name = $FW_RULE_NAME_PREFIX + "_IP_" + $params.name + "-" + $params.ip
} }
Write-Host -NoNewline "`tAdd FW IP rule $name ($($params.ip)) : " Write-Host -NoNewline "`tAdd FW IP rule $name ($($params.ip)) : "
$rule = Get-NetFirewallAddressFilter | Where-Object { $_.RemoteAddress -eq $params.ip } | Get-NetFirewallRule if ( Get-NetFirewallRule -Name $name -ErrorAction SilentlyContinue) {
if ( $rule ) { Write-Host -ForegroundColor Yellow "already exist"
write-host -NoNewLine " exist : " return
write-host -ForegroundColor yellow $rule.name
} }
else { else {
Try { Try {

View file

@ -10,7 +10,7 @@
}, },
{ {
"action" : "BlockHost", "action" : "BlockHost",
"file" : "ms-skype-messenger.txt" "file" : "ms-skype-messeger.txt"
} }
] ]
} }

View file

@ -29,6 +29,7 @@ a23-67-60-97.deploy.static.akamaitechnologies.com
a23-9-123-27.deploy.static.akamaitechnologies.com a23-9-123-27.deploy.static.akamaitechnologies.com
a569.g.akamai.net a569.g.akamai.net
activity.windows.com activity.windows.com
ad.doubleclick.net
ads.msn.com ads.msn.com
ads.msn.com.nsatc.net ads.msn.com.nsatc.net
ads1.msads.net ads1.msads.net
@ -65,10 +66,7 @@ e2236.g.akamaiedge.net
e7173.g.akamaiedge.net e7173.g.akamaiedge.net
e8011.g.akamaiedge.net e8011.g.akamaiedge.net
fe1.update.microsoft.com.akadns.net fe1.update.microsoft.com.akadns.net
fe2.update.microsoft.com.akadns.net
#Problem with windows update
#fe2.update.microsoft.com.akadns.net
fe3.delivery.dsp.mp.microsoft.com.nsatc.net fe3.delivery.dsp.mp.microsoft.com.nsatc.net
feedback.microsoft-hohm.com feedback.microsoft-hohm.com
feedback.search.microsoft.com feedback.search.microsoft.com
@ -140,11 +138,13 @@ survey.watson.microsoft.com
t.urs.microsoft.com.nsatc.net t.urs.microsoft.com.nsatc.net
telecommand.telemetry.microsoft.com telecommand.telemetry.microsoft.com
telemetry.appex.bing.net telemetry.appex.bing.net
telemetry.appex.bing.net:443
telemetry.appex.search.prod.ms.akadns.net telemetry.appex.search.prod.ms.akadns.net
telemetry.microsoft.com telemetry.microsoft.com
telemetry.urs.microsoft.com telemetry.urs.microsoft.com
tunnel.cfw.trustedsource.org tunnel.cfw.trustedsource.org
uci.officeapps.live.com uci.officeapps.live.com
updatekeepalive.mcafee.com
urs.smartscreen.microsoft.com urs.smartscreen.microsoft.com
v10.vortex-win.data.microsoft.com v10.vortex-win.data.microsoft.com
vortex-sandbox.data.glbdns2.microsoft.com vortex-sandbox.data.glbdns2.microsoft.com

View file

@ -0,0 +1,2 @@
su3.mcafee.com
sm.mcafee.com

View file

@ -17,6 +17,7 @@ live.rads.msn.com
m.hotmail.com m.hotmail.com
mscrl.microsoft.com mscrl.microsoft.com
msnbot-65-55-108-23.search.msn.com msnbot-65-55-108-23.search.msn.com
preview.msn.com
rad.live.com rad.live.com
rad.msn.com rad.msn.com
rpt.msn.com rpt.msn.com

View file

@ -27,3 +27,9 @@
157.56.123.82 157.56.123.82
157.56.114.104 157.56.114.104
157.56.194.24 157.56.194.24
207.46.11.252
207.46.194.8
207.46.194.10
207.46.194.14
207.46.194.25
207.46.194.33

View file

@ -325,6 +325,11 @@
204.79.197.213 204.79.197.213
207.123.34.126 207.123.34.126
207.123.56.252 207.123.56.252
207.46.7.252
207.46.101.29
207.46.114.58
207.46.114.61
207.46.223.94
207.68.166.254 207.68.166.254
212.30.134.204 212.30.134.204
212.30.134.205 212.30.134.205
@ -344,7 +349,7 @@
195.138.255.0-195.138.255.255 195.138.255.0-195.138.255.255
213.199.179.0-213.199.179.255 213.199.179.0-213.199.179.255
191.232.139.2-191.232.139.255 191.232.139.2-191.232.139.255
23.55.155.27 =23.55.155.27
23.214.171.90 23.214.171.90
64.4.11.25 64.4.11.25
65.52.100.46 65.52.100.46