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

Method load_actions

orchestrator.py:212–246  ·  view source on GitHub ↗

Load all actions from the actions file

(self)

Source from the content-addressed store, hash-verified

210 return result_container['result'] if result_container['result'] else 'failed'
211
212 def load_actions(self):
213 """Load all actions from the actions file"""
214 self.actions_dir = self.shared_data.actions_dir
215
216 # Check if actions file exists
217 if not os.path.exists(self.shared_data.actions_file):
218 logger.error(f"Actions file not found at {self.shared_data.actions_file}")
219 logger.error("Cannot load actions. Orchestrator may not function properly.")
220 return
221
222 try:
223 with open(self.shared_data.actions_file, 'r') as file:
224 actions_config = json.load(file)
225 except json.JSONDecodeError as e:
226 logger.error(f"Failed to parse actions file: {e}")
227 return
228 except Exception as e:
229 logger.error(f"Error reading actions file: {e}")
230 return
231
232 for action in actions_config:
233 module_name = action.get("b_module")
234 if not module_name:
235 logger.warning(f"Action missing b_module field: {action}")
236 continue
237
238 try:
239 if module_name == 'scanning':
240 self.load_scanner(module_name)
241 elif module_name == 'nmap_vuln_scanner':
242 self.load_nmap_vuln_scanner(module_name)
243 else:
244 self.load_action(module_name, action)
245 except Exception as e:
246 logger.error(f"Failed to load action {module_name}: {e}")
247
248 def load_scanner(self, module_name):
249 """Load the network scanner"""

Callers 1

__init__Method · 0.95

Calls 6

load_scannerMethod · 0.95
load_actionMethod · 0.95
errorMethod · 0.80
warningMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected