entity

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UserKey identifies the current user during the request life.
	UserKey contextKey = iota

	// SourceKey identifies the source of the HTTP request (web or api).
	SourceKey
)

Variables

This section is empty.

Functions

func ID

func ID() string

ID returns a unique ID to identify a document.

func IsValidID added in v0.4.0

func IsValidID(id string) bool

IsValidID returns true when ID is valid.

Types

type Activity

type Activity struct {
	// Type represents the document type.
	Type string `json:"type,omitempty"`
	// ID represents the activity identifier.
	ID string `json:"id,omitempty"`
	// Kind represents the type of the activity,
	// possible values: "follow", "comment", "like", "submit".
	Kind string `json:"kind,omitempty"`
	// Timestamp when this activity happened.
	Timestamp int64 `json:"timestamp,omitempty"`
	// Username represents the user who made this activity.
	Username string `json:"username,omitempty"`
	// Target could be a sha256, username or a comment id.
	Target string `json:"target,omitempty"`
	// Source describes weather the activity was generated from
	// a real web browser or a script.
	Source string `json:"src,omitempty"`
}

Activity keeps track of activities made by users.

type Behavior added in v0.6.0

type Behavior struct {
	Meta             *DocMetadata         `json:"doc,omitempty"`
	Type             string               `json:"type,omitempty"`
	SHA256           string               `json:"sha256,omitempty"`
	Timestamp        int64                `json:"timestamp,omitempty"`
	Environment      interface{}          `json:"env,omitempty"`
	APITrace         interface{}          `json:"api_trace,omitempty"`
	Artifacts        interface{}          `json:"artifacts,omitempty"`
	SystemEvents     interface{}          `json:"sys_events,omitempty"`
	ProcessTree      interface{}          `json:"proc_tree,omitempty"`
	Capabilities     interface{}          `json:"capabilities,omitempty"`
	ScreenshotsCount int                  `json:"screenshots_count,omitempty"`
	ScanConfig       interface{}          `json:"scan_cfg,omitempty"`
	SandboxLog       interface{}          `json:"sandbox_log,omitempty"`
	AgentLog         interface{}          `json:"agent_log,omitempty"`
	Status           FileScanProgressType `json:"status,omitempty"`
}

Behavior represents a dynamic file scan report.

type Comment

type Comment struct {
	// Meta represents document metadata.
	Meta *DocMetadata `json:"doc,omitempty"`
	// Type represents the document type.
	Type string `json:"type,omitempty"`
	// ID represents the activity identifier.
	ID string `json:"id,omitempty"`
	// Body represents the content of the comment.
	Body string `json:"body,omitempty"`
	// SHA256 references the hash of the file
	// where the comment has been made.
	SHA256 string `json:"sha256,omitempty"`
	// Timestamp when this activity happened.
	Timestamp int64 `json:"timestamp,omitempty"`
	// Username represents the author of the comment.
	Username string `json:"username,omitempty"`
}

type DocMetadata added in v0.8.0

type DocMetadata struct {
	CreatedAt   int64 `json:"created_at,omitempty"`
	LastUpdated int64 `json:"last_updated,omitempty"`
	Version     int   `json:"version,omitempty"`
}

DocMetadata stores metadata information for saved documents in the DB.

type File

type File struct {
	Meta             *DocMetadata           `json:"doc,omitempty"`
	Type             string                 `json:"type,omitempty"`
	MD5              string                 `json:"md5,omitempty"`
	SHA1             string                 `json:"sha1,omitempty"`
	SHA256           string                 `json:"sha256,omitempty"`
	SHA512           string                 `json:"sha512,omitempty"`
	SSDeep           string                 `json:"ssdeep,omitempty"`
	TLSH             string                 `json:"tlsh,omitempty"`
	Crc32            string                 `json:"crc32,omitempty"`
	Size             int64                  `json:"size,omitempty"`
	Tags             map[string]interface{} `json:"tags,omitempty"`
	Magic            string                 `json:"magic,omitempty"`
	Exif             map[string]string      `json:"exif,omitempty"`
	TriD             []string               `json:"trid,omitempty"`
	Packer           []string               `json:"packer,omitempty"`
	FirstSeen        int64                  `json:"first_seen,omitempty"`
	LastScanned      int64                  `json:"last_scanned,omitempty"`
	Submissions      []Submission           `json:"submissions,omitempty"`
	Strings          interface{}            `json:"strings,omitempty"`
	MultiAV          map[string]interface{} `json:"multiav,omitempty"`
	PE               interface{}            `json:"pe,omitempty"`
	Histogram        []int                  `json:"histogram,omitempty"`
	ByteEntropy      []int                  `json:"byte_entropy,omitempty"`
	Ml               map[string]interface{} `json:"ml,omitempty"`
	Format           string                 `json:"file_format,omitempty"`
	Extension        string                 `json:"file_extension,omitempty"`
	DefaultBhvReport interface{}            `json:"default_behavior_report,omitempty"`
	BhvScans         interface{}            `json:"behavior_scans,omitempty"`
	Status           FileScanProgressType   `json:"status,omitempty"`
}

File represent a binary file.

func (File) ID

func (f File) ID(key string) string

ID returns a unique ID to identify a File object.

type FileScanProgressType added in v0.8.0

type FileScanProgressType uint8

FileScanProgressType represents the file scan progress type.

const (
	FileScanProgressQueued     FileScanProgressType = 1
	FileScanProgressProcessing FileScanProgressType = 2
	FileScanProgressFinished   FileScanProgressType = 3
)

Progress of a file scan.

type Submission

type Submission struct {
	Timestamp int64  `json:"timestamp,omitempty"`
	Filename  string `json:"filename,omitempty"`
	Source    string `json:"src,omitempty"`
	Country   string `json:"country,omitempty"`
}

Submission represents a file submission.

type User

type User struct {
	Meta          *DocMetadata     `json:"doc,omitempty"`
	Type          string           `json:"type"`
	Email         string           `json:"email,omitempty"`
	Username      string           `json:"username"`
	Password      string           `json:"password,omitempty"`
	FullName      string           `json:"name"`
	Location      string           `json:"location"`
	URL           string           `json:"url"`
	Bio           string           `json:"bio"`
	Confirmed     bool             `json:"confirmed"`
	MemberSince   int64            `json:"member_since"`
	LastSeen      int64            `json:"last_seen"`
	Admin         bool             `json:"admin"`
	Following     []UserFollows    `json:"following"`
	Followers     []UserFollows    `json:"followers"`
	Likes         []UserLike       `json:"likes"`
	Submissions   []UserSubmission `json:"submissions"`
	CommentsCount int              `json:"comments_count"`
}

User represents a user.

func (User) ID

func (f User) ID() string

ID returns a unique ID to identify a User object.

func (User) IsAdmin

func (u User) IsAdmin() bool

Name returns the user name.

type UserFollows added in v0.8.0

type UserFollows struct {
	Username  string `json:"username"`
	Timestamp int64  `json:"ts"`
}

UserFollows represents users' following or followers.

type UserLike added in v0.8.0

type UserLike struct {
	SHA256    string `json:"sha256"`
	Timestamp int64  `json:"ts"`
}

UserLike represents likes files by a user.

type UserPrivate

type UserPrivate struct {
	User
	Email    string `json:"email,omitempty"`
	Password string `json:"password,omitempty"`
}

UserPrivate represent a user with sensitive fields included.

type UserSubmission added in v0.8.0

type UserSubmission struct {
	SHA256    string `json:"sha256"`
	Timestamp int64  `json:"ts"`
}

UserSubmissions represents file uploads by a user.

Jump to

Keyboard shortcuts

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