db

package
v0.0.0-...-ded5ba8 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unknown  severity = "Unknown"
	Info     severity = "Info"
	Low      severity = "Low"
	Medium   severity = "Medium"
	High     severity = "High"
	Critical severity = "Critical"
)
View Source
const PrintMaxDescriptionLength = 150

PrintMaxDescriptionLength max length a description can have when printing as table

View Source
const PrintMaxURLLength = 65

PrintMaxURLLength max length a URL can have when printing as table

Variables

View Source
var (
	TaskStatusPending         string = "pending"
	TaskStatusCrawling        string = "crawling"
	TaskStatusScanning        string = "scanning"
	TaskStatusNuclei          string = "nuclei"
	TaskStatusRunning         string = "running"
	TaskStatusFinished        string = "finished"
	TaskStatusFailed          string = "failed"
	TaskStatusPaused          string = "paused"
	DefaultWorkspaceTaskTitle string = "Default task"
)
View Source
var Connection = InitDb()
View Source
var SourceBrowser = "Browser"
View Source
var SourceCrawler = "Crawler"
View Source
var SourceFuzzer = "Fuzzer"
View Source
var SourceHijack = "Hijack"
View Source
var SourceProxy = "Proxy"
View Source
var SourceRepeater = "Repeater"
View Source
var SourceScanner = "Scanner"
View Source
var TaskJobSortFieldMap = map[string]string{
	"id":                       "id",
	"history_method":           "histories.method",
	"history_url":              "histories.url",
	"history_status":           "histories.status_code",
	"history_parameters_count": "histories.parameters_count",
	"title":                    "title",
	"status":                   "status",
	"started_at":               "started_at",
	"completed_at":             "completed_at",
	"created_at":               "created_at",
	"updated_at":               "updated_at",
}

Functions

func GetDatabaseSize

func GetDatabaseSize() (string, error)

func GetSeverityOrder

func GetSeverityOrder(severityStr string) int

Helper function to get severity order based on the given severity string

func GetSitemapSources

func GetSitemapSources() []string

GetSitemapSources returns a list of sources that will be used to generate the sitemap

func IsValidSource

func IsValidSource(source string) bool

func NewSeverity

func NewSeverity(s string) severity

func Paginate

func Paginate(p *Pagination) func(db *gorm.DB) *gorm.DB

Paginate Gorm scope to paginate queries based on Paginator

func PrintHistory

func PrintHistory(history History)

PrintHistory prints a history record

func PrintInteraction

func PrintInteraction(interaction OOBInteraction) string

func PrintIssue

func PrintIssue(issue Issue)

Types

type BaseModel

type BaseModel struct {
	ID        uint           `gorm:"primaryKey" json:"id"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}

type BaseUUIDModel

type BaseUUIDModel struct {
	ID        uuid.UUID      `gorm:"type:uuid;primaryKey" json:"id"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}

func (*BaseUUIDModel) BeforeCreate

func (base *BaseUUIDModel) BeforeCreate(tx *gorm.DB) error

type BrowserActionScope

type BrowserActionScope string
const (
	BrowserActionScopeGlobal    BrowserActionScope = "global"
	BrowserActionScopeWorkspace BrowserActionScope = "workspace"
)

type DatabaseConnection

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

func InitDb

func InitDb() *DatabaseConnection

func (*DatabaseConnection) ConstructSitemap

func (d *DatabaseConnection) ConstructSitemap(filter SitemapFilter) ([]*SitemapNode, error)

func (*DatabaseConnection) CreateDefaultWorkspace

func (d *DatabaseConnection) CreateDefaultWorkspace() (*Workspace, error)

func (*DatabaseConnection) CreateHistory

func (d *DatabaseConnection) CreateHistory(record *History) (*History, error)

CreateHistory saves an history item to the database

func (*DatabaseConnection) CreateInteraction

func (d *DatabaseConnection) CreateInteraction(item *OOBInteraction) (*OOBInteraction, error)

CreateInteraction saves an issue to the database

func (*DatabaseConnection) CreateIssue

func (d *DatabaseConnection) CreateIssue(issue Issue) (Issue, error)

CreateIssue saves an issue to the database

func (*DatabaseConnection) CreateOOBTest

func (d *DatabaseConnection) CreateOOBTest(item OOBTest) (OOBTest, error)

CreateOOBTest saves an OOBTest to the database

func (*DatabaseConnection) CreatePlaygroundCollection

func (d *DatabaseConnection) CreatePlaygroundCollection(collection *PlaygroundCollection) error

CreatePlaygroundCollection creates a new PlaygroundCollection record.

func (*DatabaseConnection) CreatePlaygroundSession

func (d *DatabaseConnection) CreatePlaygroundSession(session *PlaygroundSession) error

CreatePlaygroundSession creates a new PlaygroundSession record.

func (*DatabaseConnection) CreateRefreshToken

func (d *DatabaseConnection) CreateRefreshToken(refreshToken *RefreshToken) error

func (*DatabaseConnection) CreateStoredBrowserActions

func (d *DatabaseConnection) CreateStoredBrowserActions(sba *StoredBrowserActions) (*StoredBrowserActions, error)

CreateStoredBrowserActions creates a new StoredBrowserActions record

func (*DatabaseConnection) CreateTask

func (d *DatabaseConnection) CreateTask(task *Task) (*Task, error)

func (*DatabaseConnection) CreateTaskJob

func (d *DatabaseConnection) CreateTaskJob(item *TaskJob) (*TaskJob, error)

func (*DatabaseConnection) CreateUser

func (d *DatabaseConnection) CreateUser(user *User) (*User, error)

func (*DatabaseConnection) CreateWebSocketConnection

func (d *DatabaseConnection) CreateWebSocketConnection(connection *WebSocketConnection) error

func (*DatabaseConnection) CreateWebSocketMessage

func (d *DatabaseConnection) CreateWebSocketMessage(message *WebSocketMessage) error

func (*DatabaseConnection) CreateWorkspace

func (d *DatabaseConnection) CreateWorkspace(workspace *Workspace) (*Workspace, error)

CreateWorkspace saves a workspace to the database

func (*DatabaseConnection) CreateWorkspaceCookie

func (d *DatabaseConnection) CreateWorkspaceCookie(cookie *WorkspaceCookie) error

func (*DatabaseConnection) DeactivateUser

func (d *DatabaseConnection) DeactivateUser(id uuid.UUID) error

func (*DatabaseConnection) DeleteHistory

func (d *DatabaseConnection) DeleteHistory(filter HistoryDeletionFilter) (deletedCount int64, err error)

DeleteHistory deletes history items based on the provided filter

func (*DatabaseConnection) DeleteRefreshToken

func (d *DatabaseConnection) DeleteRefreshToken(userID uuid.UUID) error

func (*DatabaseConnection) DeleteStoredBrowserActions

func (d *DatabaseConnection) DeleteStoredBrowserActions(id uint) error

DeleteStoredBrowserActions deletes a StoredBrowserActions record

func (*DatabaseConnection) DeleteTask

func (d *DatabaseConnection) DeleteTask(id uint) error

func (*DatabaseConnection) DeleteWorkspace

func (d *DatabaseConnection) DeleteWorkspace(id uint) error

DeleteWorkspace deletes a workspace by ID

func (*DatabaseConnection) DeleteWorkspaceCookie

func (d *DatabaseConnection) DeleteWorkspaceCookie(id uuid.UUID) error

func (*DatabaseConnection) GetChildrenHistories

func (d *DatabaseConnection) GetChildrenHistories(parent *History) ([]*HistorySummary, error)

func (*DatabaseConnection) GetCookiesForURL

func (d *DatabaseConnection) GetCookiesForURL(workspaceID uint, u *url.URL) []*http.Cookie

Helper functions to work with http.CookieJar interface

func (*DatabaseConnection) GetHistoriesByID

func (d *DatabaseConnection) GetHistoriesByID(ids []uint) ([]History, error)

GetHistoriesByID retrieves a list of history records by their IDs

func (*DatabaseConnection) GetHistory

func (d *DatabaseConnection) GetHistory(id uint) (history History, err error)

GetHistory get a single history record by ID

func (*DatabaseConnection) GetHistoryByID

func (d *DatabaseConnection) GetHistoryByID(id uint) (*History, error)

func (*DatabaseConnection) GetHistoryFromURL

func (d *DatabaseConnection) GetHistoryFromURL(urlString string) (history History, err error)

GetHistory get a single history record by URL

func (*DatabaseConnection) GetInteraction

func (d *DatabaseConnection) GetInteraction(interactionID uint) (*OOBInteraction, error)

GetInteraction fetches an OOBInteraction by its ID, including its associated OOBTest.

func (*DatabaseConnection) GetIssue

func (d *DatabaseConnection) GetIssue(id int, includeRelated bool) (issue Issue, err error)

GetIssue get a single issue by ID

func (*DatabaseConnection) GetOrCreateDefaultWorkspaceTask

func (d *DatabaseConnection) GetOrCreateDefaultWorkspaceTask(workspaceID uint) (*Task, error)

func (*DatabaseConnection) GetOrCreateJWTFromTokenAndHistory

func (d *DatabaseConnection) GetOrCreateJWTFromTokenAndHistory(jwtToken string, historyID uint) (*JsonWebToken, error)

GetOrCreateJWTFromTokenAndHistory checks if JWT with the same signature already exists in the DB

func (*DatabaseConnection) GetOrCreateWorkspace

func (d *DatabaseConnection) GetOrCreateWorkspace(workspace *Workspace) (*Workspace, error)

GetOrCreateWorkspace gets a workspace with the given code, or creates it if it doesn't exist

func (*DatabaseConnection) GetPlaygroundCollection

func (d *DatabaseConnection) GetPlaygroundCollection(id uint) (*PlaygroundCollection, error)

GetPlaygroundCollection retrieves a single PlaygroundCollection by its ID.

func (*DatabaseConnection) GetPlaygroundCollectionByID

func (d *DatabaseConnection) GetPlaygroundCollectionByID(id uint) (*PlaygroundCollection, error)

GetPlaygroundCollectionByID retrieves a PlaygroundCollection by its ID.

func (*DatabaseConnection) GetPlaygroundSession

func (d *DatabaseConnection) GetPlaygroundSession(id uint) (*PlaygroundSession, error)

GetPlaygroundSession retrieves a single PlaygroundSession by its ID.

func (*DatabaseConnection) GetPlaygroundSessionByID

func (d *DatabaseConnection) GetPlaygroundSessionByID(id uint) (*PlaygroundSession, error)

GetPlaygroundSessionByID retrieves a PlaygroundSession by its ID.

func (*DatabaseConnection) GetRefreshToken

func (d *DatabaseConnection) GetRefreshToken(userID uuid.UUID) (*RefreshToken, error)

func (*DatabaseConnection) GetRootHistoryNodes

func (d *DatabaseConnection) GetRootHistoryNodes(workspaceID uint) ([]*HistorySummary, error)

func (*DatabaseConnection) GetStoredBrowserActionsByID

func (d *DatabaseConnection) GetStoredBrowserActionsByID(id uint) (*StoredBrowserActions, error)

GetStoredBrowserActionsByID retrieves a StoredBrowserActions by its ID

func (*DatabaseConnection) GetSystemStats

func (d *DatabaseConnection) GetSystemStats() (SystemStats, error)

func (*DatabaseConnection) GetTaskByID

func (d *DatabaseConnection) GetTaskByID(id uint, fetchStats bool) (*Task, error)

func (*DatabaseConnection) GetTaskJobByID

func (d *DatabaseConnection) GetTaskJobByID(id uint) (*TaskJob, error)

func (*DatabaseConnection) GetTaskStats

func (d *DatabaseConnection) GetTaskStats(task *Task) (TaskStats, error)

func (*DatabaseConnection) GetTaskStatsFromID

func (d *DatabaseConnection) GetTaskStatsFromID(id uint) (TaskStats, error)

func (*DatabaseConnection) GetUserByEmail

func (d *DatabaseConnection) GetUserByEmail(email string) (*User, error)

func (*DatabaseConnection) GetUserByID

func (d *DatabaseConnection) GetUserByID(id uuid.UUID) (*User, error)

func (*DatabaseConnection) GetWebSocketConnection

func (d *DatabaseConnection) GetWebSocketConnection(id uint) (*WebSocketConnection, error)

func (*DatabaseConnection) GetWorkspaceByCode

func (d *DatabaseConnection) GetWorkspaceByCode(code string) (*Workspace, error)

GetWorkspaceByCode gets a workspace by code

func (*DatabaseConnection) GetWorkspaceByID

func (d *DatabaseConnection) GetWorkspaceByID(id uint) (*Workspace, error)

GetWorkspaceByID gets a workspace by ID

func (*DatabaseConnection) GetWorkspaceCookie

func (d *DatabaseConnection) GetWorkspaceCookie(id uuid.UUID) (*WorkspaceCookie, error)

func (*DatabaseConnection) GetWorkspaceStats

func (d *DatabaseConnection) GetWorkspaceStats(workspaceID uint) (WorkspaceStats, error)

func (*DatabaseConnection) HistoryExists

func (d *DatabaseConnection) HistoryExists(id uint) (bool, error)

HistoryExists checks if a history record exists

func (*DatabaseConnection) InitializeWorkspacePlayground

func (d *DatabaseConnection) InitializeWorkspacePlayground(workspaceID uint) error

func (*DatabaseConnection) ListHistory

func (d *DatabaseConnection) ListHistory(filter HistoryFilter) (items []*History, count int64, err error)

ListHistory Lists history

func (*DatabaseConnection) ListInteractions

func (d *DatabaseConnection) ListInteractions(filter InteractionsFilter) (items []*OOBInteraction, count int64, err error)

ListInteractions Lists interactions

func (*DatabaseConnection) ListIssues

func (d *DatabaseConnection) ListIssues(filter IssueFilter) (issues []*Issue, count int64, err error)

ListIssues Lists issues

func (*DatabaseConnection) ListIssuesGrouped

func (d *DatabaseConnection) ListIssuesGrouped(filter IssueFilter) ([]*GroupedIssue, error)

func (*DatabaseConnection) ListJsonWebTokens

func (d *DatabaseConnection) ListJsonWebTokens(filters JwtFilters) ([]*JsonWebToken, error)

func (*DatabaseConnection) ListPlaygroundCollections

func (d *DatabaseConnection) ListPlaygroundCollections(filters PlaygroundCollectionFilters) ([]*PlaygroundCollection, int64, error)

ListPlaygroundCollections retrieves a list of PlaygroundCollections with filters, sorting, and pagination.

func (*DatabaseConnection) ListPlaygroundSessions

func (d *DatabaseConnection) ListPlaygroundSessions(filters PlaygroundSessionFilters) ([]*PlaygroundSession, int64, error)

ListPlaygroundSessions retrieves a list of PlaygroundSessions with filters, sorting, and pagination.

func (*DatabaseConnection) ListStoredBrowserActions

func (d *DatabaseConnection) ListStoredBrowserActions(filter StoredBrowserActionsFilter) (items []*StoredBrowserActions, count int64, err error)

ListStoredBrowserActions retrieves a list of StoredBrowserActions based on the provided filter

func (*DatabaseConnection) ListTaskJobs

func (d *DatabaseConnection) ListTaskJobs(filter TaskJobFilter) (items []*TaskJob, count int64, err error)

func (*DatabaseConnection) ListTasks

func (d *DatabaseConnection) ListTasks(filter TaskFilter) (items []*Task, count int64, err error)

func (*DatabaseConnection) ListWebSocketConnections

func (d *DatabaseConnection) ListWebSocketConnections(filter WebSocketConnectionFilter) ([]WebSocketConnection, int64, error)

func (*DatabaseConnection) ListWebSocketMessages

func (d *DatabaseConnection) ListWebSocketMessages(filter WebSocketMessageFilter) ([]WebSocketMessage, int64, error)

func (*DatabaseConnection) ListWorkspaceCookies

func (d *DatabaseConnection) ListWorkspaceCookies(filter WorkspaceCookieFilter) ([]WorkspaceCookie, int64, error)

func (*DatabaseConnection) ListWorkspaces

func (d *DatabaseConnection) ListWorkspaces(filters WorkspaceFilters) (items []*Workspace, count int64, err error)

ListWorkspaces Lists workspaces

func (*DatabaseConnection) MatchInteractionWithOOBTest

func (d *DatabaseConnection) MatchInteractionWithOOBTest(interaction OOBInteraction) (OOBTest, error)

func (*DatabaseConnection) NewTask

func (d *DatabaseConnection) NewTask(workspaceID uint, playgroundSessionID *uint, title, status string, taskType TaskType) (*Task, error)

func (*DatabaseConnection) NewTaskJob

func (d *DatabaseConnection) NewTaskJob(taskID uint, title string, status TaskJobStatus, historyID uint) (*TaskJob, error)

func (*DatabaseConnection) SaveRefreshToken

func (d *DatabaseConnection) SaveRefreshToken(userID uuid.UUID, token string) error

func (*DatabaseConnection) SetCookiesForURL

func (d *DatabaseConnection) SetCookiesForURL(workspaceID uint, u *url.URL, cookies []*http.Cookie) error

func (*DatabaseConnection) SetTaskStatus

func (d *DatabaseConnection) SetTaskStatus(id uint, status string) error

func (*DatabaseConnection) TaskExists

func (d *DatabaseConnection) TaskExists(id uint) (bool, error)

TaskExists checks if a workspace exists

func (*DatabaseConnection) TaskHasPendingJobs

func (d *DatabaseConnection) TaskHasPendingJobs(taskID uint) (bool, error)

func (*DatabaseConnection) TaskJobExists

func (d *DatabaseConnection) TaskJobExists(id uint) (bool, error)

TaskJobExists checks if a task job exists

func (*DatabaseConnection) UpdateHistory

func (d *DatabaseConnection) UpdateHistory(record *History) (*History, error)

func (*DatabaseConnection) UpdateJWT

func (d *DatabaseConnection) UpdateJWT(jwtID uint, jwt *JsonWebToken) error

func (*DatabaseConnection) UpdatePlaygroundCollection

func (d *DatabaseConnection) UpdatePlaygroundCollection(id uint, collection *PlaygroundCollection) error

UpdatePlaygroundCollection updates an existing PlaygroundCollection record.

func (*DatabaseConnection) UpdatePlaygroundSession

func (d *DatabaseConnection) UpdatePlaygroundSession(id uint, session *PlaygroundSession) error

UpdatePlaygroundSession updates an existing PlaygroundSession record.

func (*DatabaseConnection) UpdateStoredBrowserActions

func (d *DatabaseConnection) UpdateStoredBrowserActions(id uint, sba *StoredBrowserActions) (*StoredBrowserActions, error)

UpdateStoredBrowserActions updates an existing StoredBrowserActions record

func (*DatabaseConnection) UpdateTask

func (d *DatabaseConnection) UpdateTask(id uint, task *Task) (*Task, error)

func (*DatabaseConnection) UpdateTaskJob

func (d *DatabaseConnection) UpdateTaskJob(item *TaskJob) (*TaskJob, error)

func (*DatabaseConnection) UpdateWebSocketConnection

func (d *DatabaseConnection) UpdateWebSocketConnection(connection *WebSocketConnection) error

func (*DatabaseConnection) UpdateWorkspace

func (d *DatabaseConnection) UpdateWorkspace(id uint, updatedWorkspace *Workspace) error

UpdateWorkspace updates a workspace by its ID with the provided fields

func (*DatabaseConnection) UpdateWorkspaceCookie

func (d *DatabaseConnection) UpdateWorkspaceCookie(cookie *WorkspaceCookie) error

func (*DatabaseConnection) WorkspaceExists

func (d *DatabaseConnection) WorkspaceExists(id uint) (bool, error)

WorkspaceExists checks if a workspace exists

type GroupedIssue

type GroupedIssue struct {
	Title    string       `json:"title"`
	Code     string       `json:"code"`
	Count    int          `json:"count"`
	Severity string       `json:"severity"`
	Items    []*IssueItem `json:"items"`
}

type History

type History struct {
	// Similar schema: https://github.com/gilcrest/httplog
	BaseModel
	StatusCode           int               `gorm:"index" json:"status_code"`
	URL                  string            `gorm:"index" json:"url"`
	Depth                int               `gorm:"index" json:"depth"`
	RequestHeaders       datatypes.JSON    `json:"request_headers"  swaggerignore:"true"`
	RequestBody          []byte            `json:"request_body"`
	RequestBodySize      int               `gorm:"index" json:"request_body_size"`
	RequestContentLength int64             `json:"request_content_length"`
	ResponseHeaders      datatypes.JSON    `json:"response_headers" swaggerignore:"true"`
	ResponseBody         []byte            `json:"response_body"`
	RequestContentType   string            `gorm:"index" json:"request_content_type"`
	ResponseBodySize     int               `gorm:"index" json:"response_body_size"`
	ResponseContentType  string            `gorm:"index" json:"response_content_type"`
	RawRequest           []byte            `json:"raw_request"`
	RawResponse          []byte            `json:"raw_response"`
	Method               string            `gorm:"index" json:"method"`
	Proto                string            `json:"proto" gorm:"index"`
	ParametersCount      int               `gorm:"index" json:"parameters_count"`
	Evaluated            bool              `gorm:"index" json:"evaluated"`
	Note                 string            `json:"note"`
	Source               string            `gorm:"index" json:"source"`
	JsonWebTokens        []JsonWebToken    `gorm:"many2many:json_web_token_histories;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"json_web_tokens"`
	Workspace            Workspace         `json:"-" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	WorkspaceID          *uint             `json:"workspace_id" gorm:"index"`
	TaskID               *uint             `json:"task_id" gorm:"index" `
	Task                 Task              `json:"-" gorm:"foreignKey:TaskID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	PlaygroundSessionID  *uint             `json:"playground_session_id" gorm:"index" `
	PlaygroundSession    PlaygroundSession `json:"-" gorm:"foreignKey:PlaygroundSessionID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
}

History holds table for storing requests history found

func (*History) GetRequestHeadersAsMap

func (h *History) GetRequestHeadersAsMap() (map[string][]string, error)

func (*History) GetResponseHeadersAsMap

func (h *History) GetResponseHeadersAsMap() (map[string][]string, error)

func (*History) GetResponseHeadersAsString

func (h *History) GetResponseHeadersAsString() (string, error)

func (History) Logger

func (h History) Logger() *zerolog.Logger

func (History) Pretty

func (h History) Pretty() string

func (History) ResponseHash

func (h History) ResponseHash() string

func (History) String

func (h History) String() string

func (History) TableHeaders

func (h History) TableHeaders() []string

func (History) TableRow

func (h History) TableRow() []string

type HistoryDeletionFilter

type HistoryDeletionFilter struct {
	StatusCodes          []int    `json:"status_codes"`
	Methods              []string `json:"methods"`
	ResponseContentTypes []string `json:"response_content_types"`
	RequestContentTypes  []string `json:"request_content_types"`
	Sources              []string `json:"sources"`
	WorkspaceID          uint     `json:"workspace_id"`
}

HistoryDeletionFilter holds criteria for deleting history items

type HistoryFilter

type HistoryFilter struct {
	Query                string     `json:"query" validate:"omitempty,ascii"`
	StatusCodes          []int      `json:"status_codes" validate:"omitempty,dive,gte=100,lte=599"`
	Methods              []string   `json:"methods" validate:"omitempty,dive,oneof=GET POST PUT DELETE PATCH HEAD OPTIONS TRACE"`
	ResponseContentTypes []string   `json:"response_content_types" validate:"omitempty,dive,ascii"`
	RequestContentTypes  []string   `json:"request_content_types" validate:"omitempty,dive,ascii"`
	Sources              []string   `json:"sources" validate:"omitempty,dive,ascii"`
	Pagination           Pagination `json:"pagination"`
	WorkspaceID          uint       `json:"workspace_id" validate:"omitempty,numeric"`
	SortBy               string     `` // Validate to be one of the listed fields
	/* 143-byte string literal not displayed */
	SortOrder           string `json:"sort_order" validate:"omitempty,oneof=asc desc"` // Validate to be either "asc" or "desc"
	TaskID              uint   `json:"task_id" validate:"omitempty,numeric"`
	IDs                 []uint `json:"ids" validate:"omitempty,dive,numeric"`
	PlaygroundSessionID uint   `json:"playground_session_id" validate:"omitempty,numeric"`
}

HistoryFilter represents available history filters

type HistorySummary

type HistorySummary struct {
	ID              uint   `json:"id"`
	Depth           int    `json:"depth"`
	URL             string `json:"url"`
	StatusCode      int    `json:"status_code"`
	Method          string `json:"method"`
	ParametersCount int    `json:"parameters_count"`
}

type IntSlice

type IntSlice []int

func (*IntSlice) Scan

func (c *IntSlice) Scan(value interface{}) error

func (IntSlice) Value

func (c IntSlice) Value() (driver.Value, error)

type InteractionsFilter

type InteractionsFilter struct {
	QTypes      []string
	Protocols   []string
	FullIDs     []string
	Pagination  Pagination
	WorkspaceID uint
}

type Issue

type Issue struct {
	BaseModel
	Code          string      `gorm:"index" json:"code"`
	Title         string      `gorm:"index" json:"title"`
	Description   string      `json:"description"`
	Details       string      `json:"details"`
	Remediation   string      `json:"remediation"`
	Cwe           int         `json:"cwe"`
	URL           string      `gorm:"index" json:"url"`
	StatusCode    int         `gorm:"index" json:"status_code"`
	HTTPMethod    string      `gorm:"index" json:"http_method"`
	Payload       string      `json:"payload"`
	Request       []byte      `json:"request"`
	Response      []byte      `json:"response"`
	FalsePositive bool        `gorm:"index" json:"false_positive"`
	Confidence    int         `gorm:"index" json:"confidence"`
	References    StringSlice `json:"references"`
	Severity      severity    `gorm:"index,type:severity;default:'Info'" json:"severity"`
	CURLCommand   string      `json:"curl_command"`
	Note          string      `json:"note"`
	Workspace     Workspace   `json:"-" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	WorkspaceID   *uint       `json:"workspace_id" gorm:"index"`
	// OriginalHistory   History          `json:"original_history" gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	// OriginalHistoryID *uint            `json:"original_history_id" gorm:"index"`
	Interactions          []OOBInteraction     `json:"interactions" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	Requests              []History            `json:"requests" gorm:"many2many:issue_requests;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	TaskID                *uint                `json:"task_id" gorm:"index"`
	Task                  Task                 `json:"-" gorm:"foreignKey:TaskID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	TaskJobID             *uint                `json:"task_job_id" gorm:"index;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	TaskJob               TaskJob              `json:"-" gorm:"foreignKey:TaskJobID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	WebsocketConnectionID *uint                `json:"websocket_connection_id" gorm:"index;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	WebSocketConnection   *WebSocketConnection `json:"-" gorm:"foreignKey:WebsocketConnectionID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
}

Issue holds table for storing issues found

func CreateIssueFromHistoryAndTemplate

func CreateIssueFromHistoryAndTemplate(history *History, code IssueCode, details string, confidence int, severity string, workspaceID, taskID, taskJobID *uint) (Issue, error)

func CreateIssueFromWebSocketConnectionAndTemplate

func CreateIssueFromWebSocketConnectionAndTemplate(connection *WebSocketConnection, code IssueCode, details string, confidence int, severity string, workspaceID, taskID, taskJobID *uint) (Issue, error)

func FillIssueFromHistoryAndTemplate

func FillIssueFromHistoryAndTemplate(history *History, code IssueCode, details string, confidence int, severity string, workspaceID, taskID, taskJobID *uint) *Issue

func FillIssueFromWebSocketConnectionAndTemplate

func FillIssueFromWebSocketConnectionAndTemplate(connection *WebSocketConnection, code IssueCode, details string, confidence int, severity string, workspaceID, taskID, taskJobID *uint) *Issue

func GetIssueTemplateByCode

func GetIssueTemplateByCode(code IssueCode) *Issue

func (Issue) AddInteraction

func (i Issue) AddInteraction(interaction OOBInteraction) error

AddInteraction adds an interaction to an issue in the database.

func (Issue) IsEmpty

func (i Issue) IsEmpty() bool

func (Issue) Pretty

func (i Issue) Pretty() string

func (Issue) String

func (i Issue) String() string

func (Issue) TableHeaders

func (i Issue) TableHeaders() []string

func (Issue) TableRow

func (i Issue) TableRow() []string

func (Issue) UpdateFalsePositive

func (i Issue) UpdateFalsePositive(value bool) error

UpdateFalsePositive updates the FalsePositive attribute of an issue in the database.

type IssueCode

