webhookserver

package
v0.0.0-...-57dd4b5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithHost

func WithHost(v string) webHookServerOptions

func WithName

func WithName(v string) webHookServerOptions

func WithPort

func WithPort(v int) webHookServerOptions

func WithTTL

func WithTTL(v int) webHookServerOptions

func WithVersion

func WithVersion(v string) webHookServerOptions

Types

type CaseEvent

type CaseEvent struct {
	Operation      string  `json:"operation"`
	Details        Details `json:"details"`
	ObjectType     string  `json:"objectType"`
	ObjectID       string  `json:"objectId"`
	Base           bool    `json:"base"`
	StartDate      int64   `json:"startDate"`
	RootID         string  `json:"rootId"`
	RequestID      string  `json:"requestId"`
	Object         Object  `json:"object"`
	OrganisationID string  `json:"organisationId"`
	Organisation   string  `json:"organisation"` //nolint
}

************** case ***************

type ChanFormWebHookServer

type ChanFormWebHookServer struct {
	ForSomebody string
	Data        commoninterfaces.ChannelRequester
}

type Details

type Details struct {
	EndDate          int64                  `json:"endDate,omitempty"`
	CustomFields     map[string]interface{} `json:"customFields,omitempty"`
	ResolutionStatus string                 `json:"resolutionStatus,omitempty"`
	Summary          string                 `json:"summary,omitempty"`
	Status           string                 `json:"status,omitempty"`
	ImpactStatus     string                 `json:"impactStatus,omitempty"`
}

type EventElement

type EventElement struct {
	Operation  string `json:"operation"`
	ObjectType string `json:"objectType"`
	RootId     string `json:"rootId"`
}

type Object

type Object struct {
	ID_              string                 `json:"_id"` //nolint
	ID               string                 `json:"id"`
	CreatedBy        string                 `json:"createdBy"`
	UpdatedBy        string                 `json:"updatedBy"`
	CreatedAt        int64                  `json:"createdAt"`
	UpdatedAt        int64                  `json:"updatedAt"`
	Type             string                 `json:"_type"`
	CaseID           int                    `json:"caseId"`
	Title            string                 `json:"title"`
	Description      string                 `json:"description"`
	Severity         int                    `json:"severity"`
	StartDate        int64                  `json:"startDate"`
	EndDate          int64                  `json:"endDate"`
	ImpactStatus     string                 `json:"impactStatus"`
	ResolutionStatus string                 `json:"resolutionStatus"`
	Tags             []string               `json:"tags"`
	Flag             bool                   `json:"flag"`
	Tlp              int                    `json:"tlp"`
	Pap              int                    `json:"pap"`
	Status           string                 `json:"status"`
	Summary          string                 `json:"summary"`
	Owner            string                 `json:"owner"`
	CustomFields     map[string]interface{} `json:"customFields"`
	Stats            Stats                  `json:"stats"`
	Permissions      []interface{}          `json:"permissions"`
}

type ReadyMadeEventCase

type ReadyMadeEventCase struct {
	Source string                 `json:"source"`
	Case   map[string]interface{} `json:"event"`
	//Case        CaseEvent     `json:"event"`
	Observables []interface{} `json:"observables"`
	TTPs        []interface{} `json:"ttp"`
}

func CreateEvenCase

func CreateEvenCase(uuidStorage, rootId string, chanInput chan<- ChanFormWebHookServer) (ReadyMadeEventCase, error)

type RequestTheHive

type RequestTheHive struct {
	RequestId  string
	RootId     string
	Command    string
	ChanOutput chan commoninterfaces.ChannelResponser
}

func NewChannelRequest

func NewChannelRequest() *RequestTheHive

func (*RequestTheHive) GetChanOutput

func (r *RequestTheHive) GetChanOutput() chan commoninterfaces.ChannelResponser

func (*RequestTheHive) GetCommand

func (r *RequestTheHive) GetCommand() string

func (*RequestTheHive) GetRequestId

func (r *RequestTheHive) GetRequestId() string

func (*RequestTheHive) GetRootId

func (r *RequestTheHive) GetRootId() string

func (*RequestTheHive) SetChanOutput

func (r *RequestTheHive) SetChanOutput(v chan commoninterfaces.ChannelResponser)

func (*RequestTheHive) SetCommand

func (r *RequestTheHive) SetCommand(v string)

func (*RequestTheHive) SetRequestId

func (r *RequestTheHive) SetRequestId(v string)

func (*RequestTheHive) SetRootId

func (r *RequestTheHive) SetRootId(v string)

type ResponsTheHive

type ResponsTheHive struct {
	StatusCode int
	RequestId  string
	Data       []byte
}

func NewChannelRespons

func NewChannelRespons() *ResponsTheHive

func (*ResponsTheHive) GetData

func (r *ResponsTheHive) GetData() []byte

func (*ResponsTheHive) GetRequestId

func (r *ResponsTheHive) GetRequestId() string

func (*ResponsTheHive) GetStatusCode

func (r *ResponsTheHive) GetStatusCode() int

func (*ResponsTheHive) SetData

func (r *ResponsTheHive) SetData(v []byte)

func (*ResponsTheHive) SetRequestId

func (r *ResponsTheHive) SetRequestId(v string)

func (*ResponsTheHive) SetStatusCode

func (r *ResponsTheHive) SetStatusCode(v int)

type Stats

type Stats struct{}

type WebHookServer

type WebHookServer struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, logging *logginghandler.LoggingChan, opts ...webHookServerOptions) (*WebHookServer, <-chan ChanFormWebHookServer, error)

func (*WebHookServer) RouteIndex

func (wh *WebHookServer) RouteIndex(w http.ResponseWriter, r *http.Request)

func (*WebHookServer) RouteWebHook

func (wh *WebHookServer) RouteWebHook(w http.ResponseWriter, r *http.Request)

func (*WebHookServer) Shutdown

func (wh *WebHookServer) Shutdown(ctx context.Context)

func (*WebHookServer) Start

func (wh *WebHookServer) Start()

type WebHookServerOptions

type WebHookServerOptions struct {
	TTL     int
	Port    int
	Host    string
	Name    string
	Version string
}

type WebHookTemporaryStorage

type WebHookTemporaryStorage struct {
	// contains filtered or unexported fields
}

WebHookTemporaryStorage временное хранилище для WebHookServer ttl - количество секунд после истечении котрых объект будет считатся устаревшим и подлежащим автоматическому удалению ttlStorage - хранилище данных со сроком жизни

func NewWebHookTemporaryStorage

func NewWebHookTemporaryStorage(ttl int) (*WebHookTemporaryStorage, error)

NewWebHookTemporaryStorage конструктор временного хранилища сервера WebHook ttl - time-to-live время жизни хранящейся информации в секундах, минимальное значение 5 секунд, максимальное не должно превышать 86400 секунд что соответствует 1-им суткам. Внимание! Чрезмерно большое время жизни временной информации может повлечь за собой утечку памяти.

func (*WebHookTemporaryStorage) DeleteElement

func (whts *WebHookTemporaryStorage) DeleteElement(id string)

DeleteElement удаляет заданный элемент по его uuid

func (*WebHookTemporaryStorage) GetElementId

func (whts *WebHookTemporaryStorage) GetElementId(id string) (string, bool)

GetElementId возвращает id события и другие данные по полученому uuid

func (*WebHookTemporaryStorage) SetElementId

func (whts *WebHookTemporaryStorage) SetElementId(eventId string) string

SetElementId создает новую запись, принимает id события который нужно сохранить и возвращает uuid идентификатор по которому это событие можно будет потом найти

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL