handler

package
v0.0.0-...-5f1c9c6 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const BucketReportTemplates = "templates"

Variables

View Source
var ApiKeyHeader = "X-API-Key"
View Source
var SessionName = "default"
View Source
var SessionStore = sessions.NewCookieStore([]byte(os.Getenv("WEB_SESSION_SECRET")))
View Source
var ZeroID string = "0"
View Source
var ZeroTime time.Time

Functions

func Decode

func Decode(r *http.Request, dst any) error

func Err

func Err(w http.ResponseWriter, r *http.Request, err error)

func ImportCSV

func ImportCSV(store *model.Store, w http.ResponseWriter, r *http.Request, uri string, numFields int, cb func(rec []string))

func LoadTemplate

func LoadTemplate(name string) (doct.Template, error)

func Logger

func Logger(next http.Handler) http.Handler

func Recover

func Recover(next http.Handler) http.Handler

func Render

func Render(store *model.Store, w http.ResponseWriter, r *http.Request, status int, name string, values map[string]any)

func ServeDir

func ServeDir(prefix string, dir string) http.Handler

func ServeFile

func ServeFile(name string) http.Handler

func ValidateAsset

func ValidateAsset(dto model.Asset) valid.Result

func ValidateCase

func ValidateCase(dto model.Case) valid.Result

func ValidateEvent

func ValidateEvent(dto model.Event) valid.Result

func ValidateEvidence

func ValidateEvidence(dto model.Evidence) valid.Result

func ValidateIndicator

func ValidateIndicator(dto model.Indicator) valid.Result

func ValidateKey

func ValidateKey(dto model.Key) valid.Result

func ValidateMalware

func ValidateMalware(dto model.Malware) valid.Result

func ValidateNote

func ValidateNote(dto model.Note) valid.Result

func ValidateReport

func ValidateReport(dto model.Report) valid.Result

func ValidateTask

func ValidateTask(dto model.Task) valid.Result

func Warn

func Warn(w http.ResponseWriter, r *http.Request, err error)

Types

type AssetCtrl

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

func NewAssetCtrl

func NewAssetCtrl(store *model.Store) *AssetCtrl

func (AssetCtrl) Delete

func (ctrl AssetCtrl) Delete(w http.ResponseWriter, r *http.Request)

func (AssetCtrl) Edit

func (ctrl AssetCtrl) Edit(w http.ResponseWriter, r *http.Request)

func (AssetCtrl) Export

func (ctrl AssetCtrl) Export(w http.ResponseWriter, r *http.Request)

func (AssetCtrl) Import

func (ctrl AssetCtrl) Import(w http.ResponseWriter, r *http.Request)

func (AssetCtrl) List

func (ctrl AssetCtrl) List(w http.ResponseWriter, r *http.Request)

func (AssetCtrl) Save

func (ctrl AssetCtrl) Save(w http.ResponseWriter, r *http.Request)

type CaseCtrl

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

func NewCaseCtrl

func NewCaseCtrl(store *model.Store) *CaseCtrl

func (CaseCtrl) Delete

func (ctrl CaseCtrl) Delete(w http.ResponseWriter, r *http.Request)

func (CaseCtrl) Edit

func (ctrl CaseCtrl) Edit(w http.ResponseWriter, r *http.Request)

func (CaseCtrl) Export

func (ctrl CaseCtrl) Export(w http.ResponseWriter, r *http.Request)

func (CaseCtrl) Import

func (ctrl CaseCtrl) Import(w http.ResponseWriter, r *http.Request)

func (CaseCtrl) List

func (ctrl CaseCtrl) List(w http.ResponseWriter, r *http.Request)

func (CaseCtrl) Save

func (ctrl CaseCtrl) Save(w http.ResponseWriter, r *http.Request)

type Env

type Env struct {
	Username    string
	ActiveRoute string
	ActiveCase  model.Case
	Search      string
	Sort        string
}

func GetEnv

func GetEnv(store *model.Store, r *http.Request) Env

type EventCtrl

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

func NewEventCtrl

func NewEventCtrl(store *model.Store) *EventCtrl

func (EventCtrl) Delete

func (ctrl EventCtrl) Delete(w http.ResponseWriter, r *http.Request)

func (EventCtrl) Edit

func (ctrl EventCtrl) Edit(w http.ResponseWriter, r *http.Request)

func (EventCtrl) Export

func (ctrl EventCtrl) Export(w http.ResponseWriter, r *http.Request)

func (EventCtrl) Import