type IssueCode string
var (
	ActivexDetectedCode                  IssueCode = "activex_detected"
	AdminInterfaceDetectedCode           IssueCode = "admin_interface_detected"
	ApacheStrutsDevModeCode              IssueCode = "apache_struts_dev_mode"
	ApacheTapestryExceptionCode          IssueCode = "apache_tapestry_exception"
	AspNetMvcHeaderCode                  IssueCode = "asp_net_mvc_header"
	AspnetTraceEnabledCode               IssueCode = "aspnet_trace_enabled"
	Base32EncodedDataInParameterCode     IssueCode = "base32_encoded_data_in_parameter"
	Base36EncodedDataInParameterCode     IssueCode = "base36_encoded_data_in_parameter"
	Base64EncodedDataInParameterCode     IssueCode = "base64_encoded_data_in_parameter"
	BlindSqlInjectionCode                IssueCode = "blind_sql_injection"
	CacheControlHeaderCode               IssueCode = "cache_control_header"
	CacheStorageUsageDetectedCode        IssueCode = "cache_storage_usage_detected"
	CdnDetectedCode                      IssueCode = "cdn_detected"
	CertificateErrorsCode                IssueCode = "certificate_errors"
	CiCdInfrastructureFileDetectedCode   IssueCode = "ci_cd_infrastructure_file_detected"
	ClientSidePrototypePollutionCode     IssueCode = "client_side_prototype_pollution"
	CloudDetectedCode                    IssueCode = "cloud_detected"
	ConsoleUsageDetectedCode             IssueCode = "console_usage_detected"
	CorsCode                             IssueCode = "cors"
	CrlfInjectionCode                    IssueCode = "crlf_injection"
	CsrfCode                             IssueCode = "csrf"
	CstiCode                             IssueCode = "csti"
	DatabaseErrorsCode                   IssueCode = "database_errors"
	DbConnectionStringsCode              IssueCode = "db_connection_strings"
	DbManagementInterfaceDetectedCode    IssueCode = "db_management_interface_detected"
	DirectoryListingCode                 IssueCode = "directory_listing"
	DjangoDebugExceptionCode             IssueCode = "django_debug_exception"
	DockerApiDetectedCode                IssueCode = "docker_api_detected"
	DomStorageEventsDetectedCode         IssueCode = "dom_storage_events_detected"
	ElmahExposedCode                     IssueCode = "elmah_exposed"
	EmailAddressesCode                   IssueCode = "email_addresses"
	EnvironmentFileExposedCode           IssueCode = "environment_file_exposed"
	EsiDetectedCode                      IssueCode = "esi_detected"
	EsiInjectionCode                     IssueCode = "esi_injection"
	ExposedApiCredentialsCode            IssueCode = "exposed_api_credentials"
	ExposedAxis2EndpointCode             IssueCode = "exposed_axis2_endpoint"
	ExposedCloudMetadataCode             IssueCode = "exposed_cloud_metadata"
	ExposedJolokiaEndpointCode           IssueCode = "exposed_jolokia_endpoint"
	ExposedLogFileCode                   IssueCode = "exposed_log_file"
	ExposedPrometheusMetricsCode         IssueCode = "exposed_prometheus_metrics"
	ExposedSpringActuatorEndpointsCode   IssueCode = "exposed_spring_actuator_endpoints"
	FileUploadDetectedCode               IssueCode = "file_upload_detected"
	FlashCrossdomainPolicyCode           IssueCode = "flash_crossdomain_policy"
	FlashUsageDetectedCode               IssueCode = "flash_usage_detected"
	ForbiddenBypassCode                  IssueCode = "forbidden_bypass"
	GrailsExceptionCode                  IssueCode = "grails_exception"
	GraphqlIntrospectionEnabledCode      IssueCode = "graphql_introspection_enabled"
	GraphqlEndpointDetectedCode          IssueCode = "graphql_endpoint_detected"
	GrpcEndpointDetectedCode             IssueCode = "grpc_endpoint_detected"
	HeaderInsightsReportCode             IssueCode = "header_insights_report"
	HostHeaderInjectionCode              IssueCode = "host_header_injection"
	Http2DetectedCode                    IssueCode = "http2_detected"
	Http3DetectedCode                    IssueCode = "http3_detected"
	HttpMethodsCode                      IssueCode = "http_methods"
	IdorCode                             IssueCode = "idor"
	IncorrectContentTypeHeaderCode       IssueCode = "incorrect_content_type_header"
	IndexeddbUsageDetectedCode           IssueCode = "indexeddb_usage_detected"
	JavaAppletDetectedCode               IssueCode = "java_applet_detected"
	JavaDeserializationCode              IssueCode = "java_deserialization"
	JavaSerializedObjectDetectedCode     IssueCode = "java_serialized_object_detected"
	JavaServerHeaderCode                 IssueCode = "java_server_header"
	JbossConsoleDetectedCode             IssueCode = "jboss_console_detected"
	JbossInvokerDetectedCode             IssueCode = "jboss_invoker_detected"
	JbossStatusDetectedCode              IssueCode = "jboss_status_detected"
	JettyServerHeaderCode                IssueCode = "jetty_server_header"
	JsonpEndpointDetectedCode            IssueCode = "jsonp_endpoint_detected"
	JwtDetectedCode                      IssueCode = "jwt_detected"
	JwtWeakSigningSecretCode             IssueCode = "jwt_weak_signing_secret"
	KubernetesApiDetectedCode            IssueCode = "kubernetes_api_detected"
	LdapInjectionCode                    IssueCode = "ldap_injection"
	Log4shellCode                        IssueCode = "log4shell"
	MissingContentTypeHeaderCode         IssueCode = "missing_content_type_header"
	MixedContentCode                     IssueCode = "mixed_content"
	NetworkAuthChallengeDetectedCode     IssueCode = "network_auth_challenge_detected"
	NosqlInjectionCode                   IssueCode = "nosql_injection"
	OauthEndpointDetectedCode            IssueCode = "oauth_endpoint_detected"
	OobCommunicationsCode                IssueCode = "oob_communications"
	OpenRedirectCode                     IssueCode = "open_redirect"
	OpenapiDefinitionFoundCode           IssueCode = "openapi_definition_found"
	OsCmdInjectionCode                   IssueCode = "os_cmd_injection"
	ParameterPollutionCode               IssueCode = "parameter_pollution"
	PasswordFieldAutocompleteEnabledCode IssueCode = "password_field_autocomplete_enabled"
	PasswordInGetRequestCode             IssueCode = "password_in_get_request"
	PaymentTestEndpointDetectedCode      IssueCode = "payment_test_endpoint_detected"
	PhpInfoDetectedCode                  IssueCode = "php_info_detected"
	PrivateIpsCode                       IssueCode = "private_ips"
	PrivateKeysCode                      IssueCode = "private_keys"
	ReactDevelopmentModeCode             IssueCode = "react_development_mode"
	ReflectedInputCode                   IssueCode = "reflected_input"
	RemoteFileInclusionCode              IssueCode = "remote_file_inclusion"
	SecretsInJsCode                      IssueCode = "secrets_in_js"
	SensitiveConfigDetectedCode          IssueCode = "sensitive_config_detected"
	ServerHeaderCode                     IssueCode = "server_header"
	ServerInfoDetectedCode               IssueCode = "server_info_detected"
	ServerSidePrototypePollutionCode     IssueCode = "server_side_prototype_pollution"
	SessionTokenInUrlCode                IssueCode = "session_token_in_url"
	SilverlightDetectedCode              IssueCode = "silverlight_detected"
	SniInjectionCode                     IssueCode = "sni_injection"
	SocketioDetectedCode                 IssueCode = "socketio_detected"
	SqlInjectionCode                     IssueCode = "sql_injection"
	SsiDetectedCode                      IssueCode = "ssi_detected"
	SsiInjectionCode                     IssueCode = "ssi_injection"
	SsoMetadataDetectedCode              IssueCode = "sso_metadata_detected"
	SsrfCode                             IssueCode = "ssrf"
	SstiCode                             IssueCode = "ssti"
	StorageBucketDetectedCode            IssueCode = "storage_bucket_detected"
	StrictTransportSecurityHeaderCode    IssueCode = "strict_transport_security_header"
	TechStackFingerprintCode             IssueCode = "tech_stack_fingerprint"
	Text4shellCode                       IssueCode = "text4shell"
	TomcatExamplesInfoLeakCode           IssueCode = "tomcat_examples_info_leak"
	TomcatUriNormalizationCode           IssueCode = "tomcat_uri_normalization"
	UnencryptedPasswordSubmissionCode    IssueCode = "unencrypted_password_submission"
	UnencryptedWebsocketConnectionCode   IssueCode = "unencrypted_websocket_connection"
	VersionControlFileDetectedCode       IssueCode = "version_control_file_detected"
	VulnerableJavascriptDependencyCode   IssueCode = "vulnerable_javascript_dependency"
	WafDetectedCode                      IssueCode = "waf_detected"
	WebassemblyDetectedCode              IssueCode = "webassembly_detected"
	WebserverControlFileExposedCode      IssueCode = "webserver_control_file_exposed"
	WebsocketDetectedCode                IssueCode = "websocket_detected"
	WordpressDetectedCode                IssueCode = "wordpress_detected"
	WsdlDefinitionDetectedCode           IssueCode = "wsdl_definition_detected"
	XAspVersionHeaderCode                IssueCode = "x_asp_version_header"
	XFrameOptionsHeaderCode              IssueCode = "x_frame_options_header"
	XPoweredByHeaderCode                 IssueCode = "x_powered_by_header"
	XXssProtectionHeaderCode             IssueCode = "x_xss_protection_header"
	XpathInjectionCode                   IssueCode = "xpath_injection"
	XsltInjectionCode                    IssueCode = "xslt_injection"
	XssReflectedCode                     IssueCode = "xss_reflected"
	XxeCode                              IssueCode = "xxe"
)

func (IssueCode) Name

func (i IssueCode) Name() string

func (IssueCode) String

func (i IssueCode) String() string

type IssueFilter

type IssueFilter struct {
	Codes         []string
	WorkspaceID   uint
	TaskID        uint
	TaskJobID     uint
	URL           string
	MinConfidence int
}

IssueFilter represents available issue filters

type IssueItem

type IssueItem struct {
	ID         uint   `json:"id"`
	URL        string `json:"url"`
	Confidence int    `json:"confidence"`
}

type IssueTemplate

type IssueTemplate struct {
	Code        IssueCode `json:"code"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
	Remediation string    `json:"remediation"`
	Cwe         int       `json:"cwe"`
	Severity    string    `json:"severity"`
	References  []string  `json:"references"`
}

type IssuesStats

type IssuesStats struct {
	Unknown  int64 `json:"unknown"`
	Info     int64 `json:"info"`
	Low      int64 `json:"low"`
	Medium   int64 `json:"medium"`
	High     int64 `json:"high"`
	Critical int64 `json:"critical"`
}

type JsonWebToken

type JsonWebToken struct {
	BaseModel
	Token                  string         `gorm:"type:text" json:"token"`
	Header                 datatypes.JSON `gorm:"type:json" json:"header" swaggerignore:"true"`
	Payload                datatypes.JSON `gorm:"type:json" json:"payload" swaggerignore:"true"`
	Signature              string         `gorm:"type:text" json:"signature"`
	Algorithm              string         `gorm:"type:text" json:"algorithm"`
	Issuer                 string         `gorm:"type:text" json:"issuer"`
	Subject                string         `gorm:"type:text" json:"subject"`
	Audience               string         `gorm:"type:text" json:"audience"`
	Expiration             time.Time      `gorm:"type:timestamp" json:"expiration"`
	IssuedAt               time.Time      `gorm:"type:timestamp" json:"issued_at"`
	Histories              []History      `gorm:"many2many:json_web_token_histories;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"histories"`
	Workspace              Workspace      `json:"-" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	WorkspaceID            *uint          `json:"workspace_id"`
	TestedEmbeddedWordlist bool           `json:"tested_embedded_wordlist"`
	Cracked                bool           `json:"cracked"`
	Secret                 string         `json:"secret"`
}

func FillJwtFromToken

func FillJwtFromToken(jwtToken string) (*JsonWebToken, error)

FillJwtFromToken fills a JsonWebToken struct with data extracted from the given JWT token.

func (JsonWebToken) Pretty

func (j JsonWebToken) Pretty() string

func (JsonWebToken) String

func (j JsonWebToken) String() string

func (JsonWebToken) TableHeaders

func (j JsonWebToken) TableHeaders() []string

func (JsonWebToken) TableRow

func (j JsonWebToken) TableRow() []string

type JwtFilters

type JwtFilters struct {
	Algorithm   string `json:"algorithm" validate:"omitempty,oneof=HS256 HS384 HS512 RS256 RS384 RS512 ES256 ES384 ES512"`
	Issuer      string `json:"issuer"`
	Subject     string `json:"subject"`
	Audience    string `json:"audience"`
	SortBy      string `json:"sort_by" validate:"omitempty,oneof=token header issuer id algorithm subject audience expiration issued_at"` // Example validation rule for sort_by
	SortOrder   string `json:"sort_order" validate:"omitempty,oneof=asc desc"`                                                            // Example validation rule for sort_order
	WorkspaceID uint   `json:"workspace_id" validate:"omitempty,numeric"`
}

type MessageDirection

type MessageDirection string
const (
	MessageSent     MessageDirection = "sent"
	MessageReceived MessageDirection = "received"
)

type OOBInteraction

type OOBInteraction struct {
	BaseModel
	OOBTestID *uint   `json:"oob_test_id"`
	OOBTest   OOBTest `gorm:"foreignKey:OOBTestID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"`

	Protocol      string    `json:"protocol"`
	FullID        string    `json:"full_id"`
	UniqueID      string    `json:"unique_id"`
	QType         string    `json:"qtype"`
	RawRequest    string    `json:"raw_request"`
	RawResponse   string    `json:"raw_response"`
	RemoteAddress string    `json:"remote_address"`
	Timestamp     time.Time `json:"timestamp"`
	Workspace     Workspace `json:"-" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	WorkspaceID   *uint     `json:"workspace_id"`
	IssueID       *uint     `json:"issue_id"`
}

func (OOBInteraction) Pretty

func (o OOBInteraction) Pretty() string

func (OOBInteraction) String

func (o OOBInteraction) String() string

func (OOBInteraction) TableHeaders

func (o OOBInteraction) TableHeaders() []string

func (OOBInteraction) TableRow

func (o OOBInteraction) TableRow() []string

type OOBTest

type OOBTest struct {
	BaseModel
	Code              IssueCode `json:"code"`
	TestName          string    `json:"test_name"`
	Target            string    `json:"target"`
	HistoryID         *uint     `json:"history_id"`
	HistoryItem       *History  `json:"-" gorm:"foreignKey:HistoryID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"`
	InteractionDomain string    `gorm:"index" json:"interaction_domain"`
	InteractionFullID string    `gorm:"index" json:"interaction_id"`
	Payload           string    `json:"payload"`
	InsertionPoint    string    `json:"insertion_point"`
	Workspace         Workspace `json:"-" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	WorkspaceID       *uint     `json:"workspace_id"`
	Task              Task      `json:"-" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	TaskID            *uint     `json:"task_id"`
	TaskJobID         *uint     `json:"task_job_id" gorm:"index;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	TaskJob           TaskJob   `json:"-" gorm:"foreignKey:TaskJobID"`
}

func (OOBTest) Pretty

func (o OOBTest) Pretty() string

func (OOBTest) String

func (o OOBTest) String() string

func (OOBTest) TableHeaders

func (o OOBTest) TableHeaders() []string

func (OOBTest) TableRow

func (o OOBTest) TableRow() []string

type Pagination

type Pagination struct {
	Page     int `json:"page" validate:"min=1"`
	PageSize int `json:"page_size" validate:"min=1,max=100000"`
}

Pagination used to store pagination config

func (*Pagination) GetData

func (p *Pagination) GetData() (offset int, limit int)

type PlaygroundCollection

type PlaygroundCollection struct {
	BaseModel
	Name        string              `json:"name"`
	Description string              `json:"description"`
	Sessions    []PlaygroundSession `gorm:"foreignKey:CollectionID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	WorkspaceID uint                `json:"workspace_id" gorm:"index"`
	Workspace   Workspace           `json:"-" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
}

PlaygroundCollection represents a collection of playground sessions.

type PlaygroundCollectionFilters

type PlaygroundCollectionFilters struct {
	Query       string `json:"query"`
	SortBy      string `json:"sort_by" validate:"omitempty,oneof=id name description created_at updated_at"`
	SortOrder   string `json:"sort_order" validate:"omitempty,oneof=asc desc"`
	WorkspaceID uint   `json:"workspace_id" validate:"omitempty,numeric"`
	Pagination
}

PlaygroundCollectionFilters contains filters for listing PlaygroundCollections.

type PlaygroundSession

type PlaygroundSession struct {
	BaseModel
	Name string                `json:"name"`
	Type PlaygroundSessionType `json:"type"`
	// OriginalRequest   History               `json:"-" gorm:"foreignKey:OriginalRequestID"`
	OriginalRequestID *uint `json:"original_request_id"`
	// Task              Task                 `json:"-" gorm:"foreignKey:TaskID"`
	// TaskID            *uint                `json:"task_id"`
	CollectionID uint                 `json:"collection_id"`
	Collection   PlaygroundCollection `json:"-" gorm:"foreignKey:CollectionID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	WorkspaceID  uint                 `json:"workspace_id" gorm:"index"`
	Workspace    Workspace            `json:"-" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	Histories    []History            `gorm:"foreignKey:PlaygroundSessionID" json:"-"`
}

PlaygroundSession represents a playground session.

type PlaygroundSessionFilters

type PlaygroundSessionFilters struct {
	Query             string                `json:"query"`
	Type              PlaygroundSessionType `json:"type"`
	OriginalRequestID uint                  `json:"original_request_id"`
	// TaskID            uint                  `json:"task_id"`
	CollectionID uint   `json:"collection_id"`
	WorkspaceID  uint   `json:"workspace_id"`
	SortBy       string `json:"sort_by" validate:"omitempty,oneof=id name type workspace_id collection_id created_at updated_at"`
	SortOrder    string `json:"sort_order" validate:"omitempty,oneof=asc desc"`
	Pagination
}

PlaygroundSessionFilters contains filters for listing PlaygroundSessions.

type PlaygroundSessionType

type PlaygroundSessionType string

PlaygroundSessionType represents the type of a playground session.

const (
	ManualType PlaygroundSessionType = "manual"
	FuzzType   PlaygroundSessionType = "fuzz"
)

type Policy

type Policy struct {
	BaseModel
	Name        string `json:"name"`
	Description string `json:"description"`
}

type RefreshToken

type RefreshToken struct {
	BaseUUIDModel
	UserID uuid.UUID `gorm:"type:uuid;not null"`
	Token  string    `gorm:"type:text;not null"`
}

type RequestsStats

type RequestsStats struct {
	Crawler          int64 `json:"crawler"`
	Scanner          int64 `json:"scanner"`
	PlaygroundFuzzer int64 `json:"playground_fuzzer"`
}

type SitemapFilter

type SitemapFilter struct {
	WorkspaceID uint `json:"workspace_id" validate:"omitempty,numeric"`
	TaskID      uint `json:"task_id" validate:"omitempty,numeric"`
}

type SitemapNode

type SitemapNode struct {
	ID       uint            `json:"id"`
	OtherIDs []uint          `json:"other_ids,omitempty"`
	Depth    int             `json:"depth"`
	URL      string          `json:"url"`
	Path     string          `json:"path"`
	Type     SitemapNodeType `json:"type"`
	Children []*SitemapNode  `json:"children"`
}

type SitemapNodeType

type SitemapNodeType string
const (
	// Generic
	SitemapNodeTypeRoot      SitemapNodeType = "root"
	SitemapNodeTypeDirectory SitemapNodeType = "directory"
	SitemapNodeTypeFile      SitemapNodeType = "file"
	SitemapNodeTypeQuery     SitemapNodeType = "query"
	// Specific (file extensions)
	SitemapNodeTypePhp      SitemapNodeType = "php"
	SitemapNodeTypeAsp      SitemapNodeType = "asp"
	SitemapNodeTypeJsp      SitemapNodeType = "jsp"
	SitemapNodeTypeJs       SitemapNodeType = "js"
	SitemapNodeTypeCss      SitemapNodeType = "css"
	SitemapNodeTypeHtml     SitemapNodeType = "html"
	SitemapNodeTypeXml      SitemapNodeType = "xml"
	SitemapNodeTypeJson     SitemapNodeType = "json"
	SitemapNodeTypeYaml     SitemapNodeType = "yaml"
	SitemapNodeTypeSql      SitemapNodeType = "sql"
	SitemapNodeTypeImage    SitemapNodeType = "image"
	SitemapNodeTypeVideo    SitemapNodeType = "video"
	SitemapNodeTypeAudio    SitemapNodeType = "audio"
	SitemapNodeTypeMarkdown SitemapNodeType = "markdown"
	SitemapNodeTypeFont     SitemapNodeType = "font"
	SitemapNodeTypeText     SitemapNodeType = "text"
)

type StoredBrowserActions

type StoredBrowserActions struct {
	BaseModel
	Title       string             `json:"title" gorm:"index"`
	Actions     []actions.Action   `json:"actions" gorm:"serializer:json"`
	Scope       BrowserActionScope `json:"scope" gorm:"index"`
	Workspace   Workspace          `json:"-" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	WorkspaceID *uint              `json:"workspace_id" gorm:"index"`
}

func (StoredBrowserActions) Pretty

func (sba StoredBrowserActions) Pretty() string

Pretty provides a more formatted, user-friendly representation of the StoredBrowserActions

func (StoredBrowserActions) String

func (sba StoredBrowserActions) String() string

String provides a basic textual representation of the StoredBrowserActions

func (StoredBrowserActions) TableHeaders

func (sba StoredBrowserActions) TableHeaders() []string

TableHeaders returns the headers for the StoredBrowserActions table

func (StoredBrowserActions) TableRow

func (sba StoredBrowserActions) TableRow() []string

TableRow returns a row representation of StoredBrowserActions for display in a table

type StoredBrowserActionsFilter

type StoredBrowserActionsFilter struct {
	Query       string             `json:"query" validate:"omitempty,ascii"`
	Scope       BrowserActionScope `json:"scope" validate:"omitempty,oneof=global workspace"`
	WorkspaceID *uint              `json:"workspace_id" validate:"omitempty,numeric"`
	Pagination  Pagination         `json:"pagination"`
}

StoredBrowserActionsFilter defines the filter for listing StoredBrowserActions

type StringSlice

type StringSlice []string

func (*StringSlice) Scan

func (c *StringSlice) Scan(value interface{}) error

func (StringSlice) Value

func (c StringSlice) Value() (driver.Value, error)

type SystemStats

type SystemStats struct {
	DatabaseSize string `json:"database_size"`
}

type Task

