Documentation ¶
Index ¶
- Constants
- Variables
- func NewMiddleware(service Service, logger log.Logger) middleware
- func RegisterHandlers(g *echo.Group, service Service, logger log.Logger, maxFileSize int, ...)
- type Archiver
- type CreateFileRequest
- type DynFileScanCfg
- type File
- type FileScanCfg
- type FileScanRequest
- type Producer
- type Repository
- type Service
- type UpdateFileRequest
- type UploadDownloader
Constants ¶
View Source
const ( KB = 1000 MB = 1000 * KB )
Variables ¶
View Source
var ( // ErrDocumentNotFound is returned when the doc does not exist in the DB. ErrDocumentNotFound = "document not found" // ErrObjectNotFound is returned when an object does not exist in Obj storage. ErrObjectNotFound = errors.New("object not found") )
Functions ¶
func NewMiddleware ¶ added in v0.4.0
NewMiddleware creates a new file Middleware.
Types ¶
type CreateFileRequest ¶
type CreateFileRequest struct {
// contains filtered or unexported fields
}
CreateFileRequest represents a file creation request.
type DynFileScanCfg ¶ added in v0.3.0
type DynFileScanCfg struct { // Destination path where the sample will be located in the VM. DestPath string `json:"dest_path,omitempty" form:"dest_path"` // Arguments used to run the sample. Arguments string `json:"args,omitempty" form:"args"` // Timeout in seconds for how long to keep the VM running. Timeout int `json:"timeout,omitempty" form:"timeout"` // Country to route traffic through. Country string `json:"country,omitempty" form:"country"` // Operating System used to run the sample. OS string `json:"os,omitempty" form:"os"` }
DynFileScanCfg represents the config used to detonate a file.
type FileScanCfg ¶ added in v0.3.0
type FileScanCfg struct { // SHA256 hash of the file. SHA256 string `json:"sha256,omitempty"` // Represents the dynamic scan configuration plus some option fields. FileScanRequest }
FileScanCfg represents a file scanning config. This map to a 1:1 mapping between the config stored in the main saferwall repo.
type FileScanRequest ¶ added in v0.7.0
type FileScanRequest struct { // Disable Sandbox SkipDetonation bool `json:"skip_detonation,omitempty" form:"skip_detonation"` // Dynamic scan config DynFileScanCfg `json:"scan_cfg,omitempty"` }
FileScanRequest represents a File scan request.
type Repository ¶
type Repository interface { // Get returns the file with the specified file ID. Get(ctx context.Context, id string, fields []string) (entity.File, error) // Count returns the number of files. Count(ctx context.Context) (int, error) // Exists return true when the doc exists in the DB. Exists(ctx context.Context, id string) (bool, error) // Query returns the list of files with the given offset and limit. Query(ctx context.Context, offset, limit int, fields []string) ([]entity.File, error) // Create saves a new file in the storage. Create(ctx context.Context, id string, file entity.File) error // Update updates the whole file with given ID in the storage. Update(ctx context.Context, key string, file entity.File) error // Patch patches a sub entry in the file with given ID in the storage. Patch(ctx context.Context, key, path string, val interface{}) error // Delete removes the file with given ID from the storage. Delete(ctx context.Context, id string) error // Summary returns a summary of a file scan. Summary(ctx context.Context, id string) (interface{}, error) // Comments returns the list of comments over a file. Comments(ctx context.Context, id string, offset, limit int) ( []interface{}, error) CountStrings(ctx context.Context, id string, queryString string) (int, error) Strings(ctx context.Context, id, queryString string, offset, limit int) ( interface{}, error) // MetaUI returns metadata required for the UI when loading an analysis report. MetaUI(ctx context.Context, id string) (interface{}, error) }
Repository encapsulates the logic to access files from the data source.
func NewRepository ¶
func NewRepository(db *dbcontext.DB, logger log.Logger) Repository
NewRepository creates a new file repository.
type Service ¶
type Service interface { Get(ctx context.Context, id string, fields []string) (File, error) Count(ctx context.Context) (int, error) Exists(ctx context.Context, id string) (bool, error) Create(ctx context.Context, input CreateFileRequest) (File, error) Update(ctx context.Context, id string, input UpdateFileRequest) (File, error) Delete(ctx context.Context, id string) (File, error) Query(ctx context.Context, offset, limit int, fields []string) ([]File, error) Patch(ctx context.Context, key, path string, val interface{}) error Summary(ctx context.Context, id string) (interface{}, error) Like(ctx context.Context, id string) error Unlike(ctx context.Context, id string) error ReScan(ctx context.Context, id string, input FileScanRequest) error Comments(ctx context.Context, id string, offset, limit int) ( []interface{}, error) CountStrings(ctx context.Context, id string, queryString string) (int, error) CountComments(ctx context.Context, id string) (int, error) Strings(ctx context.Context, id string, queryString string, offset, limit int) (interface{}, error) Download(ctx context.Context, id string, zipFile *string) error GeneratePresignedURL(ctx context.Context, id string) (string, error) MetaUI(ctx context.Context, id string) (interface{}, error) }
Service encapsulates use case logic for files.
type UpdateFileRequest ¶
type UpdateFileRequest struct { 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"` Magic string `json:"magic,omitempty"` Size uint64 `json:"size,omitempty"` Exif map[string]string `json:"exif,omitempty"` Tags map[string]interface{} `json:"tags,omitempty"` TriD []string `json:"trid,omitempty"` Packer []string `json:"packer,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"` FileType string `json:"filetype,omitempty"` }
UpdateUserRequest represents a File update request.
type UploadDownloader ¶
type UploadDownloader interface { Upload(ctx context.Context, bucket, key string, file io.Reader) error Download(ctx context.Context, bucket, key string, file io.Writer) error Exists(ctx context.Context, bucket, key string) (bool, error) GeneratePresignedURL(ctx context.Context, bucket, key string) (string, error) }
Click to show internal directories.
Click to hide internal directories.