# IPmonitor Remote Agent (PowerShell) # Agent ID: default-agent | Targets: 253 | Generated: 2026-03-19 07:16:13 $AgentID = "default-agent" $ServerURL = "http://ipmonitor.us/api/ping-results" $LogFile = Join-Path $PSScriptRoot "ipmonitor-agent.log" $IPs = @( "10.9.21.10", "10.9.21.100", "10.9.21.101", "10.9.21.102", "10.9.21.103", "10.9.21.104", "10.9.21.105", "10.9.21.106", "10.9.21.107", "10.9.21.108", "10.9.21.109", "10.9.21.11", "10.9.21.110", "10.9.21.111", "10.9.21.112", "10.9.21.113", "10.9.21.114", "10.9.21.115", "10.9.21.116", "10.9.21.117", "10.9.21.118", "10.9.21.119", "10.9.21.12", "10.9.21.120", "10.9.21.121", "10.9.21.122", "10.9.21.123", "10.9.21.124", "10.9.21.125", "10.9.21.126", "10.9.21.127", "10.9.21.128", "10.9.21.129", "10.9.21.13", "10.9.21.130", "10.9.21.131", "10.9.21.132", "10.9.21.133", "10.9.21.134", "10.9.21.135", "10.9.21.136", "10.9.21.137", "10.9.21.138", "10.9.21.139", "10.9.21.14", "10.9.21.140", "10.9.21.141", "10.9.21.142", "10.9.21.143", "10.9.21.144", "10.9.21.145", "10.9.21.146", "10.9.21.147", "10.9.21.148", "10.9.21.149", "10.9.21.15", "10.9.21.150", "10.9.21.151", "10.9.21.152", "10.9.21.153", "10.9.21.154", "10.9.21.155", "10.9.21.156", "10.9.21.157", "10.9.21.158", "10.9.21.159", "10.9.21.16", "10.9.21.160", "10.9.21.161", "10.9.21.162", "10.9.21.163", "10.9.21.164", "10.9.21.165", "10.9.21.166", "10.9.21.167", "10.9.21.168", "10.9.21.169", "10.9.21.17", "10.9.21.170", "10.9.21.171", "10.9.21.172", "10.9.21.173", "10.9.21.174", "10.9.21.175", "10.9.21.176", "10.9.21.177", "10.9.21.178", "10.9.21.179", "10.9.21.18", "10.9.21.180", "10.9.21.181", "10.9.21.182", "10.9.21.183", "10.9.21.184", "10.9.21.185", "10.9.21.186", "10.9.21.187", "10.9.21.188", "10.9.21.189", "10.9.21.19", "10.9.21.190", "10.9.21.191", "10.9.21.192", "10.9.21.193", "10.9.21.194", "10.9.21.195", "10.9.21.196", "10.9.21.197", "10.9.21.198", "10.9.21.199", "10.9.21.2", "10.9.21.20", "10.9.21.200", "10.9.21.201", "10.9.21.202", "10.9.21.203", "10.9.21.204", "10.9.21.205", "10.9.21.206", "10.9.21.207", "10.9.21.208", "10.9.21.209", "10.9.21.21", "10.9.21.210", "10.9.21.211", "10.9.21.212", "10.9.21.213", "10.9.21.214", "10.9.21.215", "10.9.21.216", "10.9.21.217", "10.9.21.218", "10.9.21.219", "10.9.21.22", "10.9.21.220", "10.9.21.221", "10.9.21.222", "10.9.21.223", "10.9.21.224", "10.9.21.225", "10.9.21.226", "10.9.21.227", "10.9.21.228", "10.9.21.229", "10.9.21.23", "10.9.21.230", "10.9.21.231", "10.9.21.232", "10.9.21.233", "10.9.21.234", "10.9.21.235", "10.9.21.236", "10.9.21.237", "10.9.21.238", "10.9.21.239", "10.9.21.24", "10.9.21.240", "10.9.21.241", "10.9.21.242", "10.9.21.243", "10.9.21.244", "10.9.21.245", "10.9.21.246", "10.9.21.247", "10.9.21.248", "10.9.21.249", "10.9.21.25", "10.9.21.250", "10.9.21.251", "10.9.21.252", "10.9.21.253", "10.9.21.254", "10.9.21.26", "10.9.21.27", "10.9.21.28", "10.9.21.29", "10.9.21.3", "10.9.21.30", "10.9.21.31", "10.9.21.32", "10.9.21.33", "10.9.21.34", "10.9.21.35", "10.9.21.36", "10.9.21.37", "10.9.21.38", "10.9.21.39", "10.9.21.4", "10.9.21.40", "10.9.21.41", "10.9.21.42", "10.9.21.43", "10.9.21.44", "10.9.21.45", "10.9.21.46", "10.9.21.47", "10.9.21.48", "10.9.21.49", "10.9.21.5", "10.9.21.50", "10.9.21.51", "10.9.21.52", "10.9.21.53", "10.9.21.54", "10.9.21.55", "10.9.21.56", "10.9.21.57", "10.9.21.58", "10.9.21.59", "10.9.21.6", "10.9.21.60", "10.9.21.61", "10.9.21.62", "10.9.21.63", "10.9.21.64", "10.9.21.65", "10.9.21.66", "10.9.21.67", "10.9.21.68", "10.9.21.69", "10.9.21.7", "10.9.21.70", "10.9.21.71", "10.9.21.72", "10.9.21.73", "10.9.21.74", "10.9.21.75", "10.9.21.76", "10.9.21.77", "10.9.21.78", "10.9.21.79", "10.9.21.8", "10.9.21.80", "10.9.21.81", "10.9.21.82", "10.9.21.83", "10.9.21.84", "10.9.21.85", "10.9.21.86", "10.9.21.87", "10.9.21.88", "10.9.21.89", "10.9.21.9", "10.9.21.90", "10.9.21.91", "10.9.21.92", "10.9.21.93", "10.9.21.94", "10.9.21.95", "10.9.21.96", "10.9.21.97", "10.9.21.98", "10.9.21.99" ) function Write-Log($msg) { $line = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') $msg" Write-Host $line Add-Content -Path $LogFile -Value $line } # Detect corporate proxy $proxy = [System.Net.WebRequest]::GetSystemWebProxy().GetProxy($ServerURL) $proxyParams = @{} if ($proxy -and $proxy.AbsoluteUri -ne $ServerURL) { $proxyParams = @{ Proxy = $proxy; ProxyUseDefaultCredentials = $true } Write-Log "[INFO] Proxy detected: $proxy" } else { Write-Log "[INFO] Direct connection" } Write-Log "[START] Agent=$AgentID Targets=$($IPs.Count) Server=$ServerURL" $batch = 5 while ($true) { $buf = @() $total = 0; $totalUp = 0 foreach ($ip in $IPs) { try { $r = Test-Connection -ComputerName $ip -Count 1 -ErrorAction SilentlyContinue if ($r) { $buf += @{ ip = $ip; status = "UP"; latency_ms = $r.ResponseTime } } else { $buf += @{ ip = $ip; status = "DOWN"; latency_ms = 0 } } } catch { $buf += @{ ip = $ip; status = "DOWN"; latency_ms = 0 } } if ($buf.Count -ge $batch) { $up = ($buf | Where-Object { $_.status -eq "UP" }).Count $total += $buf.Count; $totalUp += $up $json = (@{ agent_id = $AgentID; timestamp = (Get-Date).ToString("o"); results = $buf } | ConvertTo-Json -Depth 5) try { Invoke-RestMethod -Uri $ServerURL -Method POST -Body $json -ContentType "application/json" -TimeoutSec 10 @proxyParams Write-Log "[OK] Batch=$($buf.Count) UP=$up DN=$($buf.Count - $up) Progress=$total/$($IPs.Count)" } catch { Write-Log "[FAIL] $($_.Exception.Message) Progress=$total/$($IPs.Count)" } $buf = @() } } # send remaining if ($buf.Count -gt 0) { $up = ($buf | Where-Object { $_.status -eq "UP" }).Count $total += $buf.Count; $totalUp += $up $json = (@{ agent_id = $AgentID; timestamp = (Get-Date).ToString("o"); results = $buf } | ConvertTo-Json -Depth 5) try { Invoke-RestMethod -Uri $ServerURL -Method POST -Body $json -ContentType "application/json" -TimeoutSec 10 @proxyParams Write-Log "[OK] Batch=$($buf.Count) UP=$up DN=$($buf.Count - $up) Progress=$total/$($IPs.Count)" } catch { Write-Log "[FAIL] $($_.Exception.Message) Progress=$total/$($IPs.Count)" } } Write-Log "[CYCLE] Total=$total UP=$totalUp DN=$($total - $totalUp)" Start-Sleep -Seconds 60 }