-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathtemplate.go
26 lines (24 loc) · 1.02 KB
/
template.go
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
package main
// escaped data
const tpl = `#### Yara
{{- if .Results.Matches}}
| Rule | Description | Offset | Data | Tags |
|-------------|--------------|-------------|-------------|-------------|
{{- range .Results.Matches }}
| ` + "`" + `{{ .Rule }}` + "`" + ` | {{ index .Meta "description" }} | ` + "`" + `{{ printf "%#x" (index .Strings 0).Offset }}` + "`" + ` | ` + "`" + `{{ printf "%.25q" (index .Strings 0).Data }}` + "`" + ` | {{ .Tags }} |
{{- end }}
> NOTE: **Data** truncated to 25 characters
{{ else }}
- No Matches Found
{{- end }}
`
// code-ified escaped data
const tpl2 = `#### Yara
{{- if .Results.Matches}}
| Rule | Description | Offset | Data | Tags |
|-------------|--------------|-------------|-------------|-------------|
{{- range .Results.Matches }}
| ` + "`" + `{{ .Rule }}` + "`" + ` | {{ index .Meta "description" }} | {{ (index .Strings 0).Offset }} | ` + "`" + `{{ printf "%#q" (index .Strings 0).Data }}` + "`" + ` | {{ .Tags }} |
{{- end }}
{{ end -}}
`