Skip to content

Commit

Permalink
Merge pull request #167 from silversword411/main
Browse files Browse the repository at this point in the history
Adding option if PackageName specified with upgrade will only update …
  • Loading branch information
silversword411 authored Jul 17, 2023
2 parents 8221968 + a0e90f0 commit 9f6d14c
Show file tree
Hide file tree
Showing 2 changed files with 175 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/Win_Chocolatey_Manage_Apps_Bulk.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
.EXAMPLE
-Mode upgrade -Hosts 50
.EXAMPLE
-Mode upgrade -Hosts 50 -PackageName chocolatey
.EXAMPLE
-Mode uninstall -PackageName googlechrome
.NOTES
9/2021 v1 Initial release by @silversword411 and @bradhawkins
Expand Down Expand Up @@ -49,7 +51,12 @@ else {
if ($Mode -eq "upgrade") {
# Write-Output "Starting Upgrade"
Start-Sleep -Seconds $rnd;
choco upgrade -y all
if (!$PackageName) {
choco upgrade -y all
}
else {
choco upgrade $PackageName -y
}
# Write-Output "Running upgrade"
Exit 0
}
Expand Down
167 changes: 167 additions & 0 deletions scripts_wip/Win_SpywareKillerv1.2.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
<#
.SYNOPSIS
Spyware killer script
.DESCRIPTION
Death to all spyware! This scans for Wavebrowser and Onelaunch
.PARAMETER Days
The number of days to look back for installers in the Downloads folder. Default is 1000.
.PARAMETER Autodelete
Switch to enable or disable automatic deletion of installers found in the Downloads folder. When the switch is set, any matching files found will be automatically deleted without prompting. If the switch is not set, the files will not be deleted.
.PARAMETER Debug
Switch to enable or disable debug output. When the switch is set, debug output will be enabled.
.EXAMPLE
-Days 365 -Autodelete -Debug
This will run the script looking back 365 days in the Downloads folder, automatically delete any installers found, and enable debug output.
.EXAMPLE
-Days 180
This will run the script looking back 180 days in the Downloads folder, but won't delete any files or enable debug output.
.NOTES
v1.0 8/2022 silversword411
Initial release for Wavebrowser
v1.1 2/2023 silversword411
Added Onelaunch
v1.2 7/2023 silversword411
Refining, adding debug output, adding autodelete switch, reformatting outlook for easier reading
#>

param(
[Int]$Days = "1000",
[switch]$Autodelete,
[switch]$debug
)

# For setting debug output level. -debug switch will set $debug to true
if ($debug) {
$DebugPreference = "Continue"
}
else {
$DebugPreference = "SilentlyContinue"
$ErrorActionPreference = 'silentlycontinue'
}

[Int]$ErrorCount = 0

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

Write-Debug "Days to scan: $Days"
if (!$Autodelete) {
Write-Debug "Autodelete disabled"
}
else {
Write-Debug "Autodelete enabled"
}

$currentuser = ((Get-WMIObject -ClassName Win32_ComputerSystem).Username).Split('\')[1]

If (!$currentuser) {
Write-Error "Noone currently logged in. Quitting"
Exit 0
}
else {
Write-Debug "Currently logged in user is: $currentuser"
}

function Wavebrowser-Scan {
Write-Output ""
Write-Output "################### Scanning for Wavebrowser ##################"
$targetProgDir = "c:\users\$currentuser\Wavesor Software\"
$targetDir = "c:\users\$currentuser\Downloads\"
Write-Debug "targetDir is $targetDir"
$pattern = "wave br*.exe"

# Look for Wavebrowser installer in downloads folder
Write-Output "##########"
If (!(get-ChildItem $targetDir | Where-Object { ($_.name -like $pattern) -and ($_.CreationTime -gt (Get-Date).AddDays(-$Days)) })) {
Write-Output "No Wavebrowser installers in the downloads folder in the last $Days days"
}
else {
Write-Output "WARNING-WARNING-WARNING - WaveBrowser installer found in downloads folder!"
Get-ChildItem $targetDir | Where-Object { ($_.name -like $pattern) -and ($_.CreationTime -gt (Get-Date).AddDays(-$Days)) } | ForEach-Object {
if ($AutoDelete) {
$_ | Remove-Item -Confirm:$false
}
else {
Write-Output $_
}
}
$script:ErrorCount += 1
Write-Debug "ErrorCount increased. Total is $ErrorCount"
}

# Look for installed Wavebrowser
Write-Output "##########"
If (!(get-ChildItem $targetProgDir)) {
Write-Output "No installed Wavebrowser"
}
else {
Write-Output "WARNING - WaveBrowser was installed in c:\users\$currentuser\Wavesor Software\"
$dirdate = (Get-Item "c:\users\$currentuser\Wavesor Software\").CreationTime
Write-Debug "DirDate is $($dirdate)"
$script:ErrorCount += 1
Write-Debug "ErrorCount increased. Total is $ErrorCount"
}
}
Wavebrowser-Scan

function Onelaunch-Scan {
Write-Output ""
Write-Output "################### Scanning for Onelaunch ##################"
$targetProgDir = "c:\users\$currentuser\appdata\local\Onelaunch"
$targetDir = "c:\users\$currentuser\Downloads\"
Write-Debug "targetDir is $targetDir"
$pattern = "onelaunch*.exe"

# Look for Onelaunch installer in downloads folder
Write-Output "##########"
If (!(get-ChildItem $targetDir | Where-Object { ($_.name -like $pattern) -and ($_.CreationTime -gt (Get-Date).AddDays(-$Days)) })) {
Write-Output "No Onelaunch installers in the downloads folder in the last $Days days"
}
else {
Write-Output "WARNING-WARNING-WARNING - Onelaunch installer found in downloads folder!"
Get-ChildItem $targetDir | Where-Object { ($_.name -like $pattern) -and ($_.CreationTime -gt (Get-Date).AddDays(-$Days)) } | ForEach-Object {
if ($AutoDelete) {
$_ | Remove-Item -Confirm:$false
}
else {
Write-Output $_
}
}
$script:ErrorCount += 1
Write-Debug "ErrorCount increased. Total is $ErrorCount"
}

# Look for installed Onelaunch
Write-Output "##########"
If (!(get-ChildItem $targetProgDir)) {
Write-Output "No installed Onelaunch"
}
else {
Write-Output "WARNING - OneLaunch was installed in c:\users\$currentuser\appdata\local\Onelaunch"
$dirdate = (Get-Item "c:\users\$currentuser\appdata\local\Onelaunc").CreationTime
Write-Output "DirDate is $($dirdate)"
$script:ErrorCount += 1
Write-Debug "ErrorCount increased. Total is $ErrorCount"
}
}
Onelaunch-Scan

Write-Output ""
Write-Debug "Finished Tests"

if ($ErrorCount -gt 0) {
Write-Debug "Total ErrorCount is $ErrorCount. +1 for every detection."
Write-Output "Spyware was found. Take action."
Exit 1
}
else {
Write-Debug "Total ErrorCount is $ErrorCount."
Write-Output "No spyware detected"
Exit 0
}

0 comments on commit 9f6d14c

Please sign in to comment.