Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,33 @@ builds:
- CGO_ENABLED=0
goarch:
- amd64
- arm64
goos:
- linux
- windows
- darwin
ldflags:
- >-
-s -w -X main.version={{.Version}}
-X main.commit={{.Commit}}
-X main.date={{.CommitDate}}
release:
draft: true
github:
owner: NETWAYS
name: check_sentinelone
archives:
- format: binary
- formats:
- binary
name_template: >-
{{ .ProjectName }}_{{ .Tag }}_
{{- if eq .Os "linux" }}Linux{{ end }}
{{- if eq .Os "windows" }}Windows{{ end }}
{{- if eq .Os "darwin" }}Darwin{{ end }}
{{- if eq .Arch "amd64" }}_x86_64{{ end }}
{{- if eq .Arch "arm64" }}_arm64{{ end }}
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: '{{ .Tag }}-SNAPSHOT-{{.ShortCommit}}'
version_template: '{{ .Tag }}-SNAPSHOT-{{.ShortCommit}}'
changelog:
sort: asc
filters:
Expand Down
1 change: 0 additions & 1 deletion AUTHORS

This file was deleted.

File renamed without changes.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
check_sentinelone
=================
# check_sentinelone

Check for threats on the SentinelOne Cloud service.

Expand Down
20 changes: 19 additions & 1 deletion api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func NewClient(url, token string, timeout time.Duration) (c *Client) {
}

func (c *Client) NewRequest(method, url string, body io.Reader) (req *http.Request, err error) {
// We use a general timeout for the entire client
// nolint: noctx
// TODO Add context
req, err = http.NewRequest(method, c.ManagementURL+"/web/api/"+url, body)
if err != nil {
err = fmt.Errorf("could not create http request: %w", err)
Expand All @@ -55,3 +55,21 @@ func (c *Client) Do(req *http.Request) (res *http.Response, err error) {

return
}

type LoggingRoundTripper struct {
Base http.RoundTripper
}

// NewLoggingHTTPClient prepares a custom client that using a logging transport.
func NewLoggingHTTPClient() *http.Client {
client := *http.DefaultClient
client.Transport = LoggingRoundTripper{http.DefaultTransport}

return &client
}

func (r LoggingRoundTripper) RoundTrip(req *http.Request) (res *http.Response, err error) {
res, err = r.Base.RoundTrip(req)

return
}
1 change: 0 additions & 1 deletion api/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ func (c *Client) GetJSONItems(request *http.Request) (items []json.RawMessage, e
}

// set nextCursor or break iteration when done.
// nolint: gocritic
if response.Pagination.NextCursor == "" {
break
} else if response.Pagination.NextCursor == nextCursor {
Expand Down
23 changes: 0 additions & 23 deletions api/trace.go

This file was deleted.

5 changes: 0 additions & 5 deletions version.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ the Free Software Foundation, either version 3 of the License, or
var (
version = "development"
commit = "HEAD"
date = "latest"
)

func buildVersion() string {
Expand All @@ -25,10 +24,6 @@ func buildVersion() string {
result = fmt.Sprintf("%s\ncommit: %s", result, commit)
}

if date != "" {
result = fmt.Sprintf("%s\ndate: %s", result, date)
}

result += "\n" + license

return result
Expand Down