Load an action from the actions file
(self, module_name, action)
| 69 | self.nmap_vuln_scanner = NmapVulnScanner(self.shared_data) |
| 70 | |
| 71 | def load_action(self, module_name, action): |
| 72 | """Load an action from the actions file""" |
| 73 | module = importlib.import_module(f'actions.{module_name}') |
| 74 | try: |
| 75 | b_class = action["b_class"] |
| 76 | action_instance = getattr(module, b_class)(self.shared_data) |
| 77 | action_instance.action_name = b_class |
| 78 | action_instance.port = action.get("b_port") |
| 79 | action_instance.b_parent_action = action.get("b_parent") |
| 80 | if action_instance.port == 0: |
| 81 | self.standalone_actions.append(action_instance) |
| 82 | else: |
| 83 | self.actions.append(action_instance) |
| 84 | except AttributeError as e: |
| 85 | self.logger.error(f"Module {module_name} is missing required attributes: {e}") |
| 86 | |
| 87 | def serve_netkb_data_json(self, handler): |
| 88 | try: |
no test coverage detected