Add function block_shitty_ip for better output

This commit is contained in:
Yorick Barbanneau 2017-01-06 12:23:39 +01:00
parent c4698b67dc
commit 0906839d29

View file

@ -38,6 +38,24 @@ function is_host_present {
return $false
}
function block_shitty_ip {
param($ip)
Write-Host -ForegroundColor white -NoNewline "Blacklist IP $ip : "
if ( Get-NetFirewallRule -Name Blacklist_$ip) {
Write-Host -ForegroundColor Yellow "Already blacklisted"
return
}
else {
Try {
New-NetFirewallRule -Name Blacklist_$ip -DisplayName "BlackList $ip" -Protocol any -Enabled True -Profile Any -RemoteAddress $ip -Action Block | Out-Null
}
Catch {
Write-Host -Nonewline -ForegroundColor Red " Error "
return
}
}
}
function remove_shitty_tasks () {
param($taskList)
Foreach ($task in $taskList){
@ -157,21 +175,12 @@ Write-Output "I's time to kick ass and chew bubble gum"
Write-Output "________________________________________"
write-Output ""
foreach ($line in Get-Content "lib\hosts.txt"){
block_shitty_host $HOST_FILE $HOST_IP $line
}
foreach ($line in Get-Content "lib\ip.txt"){
New-NetFirewallRule -Name Blacklist_$line -DisplayName "BlackList $line" -Protocol any -Enabled True -Profile Any -RemoteAddress $line -Action Block | Out-Null
Write-Output "Shitty IP $_ banned."
}
foreach ($line in Get-Content "lib\features.txt"){
disable_shitty_feature $line
}
foreach ($line in Get-Content "lib\services.txt") { disable_shitty_featureService $line }
foreach ($line in Get-Content "lib\apps.txt") { disable_shitty_modern_app $line }
foreach ($line in Get-Content "lib\tasks.txt") {remove_shitty_tasks $line }
#foreach ($line in Get-Content "lib\hosts.txt"){ block_shitty_host $HOST_FILE $HOST_IP $line }
foreach ($line in Get-Content "lib\ip.txt"){ block_shitty_ip $line }
#foreach ($line in Get-Content "lib\features.txt"){ disable_shitty_feature $line }
#foreach ($line in Get-Content "lib\services.txt") { disable_shitty_featureService $line }
#foreach ($line in Get-Content "lib\apps.txt") { disable_shitty_modern_app $line }
#foreach ($line in Get-Content "lib\tasks.txt") {remove_shitty_tasks $line }
# AllowTelemetry
modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" "AllowTelemetry" "0"