Skip to content

Commit

Permalink
render threats into a human readable format
Browse files Browse the repository at this point in the history
  • Loading branch information
nineinchnick committed Oct 3, 2020
1 parent 4143867 commit 3cbe49b
Show file tree
Hide file tree
Showing 3 changed files with 2,656 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ all: $(models:.py=/report.html) $(models:.py=/dfd.png) $(models:.py=/seq.png) do
docs/pytm/index.html: $(wildcard pytm/*.py)
PYTHONPATH=. pdoc --html --force --output-dir docs pytm

docs/threats.md: $(wildcard pytm/threatlib/*.json)
printf "# Threat database\n" > $@
jq -r ".[] | \"$$(cat docs/threats.jq)\"" $< >> $@

clean:
rm -rf dist/* build/* $(models:.py=/*)

Expand Down Expand Up @@ -52,7 +56,7 @@ image:
docker build -t $(DOCKER_IMG) .

.PHONY: docs
docs: docs/pytm/index.html
docs: docs/pytm/index.html docs/threats.md

.PHONY: fmt
fmt:
Expand Down
24 changes: 24 additions & 0 deletions docs/threats.jq
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## \(.SID) \(.description)

\(.details)

<dl>
<dt>Severity</dt>
<dd>\(.severity)</dd>

<dt>Prerequisites</dt>
<dd>\(.prerequisites)</dd>

<dt>Example</dt>
<dd>\(.example)</dd>

<dt>Mitigations</dt>
<dd>\(.mitigations)</dd>

<dt>References</dt>
<dd>\(.references)</dd>

<dt>Condition</dt>
<dd>\(.condition)</dd>
</dl>
\n\n
Loading

0 comments on commit 3cbe49b

Please sign in to comment.