-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathgraphviz.tmpl
28 lines (23 loc) · 1.48 KB
/
graphviz.tmpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
strict digraph "Scan" {
fontname="{{ index .Constants "default_font" }}"
node [fontname="{{ index .Constants "default_font" }}", width=.25, height=.375, fontsize=9]
edge [fontname="{{ index .Constants "default_font" }}"]
layout={{ index .Constants "layout" }}
scanner [label="{{ .NMAPRun.Scanner }}", shape=hexagon, style=filled];
{{- $hops := .NMAPRun.AllHops }}
{{ range $key, $value := $hops -}}
hop{{ clean_ip $key }} [label="", tooltip="{{ $key }}", shape=circle, height=.12, width=.12, style=filled];
{{ end }}
{{ range $key, $value := .NMAPRun.Host -}}
{{ if $value.Status.IsUp -}}
srv{{ $key }} [label="{{ $value.JoinedAddresses "/" }}", tooltip="{{ $value.JoinedAddresses "/" }}", shape=hexagon, style=filled];
{{ range $portKey, $portValue := $value.Port }}
srv{{ $key }}_port_{{ $portValue.Protocol }}_{{ $portValue.PortID }} [label="{{ $portValue.Protocol }}/{{ $portValue.PortID }} ({{ $portValue.State.State }})", tooltip="{{ $portValue.Protocol }}/{{ $portValue.PortID }} ({{ $portValue.State.State }})", shape=underline, width=.12, height=.12, fontsize=8, color="{{ port_state_color $portValue }}"];
srv{{ $key }} -> srv{{ $key }}_port_{{ $portValue.Protocol }}_{{ $portValue.PortID }} [arrowhead=none];
{{ end -}}
{{ range $hopSource, $hopTarget := hop_list $value.Trace.Hops "scanner" "srv" $key }}
{{ clean_ip $hopSource }} -> {{ clean_ip $hopTarget }} [arrowhead=none];
{{- end }}
{{- end }}
{{ end }}
}