func (ctrl EventCtrl) Import(w http.ResponseWriter, r *http.Request)

func (EventCtrl) List

func (ctrl EventCtrl) List(w http.ResponseWriter, r *http.Request)

func (EventCtrl) Save

func (ctrl EventCtrl) Save(w http.ResponseWriter, r *http.Request)

type EvidenceCtrl

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

func NewEvidenceCtrl

func NewEvidenceCtrl(store *model.Store) *EvidenceCtrl

func (EvidenceCtrl) Delete

func (ctrl EvidenceCtrl) Delete(w http.ResponseWriter, r *http.Request)

func (EvidenceCtrl) Download

func (ctrl EvidenceCtrl) Download(w http.ResponseWriter, r *http.Request)

func (EvidenceCtrl) Edit

func (ctrl EvidenceCtrl) Edit(w http.ResponseWriter, r *http.Request)

func (EvidenceCtrl) Export

func (ctrl EvidenceCtrl) Export(w http.ResponseWriter, r *http.Request)

func (EvidenceCtrl) Extensions

func (ctrl EvidenceCtrl) Extensions(w http.ResponseWriter, r *http.Request)

func (EvidenceCtrl) Import

func (ctrl EvidenceCtrl) Import(w http.ResponseWriter, r *http.Request)

func (EvidenceCtrl) List

func (ctrl EvidenceCtrl) List(w http.ResponseWriter, r *http.Request)

func (EvidenceCtrl) Run

func (ctrl EvidenceCtrl) Run(w http.ResponseWriter, r *http.Request)

func (EvidenceCtrl) Save

func (ctrl EvidenceCtrl) Save(w http.ResponseWriter, r *http.Request)

type IndicatorCtrl

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

func NewIndicatorCtrl

func NewIndicatorCtrl(store *model.Store) *IndicatorCtrl

func (IndicatorCtrl) Delete

func (ctrl IndicatorCtrl) Delete(w http.ResponseWriter, r *http.Request)

func (IndicatorCtrl) Edit

func (ctrl IndicatorCtrl) Edit(w http.ResponseWriter, r *http.Request)

func (IndicatorCtrl) Export

func (ctrl IndicatorCtrl) Export(w http.ResponseWriter, r *http.Request)

func (IndicatorCtrl) Import

func (ctrl IndicatorCtrl) Import(w http.ResponseWriter, r *http.Request)

func (IndicatorCtrl) List

func (ctrl IndicatorCtrl) List(w http.ResponseWriter, r *http.Request)

func (IndicatorCtrl) Save

func (ctrl IndicatorCtrl) Save(w http.ResponseWriter, r *http.Request)

type KeyCtrl

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

func NewKeyCtrl

func NewKeyCtrl(store *model.Store) *KeyCtrl

func (KeyCtrl) Delete

func (ctrl KeyCtrl) Delete(w http.ResponseWriter, r *http.Request)

func (KeyCtrl) Edit

func (ctrl KeyCtrl) Edit(w http.ResponseWriter, r *http.Request)

func (KeyCtrl) List

func (ctrl KeyCtrl) List(w http.ResponseWriter, r *http.Request)

func (KeyCtrl) Save

func (ctrl KeyCtrl) Save(w http.ResponseWriter, r *http.Request)

type LoggingResponseWriter

type LoggingResponseWriter struct {
	Bytes  int
	Status int
	// contains filtered or unexported fields
}

LoggingResponseWriter struct is used to log the response

func (*LoggingResponseWriter) Header

func (w *LoggingResponseWriter) Header() http.Header

func (*LoggingResponseWriter) Write

func (w *LoggingResponseWriter) Write(buf []byte) (int, error)

func (*LoggingResponseWriter) WriteHeader

func (w *LoggingResponseWriter) WriteHeader(statusCode int)

type MalwareCtrl

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

func NewMalwareCtrl

func NewMalwareCtrl(store *model.Store) *MalwareCtrl

func (MalwareCtrl) Delete

func (ctrl MalwareCtrl) Delete(w http.ResponseWriter, r *http.Request)

func (MalwareCtrl) Edit

func (ctrl MalwareCtrl) Edit(w http.ResponseWriter, r *http.Request)

func (MalwareCtrl) Export

func (ctrl MalwareCtrl) Export(w http.ResponseWriter, r *http.Request)

func (MalwareCtrl) Import

func (ctrl MalwareCtrl) Import(w http.ResponseWriter, r *http.Request)

func (MalwareCtrl) List

