entity

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 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 {
	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           int         `json:"status,omitempty"`
}

Behavior represents a dynamic file scan report.

type Comment

type Comment struct {
	// 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"`
	// SHA256 references the hash of the file
	// where the comment has been made.
	SHA256 string `json:"sha256"`
	// Timestamp when this activity happened.
	Timestamp int64 `json:"timestamp"`
	// Username represents the author of the comment.
	Username string `json:"username"`
}

type File

type File struct {
	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"`
	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"`
	CommentsCount     *int                   `json:"comments_count,omitempty"`
	Format            string                 `json:"file_format,omitempty"`
	Extension         string                 `json:"file_extension,omitempty"`
	DefaultBehaviorID string                 `json:"default_behavior_id,omitempty"`
	Behaviors         interface{}            `json:"behaviors,omitempty"`
	Status            int                    `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 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 {
	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"`
	HasAvatar        bool     `json:"has_avatar"`
	Following        []string `json:"following"`
	FollowingCount   int      `json:"following_count"`
	Followers        []string `json:"followers"`
	FollowersCount   int      `json:"followers_count"`
	Likes            []string `json:"likes"`
	LikesCount       int      `json:"likes_count"`
	SubmissionsCount int      `json:"submissions_count"`
	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 UserPrivate

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

UserPrivate represent a user with sensitive fields included.

Jump to

Keyboard shortcuts

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