MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / notify_device_back_online

Method notify_device_back_online

pushover_service.py:198–215  ·  view source on GitHub ↗

Notify when a previously known device that went offline comes back online.

(self, appeared_ips)

Source from the content-addressed store, hash-verified

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)."""

Callers 1

sync_all_countsFunction · 0.95

Calls 3

is_enabledMethod · 0.95
getMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected