models

package
v0.0.0-...-77c089f Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFileArtifact

func CreateFileArtifact(fileArtifact *FileArtifact) error

func CreateTicket

func CreateTicket(ticket *Ticket) error

Create a ticket in the database

func GetAssociatedArtifacts

func GetAssociatedArtifacts(TicketID uint) (*[]FileArtifact, error)

func GetTickets

func GetTickets() (*[]Ticket, error)

func InitDB

func InitDB()

InitDB connects app to postgres databaset

func ProcessTicket

func ProcessTicket(ticket *Ticket)

ProcessTicket saves processed ticket in database

Types

type CreateTicketResponse

type CreateTicketResponse struct {
	Success        bool      `json:"success"`
	FileArtifacts  *[]string `json:"fileArtifacts"`
	MalwareMatches string    `json:"malwareMatches"`
}

type FileArtifact

type FileArtifact struct {
	TicketId uint   `json:"ticketID" gorm:"primary_key"`
	Filename string `json:"filename" gorm:"primary_key"`
	Data     []byte `json:"-"`
}

func GetArtifact

func GetArtifact(TicketID uint, FileName string) (*FileArtifact, error)

type Response

type Response struct {
	Success       bool            `json:"success"`
	Error         *ResponseError  `json:"error,omitempty"`
	Message       *string         `json:"message,omitempty"`
	Ticket        *Ticket         `json:"ticket,omitempty"`
	Tickets       *[]Ticket       `json:"tickets,omitempty"`
	FileArtifacts *[]FileArtifact `json:"fileArtifacts,omitempty"`
}

type ResponseError

type ResponseError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func (*ResponseError) Error

func (e *ResponseError) Error() string

Makes ResponseError satisfy builtin Error type. See: https://blog.golang.org/error-handling-and-go

type ScreenShot

type ScreenShot struct {
	gorm.Model
	TicketID  uint
	Width     int    `json:"width"`
	Height    int    `json:"height"`
	Filename  string `json:"filename",gorm:"size:255"`
	UserAgent string `json:"userAgent",gorm:"size:512"`
}

type Ticket

type Ticket struct {
	gorm.Model
	Name           string       `json:"name",gorm:"size:255"`
	URL            string       `json:"url",gorm:"size:4096"`
	Processed      bool         `json:"processed"`
	ScreenShot     []ScreenShot `json:"screenshots"`
	MalwareMatches string       `json:"malwareMatches",gorm:"size:4096"`
}

func GetTicketById

func GetTicketById(ID uint) (*Ticket, error)

Jump to

Keyboard shortcuts

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