diff --git a/login_dashboard/INSTALL.cmd b/login_dashboard/INSTALL.cmd new file mode 100644 index 0000000..02ad495 --- /dev/null +++ b/login_dashboard/INSTALL.cmd @@ -0,0 +1,7 @@ +@echo off +cd /d "%~dp0" +echo Run this CMD file as Administrator (right-click - Run as administrator) +echo. +powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0Install-LoginDashboard.ps1" +echo. +pause diff --git a/login_dashboard/Install-LoginDashboard.ps1 b/login_dashboard/Install-LoginDashboard.ps1 new file mode 100644 index 0000000..ae681fd --- /dev/null +++ b/login_dashboard/Install-LoginDashboard.ps1 @@ -0,0 +1,27 @@ +#Requires -RunAsAdministrator +<# + Installs a scheduled task: at every logon, opens a console with Show-LoginDashboard.ps1 + Run this script once as Administrator (right-click → Run with PowerShell as admin). +#> +$ErrorActionPreference = 'Stop' +$here = Split-Path -Parent $MyInvocation.MyCommand.Path +$scriptPath = Join-Path $here 'Show-LoginDashboard.ps1' +if (-not (Test-Path $scriptPath)) { + Write-Error "Missing: $scriptPath" + exit 1 +} + +$taskName = 'LoginSiteDashboard' +$ps = Join-Path $env:WINDIR 'System32\WindowsPowerShell\v1.0\powershell.exe' +$args = "-NoProfile -ExecutionPolicy Bypass -NoExit -File `"$scriptPath`"" + +Unregister-ScheduledTask -TaskName $taskName -Confirm:$false -ErrorAction SilentlyContinue + +$action = New-ScheduledTaskAction -Execute $ps -Argument $args +$trigger = New-ScheduledTaskTrigger -AtLogOn -User $env:USERNAME +$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable +$principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -LogonType Interactive -RunLevel Limited + +Register-ScheduledTask -TaskName $taskName -Action $action -Trigger $trigger -Settings $settings -Principal $principal | Out-Null +Write-Host "OK: Task '$taskName' registered for user $env:USERNAME at logon." -ForegroundColor Green +Write-Host "Log off and back on, or run: Start-ScheduledTask -TaskName '$taskName'" -ForegroundColor Cyan diff --git a/login_dashboard/README.txt b/login_dashboard/README.txt new file mode 100644 index 0000000..27a0127 --- /dev/null +++ b/login_dashboard/README.txt @@ -0,0 +1,36 @@ +Login Site Dashboard +==================== + +What it does +------------ +When you log into Windows, a console window opens showing: + - Uptime, RAM, system disk free space + - All TCP listening ports with process name (your local "sites", APIs, dev servers) + - Common dev ports (80, 443, 3000, 8080, ...) listed first + - IIS web sites (if IIS is installed) + - Docker containers (if Docker is installed) + +Install (run once as Administrator) +----------------------------------- + Right-click PowerShell -> Run as administrator, then: + + Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned -Force + cd "C:\Users\drjones\ProxyChainManager\login_dashboard" + .\Install-LoginDashboard.ps1 + +Test without re-login +--------------------- + powershell -NoProfile -ExecutionPolicy Bypass -File ".\Show-LoginDashboard.ps1" + + Or trigger the task: + Start-ScheduledTask -TaskName LoginSiteDashboard + +Uninstall +--------- + Run as admin: .\Uninstall-LoginDashboard.ps1 + +Notes +----- + - The window stays open until you close it (-NoExit). + - Some info needs admin for full detail; basic listener list works as normal user. + - Edit Show-LoginDashboard.ps1 to add more stats or change colors. diff --git a/login_dashboard/Show-LoginDashboard.ps1 b/login_dashboard/Show-LoginDashboard.ps1 new file mode 100644 index 0000000..bdf6fd2 --- /dev/null +++ b/login_dashboard/Show-LoginDashboard.ps1 @@ -0,0 +1,125 @@ +#Requires -Version 5.1 +<# + Login dashboard: listening ports (your "sites"), IIS, Docker, quick stats. + Window stays open (-NoExit) so you can read; close manually. +#> +$ErrorActionPreference = 'SilentlyContinue' +[Console]::OutputEncoding = [System.Text.Encoding]::UTF8 +try { + $Host.UI.RawUI.WindowTitle = 'Active sites / listeners - ' + $env:COMPUTERNAME + if ($Host.UI.RawUI.MaxWindowSize.Width -ge 120) { + $Host.UI.RawUI.BufferSize = New-Object Management.Automation.Host.Size(120, 3000) + $Host.UI.RawUI.WindowSize = New-Object Management.Automation.Host.Size(120, 42) + } +} catch {} + +function Write-Banner { + param([string]$Title, [string]$Color = 'Cyan') + Write-Host "" + Write-Host "=== $Title ===" -ForegroundColor $Color +} + +# --- Header --- +Write-Host "" +Write-Host " LOGIN DASHBOARD " -NoNewline -ForegroundColor Black -BackgroundColor Cyan +Write-Host " $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') " -ForegroundColor White -BackgroundColor DarkGray +$os = Get-CimInstance Win32_OperatingSystem +$boot = $os.LastBootUpTime +$up = (Get-Date) - $boot +Write-Host " Machine: " -NoNewline -ForegroundColor Gray +Write-Host "$env:COMPUTERNAME" -NoNewline -ForegroundColor White +Write-Host " User: " -NoNewline -ForegroundColor Gray +Write-Host "$env:USERNAME" -NoNewline -ForegroundColor White +Write-Host " Uptime: " -NoNewline -ForegroundColor Gray +Write-Host ("{0}d {1}h {2}m" -f $up.Days, $up.Hours, $up.Minutes) -ForegroundColor Yellow + +$cs = Get-CimInstance Win32_ComputerSystem +$totalGb = [math]::Round($cs.TotalPhysicalMemory / 1GB, 1) +$os2 = Get-CimInstance Win32_OperatingSystem +$freeGb = [math]::Round($os2.FreePhysicalMemory / 1024 / 1024, 1) +Write-Host " RAM: " -NoNewline -ForegroundColor Gray +Write-Host ("{0} GB free / {1} GB total" -f $freeGb, $totalGb) -ForegroundColor DarkGray + +$sysDrive = $env:SystemDrive + '\' +$disk = Get-CimInstance Win32_LogicalDisk -Filter "DeviceID='$($env:SystemDrive)'" +if ($disk) { + $freeDisk = [math]::Round($disk.FreeSpace / 1GB, 1) + $totalDisk = [math]::Round($disk.Size / 1GB, 1) + Write-Host " Disk $env:SystemDrive " -NoNewline -ForegroundColor Gray + Write-Host ("{0} GB free / {1} GB total" -f $freeDisk, $totalDisk) -ForegroundColor DarkGray +} + +# --- Listening TCP --- +Write-Banner -Title 'LISTENING TCP (local sites / APIs / services)' -Color Green +try { + $listen = @(Get-NetTCPConnection -State Listen -ErrorAction Stop) +} catch { + $listen = @() + Write-Host ' (Get-NetTCPConnection failed - try running as Administrator for full detail.)' -ForegroundColor Yellow +} + +$rows = foreach ($conn in $listen) { + $proc = Get-Process -Id $conn.OwningProcess -ErrorAction SilentlyContinue + $path = '' + try { + if ($proc -and $proc.Path) { $path = $proc.Path } + } catch {} + $pathShort = $path + if ($pathShort.Length -gt 55) { $pathShort = $pathShort.Substring(0, 52) + '...' } + [PSCustomObject]@{ + Address = $conn.LocalAddress + Port = $conn.LocalPort + PID = $conn.OwningProcess + Process = if ($proc) { $proc.ProcessName } else { '?' } + Path = $pathShort + } +} + +$common = @(80, 81, 443, 3000, 3001, 4200, 5000, 5001, 5173, 5432, 6379, 8000, 8080, 8443, 8888, 9000, 18888) +$highlight = $rows | Where-Object { $_.Port -in $common } | Sort-Object { [int]$_.Port } +$rest = $rows | Where-Object { $_.Port -notin $common } | Sort-Object { [int]$_.Port } + +if ($highlight) { + Write-Host ' Common dev / web ports:' -ForegroundColor Yellow + $highlight | Format-Table -AutoSize Address, Port, PID, Process +} +if ($rest) { + Write-Host ' All other listeners:' -ForegroundColor DarkGray + $rest | Format-Table -AutoSize Address, Port, PID, Process +} +if (-not $rows -or $rows.Count -eq 0) { + Write-Host ' No TCP listeners found (or query failed).' -ForegroundColor Yellow +} + +# --- IIS --- +Write-Banner -Title 'IIS WEB SITES (if installed)' -Color Magenta +if (Get-Command Get-Website -ErrorAction SilentlyContinue) { + try { + Import-Module WebAdministration -ErrorAction SilentlyContinue | Out-Null + Get-Website | Select-Object Name, State, PhysicalPath | + Format-Table -AutoSize -Wrap + } catch { + Write-Host (' IIS error: {0}' -f $_) -ForegroundColor DarkYellow + } +} else { + Write-Host ' IIS not installed or WebAdministration not available.' -ForegroundColor DarkGray +} + +# --- Docker --- +Write-Banner -Title 'DOCKER (running containers)' -Color Blue +if (Get-Command docker -ErrorAction SilentlyContinue) { + docker ps 2>$null + if ($LASTEXITCODE -ne 0) { + Write-Host ' (docker not running or daemon unreachable)' -ForegroundColor DarkGray + } +} else { + Write-Host ' Docker CLI not found.' -ForegroundColor DarkGray +} + +if (Get-NetTCPConnection -LocalPort 18888 -State Listen -ErrorAction SilentlyContinue) { + Write-Host ' * Port 18888 listening - likely Proxy Chain Manager (GOST).' -ForegroundColor DarkCyan +} + +Write-Host '' +Write-Host ' Pin this window or move to a second monitor. Close when done.' -ForegroundColor DarkGray +Write-Host '' diff --git a/login_dashboard/Uninstall-LoginDashboard.ps1 b/login_dashboard/Uninstall-LoginDashboard.ps1 new file mode 100644 index 0000000..3ac32a9 --- /dev/null +++ b/login_dashboard/Uninstall-LoginDashboard.ps1 @@ -0,0 +1,3 @@ +#Requires -RunAsAdministrator +Unregister-ScheduledTask -TaskName 'LoginSiteDashboard' -Confirm:$false -ErrorAction SilentlyContinue +Write-Host "Removed task LoginSiteDashboard (if it existed)." -ForegroundColor Green