Notify when a previously known device that went offline comes back online.
(self, appeared_ips)
| 196 | threading.Thread(target=self.send, args=(msg, "Ragnar — Device Lost"), daemon=True).start() |
| 197 | |
| 198 | def notify_device_back_online(self, appeared_ips): |
| 199 | """Notify when a previously known device that went offline comes back online.""" |
| 200 | if not self.is_enabled(): |
| 201 | return |
| 202 | if not self.shared_data.config.get("pushover_notify_device_back_online", False): |
| 203 | return |
| 204 | # Only alert for IPs we actually saw go offline this session |
| 205 | back_online = [ip for ip in appeared_ips |
| 206 | if ip in self._notified_devices and ip in self._offline_devices] |
| 207 | if not back_online: |
| 208 | return |
| 209 | # Remove from offline tracking since they're back |
| 210 | self._offline_devices.difference_update(back_online) |
| 211 | count = len(back_online) |
| 212 | ip_list = ", ".join(sorted(back_online)[:5]) |
| 213 | suffix = f" (+{count - 5} more)" if count > 5 else "" |
| 214 | msg = f"📶 {count} device(s) back online:\n{ip_list}{suffix}" |
| 215 | threading.Thread(target=self.send, args=(msg, "Ragnar — Device Back Online"), daemon=True).start() |
| 216 | |
| 217 | def notify_new_vulnerabilities(self, new_total): |
| 218 | """Notify about newly discovered vulnerabilities (compares against last notified count).""" |
no test coverage detected