8

At work I am responsible for creating information security reports that contain long narratives and reference what we refer to as "vulnerabilities". These vulnerabilities are presented in a table. I have been using Microsoft Word for a long time but I just stumbled into Latex and it looks like it could really help me save time and increase accuracy.

I have been doing some reading but there is a lot of material out there. When I found this stackexchange site I couldn't resist asking for some advice.

The reports that I put together average about 100 pages. They have multiple sections that outline the entire test at a high level (executive overview) as well as many other sections that describe in depth attack narratives.

I have a pretty good grasp on the typical syntax for marking a latex document up but what I am starting to wonder about is how I can create a cross reference (I am not sure if this is the correct term) in a paragraph that will link to a table that goes into detail about a particular vulnerability. Here is a short example of how I am doing things in Word.

This image shows a paragraph that is linked (in blue) to a specific "vulnerability" in a table.

A narrative that links to a table

And here is the table:

enter image description here

The blue bracketed text in the first image links to the table that shows that particular issue. Creating the links in Word is pretty time consuming and getting the data into the table is even worse.

My question is, can I use a "macro" or maybe some other latex mechanisim to easily create vulnerabilities in a table that can be quickly referenced in my long form narratives? Maybe something that would take parameters like:

{This is the title for the vulnerability, This explains the issues in question..., 8, INT, CONF, NO, NO, 6 H}

Is there a way to do computation on the actual values in the table? Something like multiplication of one value against another?

And finally is there a way to create graphs based on the information that comprise the tables?

18

Using datatool for the heavy lifting, and other packages for the formatting:

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{booktabs}
\usepackage{datatool}
\usepackage{longtable}
\usepackage{lipsum}
\usepackage{hyperref}
\begin{filecontents}{\jobname.txt}
This is the title for vuln 1, This explains the issues in question..., 8, INT, CONF, NO, NO, 6, H
This is the title for vuln 2, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 3, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 4, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 5, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 6, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 7, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 8, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 9, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 10, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 11, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 12, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 13, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 14, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 15, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 16, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 17, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 18, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 19, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 20, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 21, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 22, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 23, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 24, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 25, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 26, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 27, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 28, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 29, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 30, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
\end{filecontents}

\DTLloaddb[noheader,keys={title,description,cvss,access,classification,asl,np,severity,ranking}]{vulns}{\jobname.txt}
\DTLmeanforcolumn{vulns}{cvss}{\cvssavg} \DTLmeanforcolumn{vulns}{severity}{\sevavg}
\DTLround{\cvssavg}{\cvssavg}{2}
\DTLround{\sevavg}{\sevavg}{2}

\begin{document}
\lipsum[1]

What's going on at \hyperlink{vuln1}{VULN1} and \hyperlink{vuln30}{VULN30}?

\begin{longtable}{p{1.2in}p{1.2in}ccccccc}
 \toprule \bfseries{Title} & \bfseries{Description} & \bfseries{CVSS} & \bfseries{Access} & \bfseries{Class.} & \bfseries{ASL} & \bfseries{NP} & \bfseries{Sev.} & \bfseries{Rating} \\ \midrule
\DTLforeach{vulns}{%
\vtitle=title,\description=description,\cvss=cvss,\access=access,\classification=classification,\asl=asl,\np=np,\severity=severity,\ranking=ranking}{%
\hypertarget{vuln\DTLcurrentindex}{\vtitle} & \description & \cvss & \access & \classification & \asl & \np & \severity & \ranking \\} 
\bfseries{Averages} & & \cvssavg & & & & & \sevavg \\ \bottomrule
\end{longtable}

\end{document}

enter image description here

enter image description here

  • 2
    +1 Very nice example of using datatool. Sadly only can upvote once. – R. Schumacher Apr 15 '15 at 3:02
  • This is a great example. I am reading the datatool user guide now. Thanks for your help. – ajt Apr 15 '15 at 10:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.