type Task struct {
	BaseModel
	Title               string                  `json:"title"`
	Type                TaskType                `gorm:"index" json:"type"`
	Status              string                  `gorm:"index" json:"status"`
	StartedAt           time.Time               `json:"started_at"`
	FinishedAt          time.Time               `json:"finished_at"`
	Workspace           Workspace               `json:"-" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	WorkspaceID         uint                    `json:"workspace_id" gorm:"index" `
	Histories           []History               `gorm:"foreignKey:TaskID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"-"`
	Issues              []Issue                 `gorm:"foreignKey:TaskID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"-"`
	Stats               TaskStats               `gorm:"-" json:"stats,omitempty"`
	PlaygroundSessionID *uint                   `gorm:"index" json:"playground_session_id"`
	PlaygroundSession   PlaygroundSession       `json:"-" gorm:"foreignKey:PlaygroundSessionID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	ScanOptions         options.FullScanOptions `gorm:"serializer:json" json:"scan_options"`
}

func (Task) Pretty

func (t Task) Pretty() string

Pretty provides a more formatted, user-friendly representation of the Task.

func (Task) String

func (t Task) String() string

String provides a basic textual representation of the Task.

func (Task) TableHeaders

func (t Task) TableHeaders() []string

func (Task) TableRow

func (t Task) TableRow() []string

type TaskFilter

type TaskFilter struct {
	Query               string     `json:"query" validate:"omitempty,dive,ascii"`
	Statuses            []string   `json:"statuses" validate:"omitempty,dive,oneof=crawling scanning nuclei running finished failed paused"`
	Pagination          Pagination `json:"pagination"`
	WorkspaceID         uint       `json:"workspace_id" validate:"omitempty,numeric"`
	FetchStats          bool       `json:"fetch_stats"`
	PlaygroundSessionID uint       `json:"playground_session_id"`
}

type TaskJob

type TaskJob struct {
	BaseModel
	Title       string        `json:"title"`
	TaskID      uint          `json:"task_id"`
	Task        Task          `json:"-" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	Status      TaskJobStatus `gorm:"index" json:"status"`
	StartedAt   time.Time     `json:"started_at"`
	CompletedAt time.Time     `json:"completed_at"`
	HistoryID   uint          `json:"history_id"`
	History     History       `json:"history" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
}

type TaskJobFilter

type TaskJobFilter struct {
	Query       string     `json:"query" validate:"omitempty,dive,ascii"`
	Statuses    []string   `json:"statuses" validate:"omitempty,dive,oneof=scheduled running finished failed"`
	Titles      []string   `json:"titles" validate:"omitempty,dive,ascii"`
	Pagination  Pagination `json:"pagination"`
	TaskID      uint       `json:"task_id" validate:"omitempty,numeric"`
	StatusCodes []int      `json:"status_codes" validate:"omitempty,dive,numeric"`
	Methods     []string   `json:"methods" validate:"omitempty,dive,oneof=GET POST PUT DELETE PATCH HEAD OPTIONS TRACE"`
	SortBy      string     `` /* 170-byte string literal not displayed */
	SortOrder   string     `json:"sort_order" validate:"omitempty,oneof=asc desc"`
}

type TaskJobStatus

type TaskJobStatus string
var (
	TaskJobScheduled TaskJobStatus = "scheduled"
	TaskJobRunning   TaskJobStatus = "running"
	TaskJobFinished  TaskJobStatus = "finished"
	TaskJobFailed    TaskJobStatus = "failed"
)

type TaskStats

type TaskStats struct {
	Requests RequestsStats `json:"requests"`
	Issues   IssuesStats   `json:"issues"`
}

func (TaskStats) Summary

func (s TaskStats) Summary() string

type TaskType

type TaskType string
const (
	TaskTypeScan             TaskType = "scan"
	TaskTypePlaygroundFuzzer TaskType = "playground-fuzzer"
	TaskTypePlaygroundManual TaskType = "playground-manual"
	TaskTypeBrowser          TaskType = "browser"
	TaskTypeCrawl            TaskType = "crawl"
)

type User

type User struct {
	BaseUUIDModel
	Email        string `gorm:"type:varchar(255);not null;unique" json:"email" validate:"required,email,lte=255"`
	PasswordHash string `json:"password_hash,omitempty"`
	Active       bool   `json:"active" validate:"required,len=1"`
}

type WebSocketConnection

type WebSocketConnection struct {
	BaseModel
	URL             string             `json:"url"`
	RequestHeaders  datatypes.JSON     `json:"request_headers" swaggerignore:"true"`
	ResponseHeaders datatypes.JSON     `json:"response_headers" swaggerignore:"true"`
	StatusCode      int                `gorm:"index" json:"status_code"`
	StatusText      string             `json:"status_text"`
	Messages        []WebSocketMessage `json:"messages" gorm:"foreignKey:ConnectionID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	ClosedAt        time.Time          `json:"closed_at"` // timestamp for when the connection is closed
	Workspace       Workspace          `json:"-" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	WorkspaceID     *uint              `json:"workspace_id"`
	TaskID          *uint              `json:"task_id" gorm:"index" `
	Task            Task               `json:"-" gorm:"foreignKey:TaskID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	Source          string             `json:"source"`
}

func (*WebSocketConnection) GetRequestHeadersAsMap

func (c *WebSocketConnection) GetRequestHeadersAsMap() (map[string][]string, error)

func (*WebSocketConnection) GetRequestHeadersAsString

func (c *WebSocketConnection) GetRequestHeadersAsString() (string, error)

func (*WebSocketConnection) GetResponseHeadersAsMap

func (c *WebSocketConnection) GetResponseHeadersAsMap() (map[string][]string, error)

func (*WebSocketConnection) GetResponseHeadersAsString

func (c *WebSocketConnection) GetResponseHeadersAsString() (string, error)

func (WebSocketConnection) Pretty

func (c WebSocketConnection) Pretty() string

func (WebSocketConnection) String

func (c WebSocketConnection) String() string

func (WebSocketConnection) TableHeaders

func (c WebSocketConnection) TableHeaders() []string

func (WebSocketConnection) TableRow

func (c WebSocketConnection) TableRow() []string

type WebSocketConnectionFilter

type WebSocketConnectionFilter struct {
	Pagination
	WorkspaceID uint     `json:"workspace_id" validate:"required"`
	TaskID      uint     `json:"task_id"`
	Sources     []string `json:"sources" validate:"omitempty,dive,ascii"`
}

type WebSocketMessage

type WebSocketMessage struct {
	BaseModel
	ConnectionID uint             `json:"connection_id"`
	Opcode       float64          `json:"opcode"`
	Mask         bool             `gorm:"index" json:"mask"`
	PayloadData  string           `json:"payload_data"`
	Timestamp    time.Time        `json:"timestamp"`              // timestamp for when the message was sent/received
	Direction    MessageDirection `gorm:"index" json:"direction"` // direction of the message
}

func (WebSocketMessage) Pretty

func (m WebSocketMessage) Pretty() string

func (WebSocketMessage) String

func (m WebSocketMessage) String() string

func (WebSocketMessage) TableHeaders

func (m WebSocketMessage) TableHeaders() []string

func (WebSocketMessage) TableRow

func (m WebSocketMessage) TableRow() []string

type WebSocketMessageFilter

type WebSocketMessageFilter struct {
	Pagination
	ConnectionID uint
}

type Workspace

type Workspace struct {
	BaseModel
	Code        string `gorm:"index,unique" json:"code"`
	Title       string `json:"title"`
	Description string `json:"description"`
}

Workspace is used to group projects

func (Workspace) Pretty

func (w Workspace) Pretty() string

Pretty provides a more formatted, user-friendly representation of the Workspace.

func (Workspace) String

func (w Workspace) String() string

String provides a basic textual representation of the Workspace.

func (Workspace) TableHeaders

func (w Workspace) TableHeaders() []string

func (Workspace) TableRow

func (w Workspace) TableRow() []string

type WorkspaceCookie

type WorkspaceCookie struct {
	BaseUUIDModel
	WorkspaceID *uint     `json:"workspace_id" gorm:"index"`
	Workspace   Workspace `json:"-" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	Name        string    `json:"name" gorm:"index"`
	Value       string    `json:"value"`
	Domain      string    `json:"domain" gorm:"index"`
	Path        string    `json:"path"`
	Expires     time.Time `json:"expires"`
	MaxAge      int       `json:"max_age"`
	Secure      bool      `json:"secure"`
	HttpOnly    bool      `json:"http_only"`
	SameSite    string    `json:"same_site"`
}

WorkspaceCookie represents a single cookie stored for a workspace

func (WorkspaceCookie) TableHeaders

func (c WorkspaceCookie) TableHeaders() []string

func (WorkspaceCookie) TableRow

func (c WorkspaceCookie) TableRow() []string

func (WorkspaceCookie) ToHTTPCookie

func (c WorkspaceCookie) ToHTTPCookie() *http.Cookie

type WorkspaceCookieFilter

type WorkspaceCookieFilter struct {
	Pagination
	WorkspaceID uint   `json:"workspace_id" validate:"required"`
	Domain      string `json:"domain"`
	Name        string `json:"name"`
}

type WorkspaceCookieJar

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

CookieJar type that implements http.CookieJar interface

func NewWorkspaceCookieJar

func NewWorkspaceCookieJar(workspaceID uint) *WorkspaceCookieJar

func (*WorkspaceCookieJar) Cookies

func (j *WorkspaceCookieJar) Cookies(u *url.URL) []*http.Cookie

func (*WorkspaceCookieJar) SetCookies

func (j *WorkspaceCookieJar) SetCookies(u *url.URL, cookies []*http.Cookie)

type WorkspaceFilters

type WorkspaceFilters struct {
	Query      string `json:"query" validate:"omitempty,dive,ascii"`
	Pagination Pagination
}

type WorkspaceStats

type WorkspaceStats struct {
	IssuesCount               int64         `json:"issues_count"`
	JWTCount                  int64         `json:"jwt_count"`
	HistoryCount              int64         `json:"history_count"`
	WebsocketConnectionsCount int64         `json:"websocket_connections_count"`
	TasksCount                int64         `json:"tasks_count"`
	Requests                  RequestsStats `json:"requests"`
	Issues                    IssuesStats   `json:"issues"`
}

Jump to

Keyboard shortcuts

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