func (ctrl MalwareCtrl) List(w http.ResponseWriter, r *http.Request)

func (MalwareCtrl) Save

func (ctrl MalwareCtrl) Save(w http.ResponseWriter, r *http.Request)

type NoteCtrl

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

func NewNoteCtrl

func NewNoteCtrl(store *model.Store) *NoteCtrl

func (NoteCtrl) Delete

func (ctrl NoteCtrl) Delete(w http.ResponseWriter, r *http.Request)

func (NoteCtrl) Edit

func (ctrl NoteCtrl) Edit(w http.ResponseWriter, r *http.Request)

func (NoteCtrl) Export

func (ctrl NoteCtrl) Export(w http.ResponseWriter, r *http.Request)

func (NoteCtrl) Import

func (ctrl NoteCtrl) Import(w http.ResponseWriter, r *http.Request)

func (NoteCtrl) List

func (ctrl NoteCtrl) List(w http.ResponseWriter, r *http.Request)

func (NoteCtrl) Save

func (ctrl NoteCtrl) Save(w http.ResponseWriter, r *http.Request)

type OpenIDConfig

type OpenIDConfig struct {
	ClientId      string   //id from the authorization service (OIDC provider)
	ClientSecret  string   //secret from the authorization service (OIDC provider)
	ClientUrl     url.URL  //your website's/service's URL for example: "http://localhost:8081/" or "https://mydomain.com/
	Issuer        url.URL  //the URL identifier for the authorization service. for example: "https://accounts.google.com" - try adding "/.well-known/openid-configuration" to the path to make sure it's correct
	Scopes        []string //OAuth scopes. If you're unsure go with: []string{oidc.ScopeOpenID, "profile", "email"}
	Identifier    string   // name of the openid claim used to securely identify a user (e.g. "sub").
	PostLogoutUrl url.URL  //user will be redirected to this URL after he logs out (i.e. accesses the '/logout' endpoint added in 'Init()')
}

type ReportCtrl

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

func NewReportCtrl

func NewReportCtrl(store *model.Store) *ReportCtrl

func (ReportCtrl) Delete

func (ctrl ReportCtrl) Delete(w http.ResponseWriter, r *http.Request)

func (ReportCtrl) Dialog

func (ctrl ReportCtrl) Dialog(w http.ResponseWriter, r *http.Request)

func (ReportCtrl) Download

func (ctrl ReportCtrl) Download(w http.ResponseWriter, r *http.Request)

func (ReportCtrl) Edit

func (ctrl ReportCtrl) Edit(w http.ResponseWriter, r *http.Request)

func (ReportCtrl) Generate

func (ctrl ReportCtrl) Generate(w http.ResponseWriter, r *http.Request)

func (ReportCtrl) List

func (ctrl ReportCtrl) List(w http.ResponseWriter, r *http.Request)

func (ReportCtrl) Save

func (ctrl ReportCtrl) Save(w http.ResponseWriter, r *http.Request)

type TaskCtrl

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

func NewTaskCtrl

func NewTaskCtrl(store *model.Store) *TaskCtrl

func (TaskCtrl) Delete

func (ctrl TaskCtrl) Delete(w http.ResponseWriter, r *http.Request)

func (TaskCtrl) Edit

func (ctrl TaskCtrl) Edit(w http.ResponseWriter, r *http.Request)

func (TaskCtrl) Export

func (ctrl TaskCtrl) Export(w http.ResponseWriter, r *http.Request)

func (TaskCtrl) Import

func (ctrl TaskCtrl) Import(w http.ResponseWriter, r *http.Request)

func (TaskCtrl) List

func (ctrl TaskCtrl) List(w http.ResponseWriter, r *http.Request)

func (TaskCtrl) Save

func (ctrl TaskCtrl) Save(w http.ResponseWriter, r *http.Request)

type UserCtrl

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

func NewUserCtrl

func NewUserCtrl(store *model.Store, cfg OpenIDConfig) *UserCtrl

func (UserCtrl) Callback

func (ctrl UserCtrl) Callback(w http.ResponseWriter, r *http.Request)

func (UserCtrl) List

func (ctrl UserCtrl) List(w http.ResponseWriter, r *http.Request)

func (UserCtrl) Logout

func (ctrl UserCtrl) Logout(w http.ResponseWriter, r *http.Request)

func (UserCtrl) Protect

func (ctrl UserCtrl) Protect(next http.Handler) http.Handler

Jump to

Keyboard shortcuts

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