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

Method run

orchestrator.py:814–1096  ·  view source on GitHub ↗

Run the orchestrator cycle with proper scan order: 1. ARP Ping Scan (fast host discovery) 2. Nmap Port Scan (discover open ports) 3. Nmap Vulnerability Scan (scan for vulnerabilities) 4. Attacks (if enabled) 5. Loop Scans ALWAYS run r

(self)

Source from the content-addressed store, hash-verified

812 logger.error(f"Error during vulnerability scanning cycle: {e}")
813
814 def run(self):
815 """
816 Run the orchestrator cycle with proper scan order:
817 1. ARP Ping Scan (fast host discovery)
818 2. Nmap Port Scan (discover open ports)
819 3. Nmap Vulnerability Scan (scan for vulnerabilities)
820 4. Attacks (if enabled)
821 5. Loop
822
823 Scans ALWAYS run regardless of enable_attacks setting.
824 Only attack actions respect the enable_attacks flag.
825 """
826 # Use getattr for safe config access
827 scan_vuln_running = getattr(self.shared_data, 'scan_vuln_running', True)
828 scan_vuln_interval = getattr(self.shared_data, 'scan_vuln_interval', 300)
829 scan_interval = getattr(self.shared_data, 'scan_interval', 180)
830 enable_attacks = getattr(self.shared_data, 'enable_attacks', True)
831
832 # ====================================================================
833 # PHASE 1: Initial ARP + Port Scan
834 # ====================================================================
835 logger.info("=" * 70)
836 logger.info("ORCHESTRATOR STARTUP - PHASE 1: ARP + Port Scan")
837 logger.info("=" * 70)
838
839 if self.network_scanner:
840 self.shared_data.ragnarorch_status = "NetworkScanner"
841 self.shared_data.ragnarstatustext2 = "Initial scan..."
842 self._execute_network_scans(reason="startup")
843 self.shared_data.ragnarstatustext2 = ""
844 logger.info("✓ Phase 1 complete: Network hosts and ports discovered")
845 else:
846 logger.error("Network scanner not initialized. Cannot start orchestrator.")
847 return
848
849 # ====================================================================
850 # PHASE 2: Initial Vulnerability Scan
851 # ====================================================================
852 logger.info("=" * 70)
853 logger.info("ORCHESTRATOR STARTUP - PHASE 2: Vulnerability Scan")
854 logger.info("=" * 70)
855
856 if scan_vuln_running and self.nmap_vuln_scanner:
857 logger.info("Running initial vulnerability scan on all discovered hosts...")
858 # Set orchestrator status to show vulnerability scanning in web UI
859 self.shared_data.ragnarorch_status = "NmapVulnScanner"
860 self.run_vulnerability_scans(force=True) # Force scan at startup
861 logger.info("✓ Phase 2 complete: Vulnerability scan finished")
862 else:
863 logger.info("⊘ Phase 2 skipped: Vulnerability scanning disabled")
864
865 # ====================================================================
866 # PHASE 3: Attack Phase (if enabled)
867 # ====================================================================
868 logger.info("=" * 70)
869 logger.info(f"🔥 ORCHESTRATOR VERSION: {ORCHESTRATOR_VERSION} 🔥")
870 logger.info("=" * 70)
871 logger.info(f"ORCHESTRATOR STARTUP - PHASE 3: Attack Phase (enabled={enable_attacks})")

Callers 1

orchestrator.pyFile · 0.45

Calls 15

_iter_action_contextsMethod · 0.95
process_alive_ipsMethod · 0.95
infoMethod · 0.80
errorMethod · 0.80
log_system_statusMethod · 0.80
read_dataMethod · 0.80
get_memory_usageMethod · 0.80
warningMethod · 0.80

Tested by

no test coverage detected