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

Method _normalize_action_column

db_manager.py:810–830  ·  view source on GitHub ↗

Map user-facing action names to database columns.

(self, action_name: Optional[str])

Source from the content-addressed store, hash-verified

808 sql = f"INSERT INTO hosts ({columns}) VALUES ({placeholders})"
809
810 cursor.execute(sql, list(insert_data.values()))
811 logger.info(f"Inserted new host: {mac} ({ip})")
812
813 conn.commit()
814 return True
815
816 except Exception as e:
817 logger.error(f"Failed to upsert host {mac}: {e}")
818 return False
819
820 def _normalize_action_column(self, action_name: Optional[str]) -> Optional[str]:
821 """Map user-facing action names to database columns."""
822 if not action_name:
823 return None
824
825 normalized = action_name.strip().lower()
826 alias_map = {
827 'nmapvulnscanner': 'nmap_vuln_scanner',
828 'nmap_vulnscanner': 'nmap_vuln_scanner',
829 'nmap_vuln_scanner': 'nmap_vuln_scanner',
830 'scanner': 'scanner_status'
831 }
832
833 if normalized in alias_map:

Callers 1

Calls 1

getMethod · 0.45

Tested by

no test coverage detected