Documentation ¶
Index ¶
- Constants
- Variables
- func FromId(id bson.ObjectId) string
- func Or(q bson.M) bson.M
- func TimeP(t time.Time) *time.Time
- func ToId(id string) bson.ObjectId
- func UpdateIssues(r *report.Report)
- func UpdateMulti(r *report.Report)
- type AgentFltr
- type AgentManager
- func (m *AgentManager) All() ([]*agent.Agent, int, error)
- func (m *AgentManager) Create(raw *agent.Agent) (*agent.Agent, error)
- func (m *AgentManager) FilterBy(f *AgentFltr) ([]*agent.Agent, int, error)
- func (m *AgentManager) FilterByQuery(query bson.M) ([]*agent.Agent, int, error)
- func (m *AgentManager) Fltr() *AgentFltr
- func (m *AgentManager) GetById(id bson.ObjectId) (*agent.Agent, error)
- func (s *AgentManager) Init() error
- func (m *AgentManager) Remove(obj *agent.Agent) error
- func (m *AgentManager) Update(obj *agent.Agent) error
- type CommentFltr
- type CommentManager
- func (m *CommentManager) Create(raw *comment.Comment) (*comment.Comment, error)
- func (m *CommentManager) FilterBy(f *CommentFltr, opts ...Opts) ([]*comment.Comment, int, error)
- func (m *CommentManager) FilterByQuery(query bson.M, opts ...Opts) ([]*comment.Comment, int, error)
- func (m *CommentManager) Fltr() *CommentFltr
- func (m *CommentManager) GetById(id bson.ObjectId) (*comment.Comment, error)
- func (s *CommentManager) Init() error
- func (m *CommentManager) Remove(obj *comment.Comment) error
- func (m *CommentManager) Update(obj *comment.Comment) error
- type FeedItemFltr
- type FeedManager
- func (m *FeedManager) AddScan(sc *scan.Scan) (*feed.FeedItem, error)
- func (m *FeedManager) Create(raw *feed.FeedItem) (*feed.FeedItem, error)
- func (m *FeedManager) Enrich(item *feed.FeedItem) error
- func (m *FeedManager) EnrichMulti(items []*feed.FeedItem) ([]*feed.FeedItem, error)
- func (m *FeedManager) FilterBy(f *FeedItemFltr, opts ...Opts) ([]*feed.FeedItem, int, error)
- func (m *FeedManager) FilterByQuery(query bson.M, opts ...Opts) ([]*feed.FeedItem, int, error)
- func (m *FeedManager) Fltr() *FeedItemFltr
- func (m *FeedManager) GetById(id bson.ObjectId) (*feed.FeedItem, error)
- func (s *FeedManager) Init() error
- func (m *FeedManager) Remove(obj *feed.FeedItem) error
- func (m *FeedManager) Update(obj *feed.FeedItem) error
- func (m *FeedManager) UpdateScan(sc *scan.Scan) error
- func (m *FeedManager) UpdateScanReport(sc *scan.Scan, rep *report.Report) error
- type FileManager
- type IssueFltr
- type IssueManager
- func (m *IssueManager) Create(raw *issue.TargetIssue) (*issue.TargetIssue, error)
- func (m *IssueManager) FilterBy(f *IssueFltr, opts ...Opts) ([]*issue.TargetIssue, int, error)
- func (m *IssueManager) FilterByQuery(query bson.M, opts ...Opts) ([]*issue.TargetIssue, int, error)
- func (m *IssueManager) Fltr() *IssueFltr
- func (m *IssueManager) GetById(id bson.ObjectId) (*issue.TargetIssue, error)
- func (m *IssueManager) GetByUniqId(target bson.ObjectId, uniqId string) (*issue.TargetIssue, error)
- func (s *IssueManager) Init() error
- func (m *IssueManager) Remove(obj *issue.TargetIssue) error
- func (m *IssueManager) RemoveAll(query bson.M) (int, error)
- func (m *IssueManager) Update(obj *issue.TargetIssue) error
- type Manager
- func (m *Manager) All(col *mgo.Collection, results interface{}) (int, error)
- func (m *Manager) Clone() *Manager
- func (m *Manager) Close()
- func (m *Manager) Copy() *Manager
- func (m *Manager) FilterAndSortBy(col *mgo.Collection, query *bson.M, sort []string, results interface{}) (int, error)
- func (m *Manager) FilterBy(col *mgo.Collection, query *bson.M, results interface{}, opts ...Opts) (int, error)
- func (m *Manager) FromId(id bson.ObjectId) string
- func (m *Manager) GetBy(col *mgo.Collection, query *bson.M, result interface{}, opts ...Opts) error
- func (m *Manager) GetById(col *mgo.Collection, id bson.ObjectId, result interface{}) error
- func (m *Manager) Init() error
- func (m *Manager) IsDup(err error) bool
- func (m *Manager) IsId(id string) bool
- func (m *Manager) IsNotFound(err error) bool
- func (m *Manager) NewId() bson.ObjectId
- func (m *Manager) Opts(skip, limit int, sort []string) Opts
- func (m *Manager) ToId(id string) bson.ObjectId
- type ManagerConfig
- type ManagerInterface
- type Opts
- type PermissionManager
- func (m *PermissionManager) Copy(new *PermissionManager)
- func (m *PermissionManager) HasProjectAccess(p *project.Project, u *user.User) bool
- func (m *PermissionManager) Init() error
- func (m *PermissionManager) IsAdmin(u *user.User) bool
- func (m *PermissionManager) IsAdminEmail(email string) bool
- func (m *PermissionManager) SetAdmins(emails []string)
- type PlanFltr
- type PlanManager
- func (m *PlanManager) All() ([]*plan.Plan, int, error)
- func (m *PlanManager) Create(raw *plan.Plan) (*plan.Plan, error)
- func (m *PlanManager) FilterBy(f *PlanFltr) ([]*plan.Plan, int, error)
- func (m *PlanManager) FilterByQuery(query bson.M) ([]*plan.Plan, int, error)
- func (m *PlanManager) Fltr() *PlanFltr
- func (m *PlanManager) GetById(id bson.ObjectId) (*plan.Plan, error)
- func (s *PlanManager) Init() error
- func (m *PlanManager) Remove(obj *plan.Plan) error
- func (m *PlanManager) Update(obj *plan.Plan) error
- type PluginFltr
- type PluginManager
- func (m *PluginManager) All() ([]*plugin.Plugin, int, error)
- func (m *PluginManager) Create(raw *plugin.Plugin) (*plugin.Plugin, error)
- func (m *PluginManager) FilterBy(f *PluginFltr) ([]*plugin.Plugin, int, error)
- func (m *PluginManager) FilterByQuery(query bson.M) ([]*plugin.Plugin, int, error)
- func (m *PluginManager) Fltr() *PluginFltr
- func (m *PluginManager) GetById(id string) (*plugin.Plugin, error)
- func (m *PluginManager) GetByName(name string) (*plugin.Plugin, error)
- func (m *PluginManager) GetByNameVersion(name, version string) (*plugin.Plugin, error)
- func (s *PluginManager) Init() error
- func (m *PluginManager) Update(obj *plugin.Plugin) error
- type ProjectFltr
- type ProjectManager
- func (m *ProjectManager) All() ([]*project.Project, int, error)
- func (m *ProjectManager) Create(raw *project.Project) (*project.Project, error)
- func (m *ProjectManager) CreateDefault(owner bson.ObjectId) (*project.Project, error)
- func (m *ProjectManager) FilterBy(f *ProjectFltr) ([]*project.Project, int, error)
- func (m *ProjectManager) FilterByQuery(query bson.M, opts ...Opts) ([]*project.Project, int, error)
- func (m *ProjectManager) GetById(id bson.ObjectId) (*project.Project, error)
- func (m *ProjectManager) Init() error
- func (m *ProjectManager) Update(obj *project.Project) error
- type ReportFltr
- type ReportManager
- func (m *ReportManager) All() ([]*report.Report, int, error)
- func (m *ReportManager) Create(raw *report.Report) (*report.Report, error)
- func (m *ReportManager) FilterBy(f *ReportFltr) ([]*report.Report, int, error)
- func (m *ReportManager) FilterByQuery(query bson.M) ([]*report.Report, int, error)
- func (m *ReportManager) FilterBySessions(sessions []*scan.Session) ([]*report.Report, int, error)
- func (m *ReportManager) Fltr() *ReportFltr
- func (m *ReportManager) GetById(id bson.ObjectId) (*report.Report, error)
- func (m *ReportManager) GetBySession(sessId bson.ObjectId) (*report.Report, error)
- func (s *ReportManager) Init() error
- func (m *ReportManager) Remove(obj *report.Report) error
- func (m *ReportManager) Update(obj *report.Report) error
- type ScanFltr
- type ScanManager
- func (m *ScanManager) All() ([]*scan.Scan, int, error)
- func (m *ScanManager) Create(raw *scan.Scan) (*scan.Scan, error)
- func (m *ScanManager) FilterBy(f *ScanFltr) ([]*scan.Scan, int, error)
- func (m *ScanManager) FilterByQuery(query bson.M) ([]*scan.Scan, int, error)
- func (m *ScanManager) Fltr() *ScanFltr
- func (m *ScanManager) GetById(id bson.ObjectId) (*scan.Scan, error)
- func (m *ScanManager) GetByMulti(ids []bson.ObjectId) (map[bson.ObjectId]*scan.Scan, error)
- func (s *ScanManager) Init() error
- func (m *ScanManager) Remove(obj *scan.Scan) error
- func (m *ScanManager) Update(obj *scan.Scan) error
- func (m *ScanManager) UpdateSession(sc *scan.Scan, obj *scan.Session) error
- type TargetFltr
- type TargetManager
- func (m *TargetManager) All() ([]*target.Target, int, error)
- func (m *TargetManager) Create(raw *target.Target) (*target.Target, error)
- func (m *TargetManager) FilterBy(f *FeedItemFltr) ([]*target.Target, int, error)
- func (m *TargetManager) FilterByQuery(query bson.M, opts ...Opts) ([]*target.Target, int, error)
- func (m *TargetManager) GetById(id bson.ObjectId) (*target.Target, error)
- func (m *TargetManager) GetSummaryIssues(targetId bson.ObjectId) (map[issue.Severity]int, error)
- func (m *TargetManager) Init() error
- func (m *TargetManager) Remove(obj *target.Target) error
- func (m *TargetManager) Update(obj *target.Target) error
- func (m *TargetManager) UpdateSummary(obj *target.Target) error
- func (m *TargetManager) UpdateSummaryById(id bson.ObjectId) error
- type TechFltr
- type TechManager
- func (m *TechManager) Create(raw *tech.TargetTech) (*tech.TargetTech, error)
- func (m *TechManager) FilterBy(f *TechFltr, opts ...Opts) ([]*tech.TargetTech, int, error)
- func (m *TechManager) FilterByQuery(query bson.M, opts ...Opts) ([]*tech.TargetTech, int, error)
- func (m *TechManager) Fltr() *TechFltr
- func (m *TechManager) GetById(id bson.ObjectId) (*tech.TargetTech, error)
- func (m *TechManager) GetByUniqId(target bson.ObjectId, uniqId string) (*tech.TargetTech, error)
- func (s *TechManager) Init() error
- func (m *TechManager) Remove(obj *tech.TargetTech) error
- func (m *TechManager) RemoveAll(query bson.M) (int, error)
- func (m *TechManager) Update(obj *tech.TargetTech) error
- type TokenFltr
- type TokenManager
- func (m *TokenManager) Create(raw *token.Token) (*token.Token, error)
- func (m *TokenManager) FilterBy(f *TokenFltr, opts ...Opts) ([]*token.Token, int, error)
- func (m *TokenManager) FilterByQuery(query bson.M, opts ...Opts) ([]*token.Token, int, error)
- func (m *TokenManager) Fltr() *TokenFltr
- func (m *TokenManager) GetByHash(hash string) (*token.Token, error)
- func (m *TokenManager) GetById(id bson.ObjectId) (*token.Token, error)
- func (m *TokenManager) GetOrCreate(userId bson.ObjectId) (*token.Token, error)
- func (s *TokenManager) Init() error
- func (m *TokenManager) Remove(obj *token.Token) error
- func (m *TokenManager) RemoveAll(query bson.M) (int, error)
- func (m *TokenManager) Update(obj *token.Token) error
- type UserFltr
- type UserManager
- func (m *UserManager) All() ([]*user.User, int, error)
- func (m *UserManager) Create(raw *user.User) (*user.User, error)
- func (m *UserManager) FilterBy(f *UserFltr, opts ...Opts) ([]*user.User, int, error)
- func (m *UserManager) FilterByQuery(query bson.M, opts ...Opts) ([]*user.User, int, error)
- func (m *UserManager) GetByEmail(email string) (*user.User, error)
- func (m *UserManager) GetById(id bson.ObjectId) (*user.User, error)
- func (m *UserManager) Init() error
- func (m *UserManager) Update(obj *user.User) error
- type VulndbManager
Constants ¶
const AgentEmail = "agent@local"
Variables ¶
var (
ErrNotFound = mgo.ErrNotFound // alias
)
Functions ¶
func UpdateIssues ¶
func UpdateMulti ¶
upgrade underneath multi reports with created/updated, scan, scanSession fields
Types ¶
type AgentManager ¶
type AgentManager struct {
// contains filtered or unexported fields
}
func (*AgentManager) FilterByQuery ¶
func (*AgentManager) Fltr ¶
func (m *AgentManager) Fltr() *AgentFltr
func (*AgentManager) Init ¶
func (s *AgentManager) Init() error
type CommentFltr ¶
type CommentManager ¶
type CommentManager struct {
// contains filtered or unexported fields
}
func (*CommentManager) FilterBy ¶
func (m *CommentManager) FilterBy(f *CommentFltr, opts ...Opts) ([]*comment.Comment, int, error)
func (*CommentManager) FilterByQuery ¶
func (*CommentManager) Fltr ¶
func (m *CommentManager) Fltr() *CommentFltr
func (*CommentManager) Init ¶
func (s *CommentManager) Init() error
type FeedItemFltr ¶
type FeedManager ¶
type FeedManager struct {
// contains filtered or unexported fields
}
func (*FeedManager) EnrichMulti ¶
func (*FeedManager) FilterBy ¶
func (m *FeedManager) FilterBy(f *FeedItemFltr, opts ...Opts) ([]*feed.FeedItem, int, error)
func (*FeedManager) FilterByQuery ¶
func (*FeedManager) Fltr ¶
func (m *FeedManager) Fltr() *FeedItemFltr
func (*FeedManager) Init ¶
func (s *FeedManager) Init() error
func (*FeedManager) UpdateScan ¶
func (m *FeedManager) UpdateScan(sc *scan.Scan) error
func (*FeedManager) UpdateScanReport ¶
type FileManager ¶
type FileManager struct {
// contains filtered or unexported fields
}
func (*FileManager) GetById ¶
func (m *FileManager) GetById(id string) (*file.File, error)
Get file by id, don't forget to close file after
func (*FileManager) Init ¶
func (m *FileManager) Init() error
type IssueFltr ¶
type IssueFltr struct { Updated time.Time `fltr:"updated,gte,gt,lte,lt"` VulnType int `fltr:"vulnType"` Created time.Time `fltr:"created,gte,gt,lte,lt"` ResolvedAt time.Time `fltr:"resolvedAt,gte,gt,lte,lt,in"` Target bson.ObjectId `fltr:"target,in"` Project bson.ObjectId `fltr:"project"` Confirmed *bool `fltr:"confirmed"` Muted *bool `fltr:"muted"` Resolved *bool `fltr:"resolved"` False *bool `fltr:"false"` Severity issue.Severity `fltr:"severity,in"` }
type IssueManager ¶
type IssueManager struct {
// contains filtered or unexported fields
}
func (*IssueManager) Create ¶
func (m *IssueManager) Create(raw *issue.TargetIssue) (*issue.TargetIssue, error)
func (*IssueManager) FilterBy ¶
func (m *IssueManager) FilterBy(f *IssueFltr, opts ...Opts) ([]*issue.TargetIssue, int, error)
func (*IssueManager) FilterByQuery ¶
func (m *IssueManager) FilterByQuery(query bson.M, opts ...Opts) ([]*issue.TargetIssue, int, error)
func (*IssueManager) Fltr ¶
func (m *IssueManager) Fltr() *IssueFltr
func (*IssueManager) GetById ¶
func (m *IssueManager) GetById(id bson.ObjectId) (*issue.TargetIssue, error)
func (*IssueManager) GetByUniqId ¶
func (m *IssueManager) GetByUniqId(target bson.ObjectId, uniqId string) (*issue.TargetIssue, error)
func (*IssueManager) Init ¶
func (s *IssueManager) Init() error
func (*IssueManager) Remove ¶
func (m *IssueManager) Remove(obj *issue.TargetIssue) error
func (*IssueManager) Update ¶
func (m *IssueManager) Update(obj *issue.TargetIssue) error
type Manager ¶
type Manager struct { Cfg ManagerConfig Users *UserManager Plugins *PluginManager Projects *ProjectManager Targets *TargetManager Plans *PlanManager Scans *ScanManager Agents *AgentManager Reports *ReportManager Feed *FeedManager Files *FileManager Comments *CommentManager Issues *IssueManager Techs *TechManager Tokens *TokenManager Permission *PermissionManager Vulndb *VulndbManager // contains filtered or unexported fields }
func New ¶
func New(db *mgo.Database, cfg ...ManagerConfig) *Manager
Manager contains all available managers for different models and hidden all db related operations
func (*Manager) Clone ¶
Clone works just like Copy, but also reuses the same socket as the original session, in case it had already reserved one due to its consistency guarantees. This behavior ensures that writes performed in the old session are necessarily observed when using the new session, as long as it was a strong or monotonic session. That said, it also means that long operations may cause other goroutines using the original session to wait.
func (*Manager) Close ¶
func (m *Manager) Close()
Close terminates the session. It's a runtime error to use a session after it has been closed.
func (*Manager) FilterAndSortBy ¶
func (*Manager) IsDup ¶
IsDup returns whether err informs of a duplicate key error because a primary key index or a secondary unique index already has an entry with the given value.
func (*Manager) IsNotFound ¶
Return true if object is not found
type ManagerConfig ¶
type ManagerConfig struct {
TextSearchEnable bool
}
type ManagerInterface ¶
type ManagerInterface interface {
Init() error
}
type PermissionManager ¶
type PermissionManager struct {
// contains filtered or unexported fields
}
func (*PermissionManager) Copy ¶
func (m *PermissionManager) Copy(new *PermissionManager)
func (*PermissionManager) HasProjectAccess ¶
func (*PermissionManager) Init ¶
func (m *PermissionManager) Init() error
func (*PermissionManager) IsAdminEmail ¶
func (m *PermissionManager) IsAdminEmail(email string) bool
func (*PermissionManager) SetAdmins ¶
func (m *PermissionManager) SetAdmins(emails []string)
type PlanFltr ¶
type PlanFltr struct { Name string `fltr:"name"` TargetType target.TargetType `fltr:"targetType,in"` }
type PlanManager ¶
type PlanManager struct {
// contains filtered or unexported fields
}
func (*PlanManager) FilterByQuery ¶
func (*PlanManager) Fltr ¶
func (m *PlanManager) Fltr() *PlanFltr
func (*PlanManager) Init ¶
func (s *PlanManager) Init() error
type PluginFltr ¶
type PluginFltr struct { Name string `fltr:"name,in"` Version string `fltr:"version,in,nin,gte,gt,lte,lte"` Type plugin.PluginType `fltr:"type,in,nin"` TargetType target.TargetType `fltr:"targetType,in"` }
type PluginManager ¶
type PluginManager struct {
// contains filtered or unexported fields
}
func (*PluginManager) FilterBy ¶
func (m *PluginManager) FilterBy(f *PluginFltr) ([]*plugin.Plugin, int, error)
func (*PluginManager) FilterByQuery ¶
func (*PluginManager) Fltr ¶
func (m *PluginManager) Fltr() *PluginFltr
func (*PluginManager) GetByName ¶
func (m *PluginManager) GetByName(name string) (*plugin.Plugin, error)
plugin name must be in format "name:version"
func (*PluginManager) GetByNameVersion ¶
func (m *PluginManager) GetByNameVersion(name, version string) (*plugin.Plugin, error)
func (*PluginManager) Init ¶
func (s *PluginManager) Init() error
type ProjectFltr ¶
type ProjectManager ¶
type ProjectManager struct {
// contains filtered or unexported fields
}
func (*ProjectManager) CreateDefault ¶
func (*ProjectManager) FilterBy ¶
func (m *ProjectManager) FilterBy(f *ProjectFltr) ([]*project.Project, int, error)
func (*ProjectManager) FilterByQuery ¶
func (*ProjectManager) Init ¶
func (m *ProjectManager) Init() error
type ReportFltr ¶
type ReportFltr struct {
Type report.ReportType `fltr:"type,in,nin"`
}
type ReportManager ¶
type ReportManager struct {
// contains filtered or unexported fields
}
func (*ReportManager) FilterBy ¶
func (m *ReportManager) FilterBy(f *ReportFltr) ([]*report.Report, int, error)
func (*ReportManager) FilterByQuery ¶
func (*ReportManager) FilterBySessions ¶
func (*ReportManager) Fltr ¶
func (m *ReportManager) Fltr() *ReportFltr
func (*ReportManager) GetBySession ¶
func (*ReportManager) Init ¶
func (s *ReportManager) Init() error
type ScanManager ¶
type ScanManager struct {
// contains filtered or unexported fields
}
func (*ScanManager) FilterByQuery ¶
func (*ScanManager) Fltr ¶
func (m *ScanManager) Fltr() *ScanFltr
func (*ScanManager) GetByMulti ¶
func (*ScanManager) Init ¶
func (s *ScanManager) Init() error
func (*ScanManager) UpdateSession ¶
type TargetFltr ¶
type TargetManager ¶
type TargetManager struct {
// contains filtered or unexported fields
}
func (*TargetManager) FilterBy ¶
func (m *TargetManager) FilterBy(f *FeedItemFltr) ([]*target.Target, int, error)
func (*TargetManager) FilterByQuery ¶
func (*TargetManager) GetSummaryIssues ¶
func (*TargetManager) Init ¶
func (m *TargetManager) Init() error
func (*TargetManager) UpdateSummary ¶
func (m *TargetManager) UpdateSummary(obj *target.Target) error
func (*TargetManager) UpdateSummaryById ¶
func (m *TargetManager) UpdateSummaryById(id bson.ObjectId) error
type TechManager ¶
type TechManager struct {
// contains filtered or unexported fields
}
func (*TechManager) Create ¶
func (m *TechManager) Create(raw *tech.TargetTech) (*tech.TargetTech, error)
func (*TechManager) FilterBy ¶
func (m *TechManager) FilterBy(f *TechFltr, opts ...Opts) ([]*tech.TargetTech, int, error)
func (*TechManager) FilterByQuery ¶
func (m *TechManager) FilterByQuery(query bson.M, opts ...Opts) ([]*tech.TargetTech, int, error)
func (*TechManager) Fltr ¶
func (m *TechManager) Fltr() *TechFltr
func (*TechManager) GetById ¶
func (m *TechManager) GetById(id bson.ObjectId) (*tech.TargetTech, error)
func (*TechManager) GetByUniqId ¶
func (m *TechManager) GetByUniqId(target bson.ObjectId, uniqId string) (*tech.TargetTech, error)
func (*TechManager) Init ¶
func (s *TechManager) Init() error
func (*TechManager) Remove ¶
func (m *TechManager) Remove(obj *tech.TargetTech) error
func (*TechManager) Update ¶
func (m *TechManager) Update(obj *tech.TargetTech) error
type TokenManager ¶
type TokenManager struct {
// contains filtered or unexported fields
}
func (*TokenManager) FilterByQuery ¶
func (*TokenManager) Fltr ¶
func (m *TokenManager) Fltr() *TokenFltr
func (*TokenManager) GetByHash ¶
func (m *TokenManager) GetByHash(hash string) (*token.Token, error)
func (*TokenManager) GetOrCreate ¶
func (*TokenManager) Init ¶
func (s *TokenManager) Init() error
type UserManager ¶
type UserManager struct {
// contains filtered or unexported fields
}
func (*UserManager) FilterByQuery ¶
func (*UserManager) GetByEmail ¶
func (m *UserManager) GetByEmail(email string) (*user.User, error)
func (*UserManager) Init ¶
func (m *UserManager) Init() error
type VulndbManager ¶
type VulndbManager struct {
// contains filtered or unexported fields
}
func (*VulndbManager) Copy ¶
func (m *VulndbManager) Copy(new *VulndbManager)
func (*VulndbManager) GetVulns ¶
func (m *VulndbManager) GetVulns() []*vuln.Vuln
func (*VulndbManager) Init ¶
func (m *VulndbManager) Init() error