Rename functions fot better lisibility

This commit is contained in:
Yorick Barbanneau 2017-01-06 12:08:42 +01:00
parent 57aefd5294
commit c4698b67dc

View file

@ -6,7 +6,7 @@ $HOST_IP = "0.0.0.0"
$ErrorActionPreference = "SilentlyContinue" $ErrorActionPreference = "SilentlyContinue"
#Thanks to https://gist.github.com/markembling/173887 #Thanks to https://gist.github.com/markembling/173887
function blockShittyHost { function block_shitty_host {
param([string]$filename, [string]$ip, [string]$hostname) param([string]$filename, [string]$ip, [string]$hostname)
remove-host $filename $hostname remove-host $filename $hostname
Write-Host -NoNewline -ForegroundColor White "Block shitty host $hostname" Write-Host -NoNewline -ForegroundColor White "Block shitty host $hostname"
@ -38,7 +38,7 @@ function is_host_present {
return $false return $false
} }
function remove_shittyTasks () { function remove_shitty_tasks () {
param($taskList) param($taskList)
Foreach ($task in $taskList){ Foreach ($task in $taskList){
Write-Host -ForegroundColor white -NoNewline "Remove Task " $task Write-Host -ForegroundColor white -NoNewline "Remove Task " $task
@ -65,7 +65,7 @@ function remove_shittyTasks () {
# path : the complete path to reg key # path : the complete path to reg key
# key : key name # key : key name
# value : The value to write # value : The value to write
function modifyShittyRegValue { function modify_shitty_reg_value {
param([string]$path, [string]$key, [string]$value, [string]$type) param([string]$path, [string]$key, [string]$value, [string]$type)
Write-Host -ForegroundColor white -NoNewline "Modify $key reg value to $value :" Write-Host -ForegroundColor white -NoNewline "Modify $key reg value to $value :"
if (!(Test-Path $path)){ if (!(Test-Path $path)){
@ -96,7 +96,7 @@ function modifyShittyRegValue {
# Function to remove shitty prog from shitty win # Function to remove shitty prog from shitty win
# Params : # Params :
# $name : Feature name # $name : Feature name
function disableShitty { function disable_shitty_feature {
param ($name) param ($name)
Write-Host -NoNewline -ForegroundColor White "Disable $name feature :" Write-Host -NoNewline -ForegroundColor White "Disable $name feature :"
$requestInstall = dism /online /Get-FeatureInfo /FeatureName:$name /English $requestInstall = dism /online /Get-FeatureInfo /FeatureName:$name /English
@ -119,7 +119,7 @@ function disableShitty {
# disable "Modern App" # disable "Modern App"
# Params # Params
# $name : Name of modern app # $name : Name of modern app
function disableModernShitty { function disable_shitty_modern_app {
param([string]$name) param([string]$name)
Write-Host -ForegroundColor white -NoNewline "Remove $name modern app" Write-Host -ForegroundColor white -NoNewline "Remove $name modern app"
try { try {
@ -136,7 +136,7 @@ function disableModernShitty {
Write-Host -ForegroundColor Green " Done " Write-Host -ForegroundColor Green " Done "
} }
function disable_ShittyService ([string]$name){ function disable_shitty_service ([string]$name){
Write-Host -ForegroundColor White -NoNewline "Disable service $name :" Write-Host -ForegroundColor White -NoNewline "Disable service $name :"
$serv = Get-Service -name $name $serv = Get-Service -name $name
if ( !$serv) { if ( !$serv) {
@ -158,7 +158,7 @@ Write-Output "________________________________________"
write-Output "" write-Output ""
foreach ($line in Get-Content "lib\hosts.txt"){ foreach ($line in Get-Content "lib\hosts.txt"){
blockShittyHost $HOST_FILE $HOST_IP $line block_shitty_host $HOST_FILE $HOST_IP $line
} }
foreach ($line in Get-Content "lib\ip.txt"){ foreach ($line in Get-Content "lib\ip.txt"){
@ -167,29 +167,29 @@ foreach ($line in Get-Content "lib\ip.txt"){
} }
foreach ($line in Get-Content "lib\features.txt"){ foreach ($line in Get-Content "lib\features.txt"){
disableShitty $line disable_shitty_feature $line
} }
foreach ($line in Get-Content "lib\services.txt") { disableShittyService $line } foreach ($line in Get-Content "lib\services.txt") { disable_shitty_featureService $line }
foreach ($line in Get-Content "lib\apps.txt") { disableModernShitty $line } foreach ($line in Get-Content "lib\apps.txt") { disable_shitty_modern_app $line }
foreach ($line in Get-Content "lib\tasks.txt") {remove_shittyTasks $line } foreach ($line in Get-Content "lib\tasks.txt") {remove_shitty_tasks $line }
# AllowTelemetry # AllowTelemetry
modifyShittyRegValue "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" "AllowTelemetry" "0" modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" "AllowTelemetry" "0"
# Windows Defender Delivery Optimization Download # Windows Defender Delivery Optimization Download
modifyShittyRegValue "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" "DODownloadMode" "0" modify_shitty_reg_value "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" "DODownloadMode" "0"
# WifiSense Credential Share # WifiSense Credential Share
modifyShittyRegValue "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\features" "WiFiSenseCredShared" "0" modify_shitty_reg_value "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\features" "WiFiSenseCredShared" "0"
# WifiSense Open-ness # WifiSense Open-ness
modifyShittyRegValue "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\features" "WiFiSenseOpen" "0" modify_shitty_reg_value "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\features" "WiFiSenseOpen" "0"
# Windows Defender Spynet # Windows Defender Spynet
modifyShittyRegValue "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" "SpynetReporting" "0" "Dword" modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" "SpynetReporting" "0" "Dword"
# Windows Defender Sample Submission # Windows Defender Sample Submission
modifyShittyRegValue "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" "SubmitSamplesConsent" "2" "Dword" modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" "SubmitSamplesConsent" "2" "Dword"
# Disable Cortana # Disable Cortana
modifyShittyRegValue "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search\" "AllowCortana" "0" "Dword" modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search\" "AllowCortana" "0" "Dword"