-
Notifications
You must be signed in to change notification settings - Fork 56
Templates
Vsevolod Djagilev edited this page May 2, 2022
·
3 revisions
You can use your own custom templates (HTML or Markdown) for the output. Basic example is shown here:
Template:
# Scanning
{{ range .NMAPRun.Host }}
{{ if eq .Status.State "up" }}
## {{ .HostAddress.Address }}
---
{{ range .Port }}
* {{ .PortID }} ({{ .Protocol }})
{{ end }}
{{ end }}
{{ end }}Command:
nmap-formatter md example.xml --md-use-template example.mdOutput:
# Scanning
## 74.207.244.221
---
* 22 (tcp)
* 80 (tcp)Template:
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
{{ range .NMAPRun.Host }}
{{ if eq .Status.State "up" -}}
<h2>{{ .HostAddress.Address }}</h2>
<hr />
<ul>
{{ range .Port -}}
<li>{{ .PortID }} ({{ .Protocol }})</li>
{{ end }}
</ul>
{{- end }}
{{- end }}
</body>
</html>Command:
nmap-formatter html example.xml --html-use-template template.html > example.htmlOutput:
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
<h2>74.207.244.221</h2>
<hr />
<ul>
<li>22 (tcp)</li>
<li>80 (tcp)</li>
</ul>
</body>
</html>