INNER CODE UNIT · Python
to_yaml
infosecB/LOOBins · src/pyloobins/models.py:111
def to_yaml(self, exclude_null: bool = True) -> str:
"""Convert a LOOBin object to a YAML string"""
return yaml.dump(
self.model_dump(exclude_none=exclude_null),
Dumper=yaml.Dumper,
sort_keys=False,
)
def to_md(self) -> str:
"""Convert a LOOBin object to a Markdown string"""
env = Environment(
loader=PackageLoader("pyloobins", "templates"),
autoescape=select_autoescape(),
)
template = env.get_template("loobin.md.j2").render(
loobin=self,
tactics=self.combine_tactics(),