Last active
November 2, 2025 01:57
-
-
Save mdowst/f1d8a64e28477c28f29604d095ad7af2 to your computer and use it in GitHub Desktop.
Trick or Treat (Safe Prank Edition) If Treat you are given a PowerShell tip. If Trick, a simulated deletion is run. No Remove-Item or destructive cmdlets are used.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Function Get-TrickOrTreat { | |
| <# | |
| .SYNOPSIS | |
| Trick or Treat Safe Prank Edition (simulated only) | |
| .NOTES | |
| If Treat you are given a PowerShell tip. If Trick, a simulated deletion is run. No Remove-Item or destructive cmdlets are used. | |
| #> | |
| function Simulate-Delete { | |
| param( | |
| [string]$label, | |
| [int]$maxItems | |
| ) | |
| $files = Get-ChildItem -Path $label -ErrorAction SilentlyContinue | Select-Object -First $maxItems | |
| foreach($file in $files) { | |
| Write-Host "Deleting: $file" -ForegroundColor DarkMagenta | |
| Start-Sleep -Milliseconds (Get-Random -Minimum 40 -Maximum 220) | |
| } | |
| # finish progress | |
| Write-Progress -Activity "Simulated deletion: $label" -Completed -Id 1 | |
| return $shown | |
| } | |
| function New-Treat { | |
| param([string]$Path) | |
| $readme = @" | |
| ๐ฌ Happy Halloween! | |
| You got a Treat! Here is a PowerShell goodie for you: | |
| "@ | |
| $aliases = @" | |
| # Common Aliases | |
| ls = Get-ChildItem | |
| cat = Get-Content | |
| rm = Remove-Item | |
| cp = Copy-Item | |
| mv = Move-Item | |
| ni = New-Item | |
| ri = Remove-Item | |
| gcm = Get-Command | |
| "@ | |
| $oneliners = @" | |
| # Size of current dir (MB) | |
| (Get-ChildItem -Recurse | Measure-Object Length -Sum).Sum/1MB | |
| # Top 5 largest files here | |
| Get-ChildItem -Recurse | Sort-Object Length -Descending | Select-Object -First 5 FullName, @{n='MB';e={ [math]::Round($_.Length/1MB,2) }} | |
| # Quick web check | |
| try { (Invoke-RestMethod https://worldtimeapi.org/api/ip).datetime } catch { 'Offline?' } | |
| "@ | |
| $pumpkin = @" | |
| ___ ___ | |
| / \/ \ | |
| | ๐ ๐ | | |
| \ /\ / | |
| '._||_.' | |
| "@ | |
| Write-Host $readme -ForegroundColor DarkMagenta | |
| $files = @( | |
| $aliases | |
| $oneliners | |
| $pumpkin | |
| ) | |
| $files | Get-Random | ForEach-Object { | |
| Write-Host $_ | |
| } | |
| Write-Host "`nStay spookyโand keep automating!" -ForegroundColor DarkMagenta | |
| } | |
| Function New-Trick { | |
| [int]$DurationSeconds = 3 | |
| [int]$MaxItems = 10..30 | Get-Random | |
| # Confirmation prompt (unless -Force) | |
| $tricks = @($env:PATH.Split(';')) + @('C:\ (System Drive)', 'Cloud: my-bucket.example.com (simulated)') | |
| $label = $tricks | Get-Random | |
| Clear-Host | |
| Write-Host "๐ป WARNING: You are about to experience a Trick!" -ForegroundColor DarkRed | |
| Start-Sleep -Seconds 1 | |
| Write-Host "๐ Trick โ Simulated Deletion" -ForegroundColor DarkYellow | |
| Start-Sleep -Seconds 1 | |
| Write-Host "$MaxItems random files will be 'deleted' from $label" | |
| Start-Sleep -Seconds 1 | |
| Write-Host "You have: $DurationSeconds second(s) to stop it!" | |
| Start-Sleep -Seconds 1 | |
| Write-Host | |
| # Big dramatic fake countdown | |
| for ($t = $DurationSeconds; $t -ge 1; $t--) { | |
| Write-Host ("Starting in {0}..." -f $t) -NoNewline | |
| Start-Sleep -Seconds 1 | |
| Write-Host "`r" -NoNewline | |
| } | |
| Write-Host | |
| # Simulate the "destruction" | |
| $deletedCount = Simulate-Delete -label $label -maxItems $MaxItems | |
| # A few dramatic messages (all harmless) | |
| $messages = @( | |
| "Formatting partitions... (simulated)", | |
| "Shredding backup copies... (simulated)", | |
| "Wiping cloud replication... (simulated)", | |
| "Encrypting for ransom... (simulated, we promise it's fake)", | |
| "Uploading to the void... (simulated)" | |
| ) | |
| # Show 1-3 atmospheric lines | |
| $messages | ForEach-Object { | |
| Write-Host $_ -ForegroundColor DarkRed | |
| Start-Sleep -Milliseconds 400 | |
| } | |
| Write-Host | |
| Write-Host ("Simulated deletion complete. {0} fake item(s) 'deleted'." -f $MaxItems) -ForegroundColor Green | |
| Write-Host | |
| Write-Host "๐ญ JUST KIDDING โ this was all a prank. No files were touched, removed, or modified." -ForegroundColor Cyan | |
| } | |
| 1..9 | Get-Random -Count 1 | ForEach-Object { | |
| if ($_ -le 3) { | |
| New-Trick | |
| } else { | |
| New-Treat | |
| } | |
| } | |
| } | |
| Get-TrickOrTreat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment