Skip to content

Commit

Permalink
Merge pull request #135 from isimluk/intel_ruls
Browse files Browse the repository at this point in the history
CrowdStrike Intelligence Report Downloads
  • Loading branch information
redhatrises authored Oct 14, 2021
2 parents c7651d8 + d5ec96c commit a7329c0
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 15 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build:

clean-generate: remove-generated generate

generate: specs/swagger-download-patch.json
generate: specs/swagger-pdf-download-patch.json
$(GO) run github.com/go-swagger/go-swagger/cmd/swagger generate client --skip-validation -f $^ -t falcon

.PHONY: build generate remove-generated
Expand All @@ -28,6 +28,10 @@ specs/swagger-download-patch.json: specs/swagger-stripped-oauth.json
# We add missing binary response body spec to the swagger
jq '.definitions."domain.DownloadItem"."type"="string" | .definitions."domain.DownloadItem"."format"="binary"' $< > $@

specs/swagger-pdf-download-patch.json: specs/swagger-download-patch.json
# We add missing binary response body spec to the swagger
jq '.paths."/intel/entities/report-files/v1"."get"."responses"."200"."schema"={"$$ref": "#/definitions/domain.DownloadItem"} | .paths."/intel/entities/rules-latest-files/v1"."get"."responses"."200"."schema"={"$$ref": "#/definitions/domain.DownloadItem"}' $< > $@

specs/swagger.json:
@echo "Sorry swagger.json needs to be obtained manually at this moment"
@exit 1
2 changes: 2 additions & 0 deletions falcon/api_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

"github.com/crowdstrike/gofalcon/falcon/client"
httpruntime "github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -33,6 +34,7 @@ func NewClient(ac *ApiConfig) (*client.CrowdStrikeAPISpecification, error) {
customTransport := httptransport.NewWithClient(
ac.Host(), ac.BasePath(), []string{}, authenticatedClient)
customTransport.Debug = ac.Debug
customTransport.Consumers["application/pdf"] = httpruntime.ByteStreamConsumer()

return client.New(customTransport, strfmt.Default), nil
}
Expand Down
22 changes: 18 additions & 4 deletions falcon/client/intel/get_intel_report_p_d_f_responses.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 18 additions & 4 deletions falcon/client/intel/get_latest_intel_rule_file_responses.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions falcon/client/intel/intel_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a7329c0

Please sign in to comment.