hammackj / risu

Risu is Nessus parser, that converts the generated reports into a ActiveRecord database, this allows for easy report generation and vulnerability verification.
http://hammackj.github.io/risu
MIT License
63 stars 20 forks source link

Support for multiple files and user-specified templates #92

Closed mogigoma closed 7 years ago

mogigoma commented 8 years ago

I have a reporting system that requires one file per Nessus plugin to be created in a directory, and for the contents of the files to be defined by a user-specified template. For example, I would like to be able to pass into Risu two flags -d <dirname> and -t <filename>, with <dirname> being a directory that may or may not exist, and <filename> being a text file written in a template language such as Liquid.

Ideally, the template language would have access to a data structure containing the aggregated results of all runs of the plugin over all hosts so that it would be possible in the template to write pseudocode such as:

#+FILENAME: {{ plugin.name | downcase | replace: " ", "_" }}.tex
\section{Affected Hosts}
\begin{itemize}
{% for host in plugin %}
  \item {{ host.ip }}:{{ host.port }}
{% endfor %}
\end{itemize}

With the value of FILENAME being used to create <dirname>/<FILENAME>, though the exact syntax of that specifier is not important, I just stole it from Org-mode.

hammackj commented 8 years ago

Interesting. Seems doable. You mention liquid templates is there any others that would be required?

mogigoma commented 8 years ago

Liquid just happens to be what I'm familiar with, but anything that supports loops, conditionals, and indexing through multiple layers will work. For my purposes I need a per-plugin object that contains all hosts and results, but I suspect others would find a per-host object useful as well. If it helps, an example of a real-world output file (that I currently write per hand) is:

\begin{finding}{plugin_name_here}
  \findingsection{Description}
  \par plugin_description_here

  \findingsection{Solution}
  \par plugin_solution_here

  \findingsection{Affected Hosts}
  \begin{itemize}
  \item ip_1
  \item ...
  \item ip_N
  \end{itemize}
\end{finding}
hammackj commented 8 years ago

Ok. I will see what I can do after work.

mogigoma commented 7 years ago

Personally, I don't require this anymore. We've developed our own custom parsing and templating system in the meantime.