INNER CODE UNIT · Python
extract_domains
magicsword-io/LOLRMM · bin/generate_domains_csv.py:42
def extract_domains(yaml_file_path):
"""Extract domains from a YAML file."""
try:
print(f"Processing file: {yaml_file_path}")
with open(yaml_file_path, "r", encoding="utf-8") as file:
data = yaml.safe_load(file)
# Get the tool name from the YAML Name field if available, otherwise use filename
tool_name = data.get("Name", clean_tool_name(yaml_file_path))
print(f"Tool name: {tool_name}")
# Extract domains from Artifacts > Network > Domains
domains = []
if "Artifacts" in data and "Network" in data["Artifacts"]:
for network in data["Artifacts"]["Network"]:
if "Domains" in network:
for domain in network["Domains"]:
# Only export real lookup values; placeholders document