Add function block_shitty_ip for better output
This commit is contained in:
parent
c4698b67dc
commit
0906839d29
1 changed files with 24 additions and 15 deletions
39
cleanW10.ps1
39
cleanW10.ps1
|
@ -38,6 +38,24 @@ function is_host_present {
|
||||||
return $false
|
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 () {
|
function remove_shitty_tasks () {
|
||||||
param($taskList)
|
param($taskList)
|
||||||
Foreach ($task in $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 "________________________________________"
|
||||||
write-Output ""
|
write-Output ""
|
||||||
|
|
||||||
foreach ($line in Get-Content "lib\hosts.txt"){
|
#foreach ($line in Get-Content "lib\hosts.txt"){ block_shitty_host $HOST_FILE $HOST_IP $line }
|
||||||
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\ip.txt"){
|
#foreach ($line in Get-Content "lib\apps.txt") { disable_shitty_modern_app $line }
|
||||||
New-NetFirewallRule -Name Blacklist_$line -DisplayName "BlackList $line" -Protocol any -Enabled True -Profile Any -RemoteAddress $line -Action Block | Out-Null
|
#foreach ($line in Get-Content "lib\tasks.txt") {remove_shitty_tasks $line }
|
||||||
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 }
|
|
||||||
|
|
||||||
# AllowTelemetry
|
# AllowTelemetry
|
||||||
modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" "AllowTelemetry" "0"
|
modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" "AllowTelemetry" "0"
|
||||||
|
|
Reference in a new issue