-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Webhook message formatting using go templates (#582)
* feat: Refactor sendToWebhook(). Signed-off-by: Simarpreet Singh <simar@linux.com> * feat: Add a simple barebones template. Signed-off-by: Simarpreet Singh <simar@linux.com> * feat: Add some sad paths for template output Signed-off-by: Simarpreet Singh <simar@linux.com> * feat: Add CSV template for webhook output Signed-off-by: Simarpreet Singh <simar@linux.com> * feat: Add XML template for webhooks Signed-off-by: Simarpreet Singh <simar@linux.com> * feat: Update readme.md for webhook-template Signed-off-by: Simarpreet Singh <simar@linux.com> * fix: Format in UTC time Signed-off-by: Simarpreet Singh <simar@linux.com> * feat: Initialize template once and pass around Signed-off-by: Simarpreet Singh <simar@linux.com> * feat: Update readme to include template usage Signed-off-by: Simarpreet Singh <simar@linux.com> * feat: Add --content-type flag Signed-off-by: Simarpreet Singh <simar@linux.com> * feat: Use current time for template payloads Signed-off-by: Simarpreet Singh <simar@linux.com> * fix: Log but don't error if content-type is not set Signed-off-by: Simarpreet Singh <simar@linux.com> * feat: Update Readme to reflect new flag usage Signed-off-by: Simarpreet Singh <simar@linux.com>
- Loading branch information
Showing
8 changed files
with
202 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{ .InvalidField }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{ .Context.Timestamp | timeNow }},{{ .Context.ProcessName }},{{ .Context.HostName }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*** Detection *** | ||
Timestamp: {{ .Context.Timestamp | timeNow }} | ||
ProcessName: {{ .Context.ProcessName }} | ||
HostName: {{ .Context.HostName }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<detection timestamp="{{.Context.Timestamp | timeNow }}"> | ||
<processname>{{ .Context.ProcessName }}</processname> | ||
<hostname>{{ .Context.HostName }}</hostname> | ||
</detection> |