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"
#Thanks to https://gist.github.com/markembling/173887
function blockShittyHost {
function block_shitty_host {
param([string]$filename, [string]$ip, [string]$hostname)
remove-host $filename $hostname
Write-Host -NoNewline -ForegroundColor White "Block shitty host $hostname"
@ -38,7 +38,7 @@ function is_host_present {
return $false
}
function remove_shittyTasks () {
function remove_shitty_tasks () {
param($taskList)
Foreach ($task in $taskList){
Write-Host -ForegroundColor white -NoNewline "Remove Task " $task
@ -65,7 +65,7 @@ function remove_shittyTasks () {
# path : the complete path to reg key
# key : key name
# value : The value to write
function modifyShittyRegValue {
function modify_shitty_reg_value {
param([string]$path, [string]$key, [string]$value, [string]$type)
Write-Host -ForegroundColor white -NoNewline "Modify $key reg value to $value :"
if (!(Test-Path $path)){
@ -96,7 +96,7 @@ function modifyShittyRegValue {
# Function to remove shitty prog from shitty win
# Params :
# $name : Feature name
function disableShitty {
function disable_shitty_feature {
param ($name)
Write-Host -NoNewline -ForegroundColor White "Disable $name feature :"
$requestInstall = dism /online /Get-FeatureInfo /FeatureName:$name /English
@ -119,7 +119,7 @@ function disableShitty {
# disable "Modern App"
# Params
# $name : Name of modern app
function disableModernShitty {
function disable_shitty_modern_app {
param([string]$name)
Write-Host -ForegroundColor white -NoNewline "Remove $name modern app"
try {
@ -136,7 +136,7 @@ function disableModernShitty {
Write-Host -ForegroundColor Green " Done "
}
function disable_ShittyService ([string]$name){
function disable_shitty_service ([string]$name){
Write-Host -ForegroundColor White -NoNewline "Disable service $name :"
$serv = Get-Service -name $name
if ( !$serv) {
@ -158,7 +158,7 @@ Write-Output "________________________________________"
write-Output ""
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"){
@ -167,29 +167,29 @@ foreach ($line in Get-Content "lib\ip.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\apps.txt") { disableModernShitty $line }
foreach ($line in Get-Content "lib\tasks.txt") {remove_shittyTasks $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
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
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
modifyShittyRegValue "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\features" "WiFiSenseCredShared" "0"
modify_shitty_reg_value "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\features" "WiFiSenseCredShared" "0"
# 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
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
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
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"