mdbcommon

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2020 License: LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ERROR0 = "OK" // No errors
View Source
const ERROR1 = "Unauthorized"
View Source
const ERROR2 = "Invalid Request"
View Source
const ERROR3 = "Sample Not Found"
View Source
const ERROR4 = "Server Error"
View Source
const GetFileSources string = "/v1/sources/list"

Request with GetSourcesRequest, respond with Sources.

View Source
const GetServerInfoURL string = "/v1/server/info"

Request empty, respond with struct.

View Source
const GetServerSupportedFileTypes string = "/v1/server/types"

Get supported file types, useful for clients

View Source
const SearchBySampleInfoURL string = "/v1/samples/search"

Request with SearchSample, respond with SampleInfo or error code.

View Source
const UploadSampleURL string = "/v1/samples/upload"

Request with struct, respond with error code.

View Source
const UserLoginURL string = "/v1/users/getkey"

Request, Response same struct. Respond with password empty.

View Source
const VERSION string = "0.0.0"
View Source
const WEBSITE string = "https://github.com/rjzak/malwaredb"

Variables

This section is empty.

Functions

func Exists

func Exists(path string) bool

func PasswordToBytes

func PasswordToBytes(password []byte) ([]byte, error)

Types

type FileHashes

type FileHashes struct {
	SHA1   string
	SHA256 string
	SHA512 string
	MD5    string
	LZJD   string
	SSDeep string
	SDHash string
}

func GetFileHashesFromBytes

func GetFileHashesFromBytes(fileContents []byte) FileHashes

func GetFileHashesFromFilePath

func GetFileHashesFromFilePath(fPath string) (*FileHashes, error)

func (*FileHashes) GetSearchQuery

func (hashes *FileHashes) GetSearchQuery() SearchSample

type FileType

type FileType struct {
	TypeName       string   `json:"TypeName"`
	TypeMagic      []string `json:"TypeMagicArray"`
	TypeExecutable bool     `json:"TypeExecutable"`
	Description    string   `json:"TypeDescription"`
}

type GetSetAPIKey

type GetSetAPIKey struct {
	UserName     string `json:"username"`
	UserPassword string `json:"userpassword"`
	APIKey       string `json:"apikey"`
	Message      string `json:"message"`
}

type GetSourcesRequest

type GetSourcesRequest struct {
	ReleasableOnly bool   `json:"OnlyReleasable"`
	APIKey         string `json:"APIKey"`
}

type NewSample

type NewSample struct {
	FileName           string `json:"FileName"`
	UserKey            string `json:"APIKey"`
	SourceID           int64  `json:"GroupID"`
	FileContentsBase64 string `json:"FileContentsB64"`
}

type SampleInfo

type SampleInfo struct {
	ID                 int64          `json:"ID"`
	Size               int            `json:"Size"`
	SHA1               string         `json:"SHA1"`
	SHA256             string         `json:"SHA256"`
	SHA512             string         `json:"SHA512"`
	MD5                string         `json:"MD5"`
	SSDeep             string         `json:"SSDeep"`
	SDHash             string         `json:"SDHash"`
	LZJD               string         `json:"LZJD"`
	SimilarityScore    float64        `json:"SimilarityScore"`
	FirstUploadDate    string         `json:"FirstUploadDate"`
	FileCreatedDate    string         `json:"FileCreatedDate"`
	Entropy            float64        `json:"Entropy"`
	ConfirmedMalicious bool           `json:"ConfirmedMalicious"`
	FileType           string         `json:"FileType"`
	FileExecutable     bool           `json:"FileExecutable"`
	Labels             []string       `json:"Labels"`
	FileContentsBase64 string         `json:"FileContentsB64"`
	Sources            []SampleSource `json:"SampleSources"`
}

type SampleSource

type SampleSource struct {
	SourceName    string   `json:"SourceName"`
	SourceID      int64    `json:"SourceID"`
	FileNames     []string `json:"FileNames"`
	UploaderUname string   `json:"UploaderUname"`
}

Sample might be in multiple sources

type SearchResult

type SearchResult struct {
	NumResults   int          `json:"NumResults"`
	FoundSamples []SampleInfo `json:"FoundSamples"`
	Message      string       `json:"Message"`
}

type SearchSample

type SearchSample struct {
	SHA1                string  `json:"SHA1"`
	SHA256              string  `json:"SHA256"`
	SHA512              string  `json:"SHA512"`
	MD5                 string  `json:"MD5"`
	SSDeep              string  `json:"SSDeep"`
	SDHash              string  `json:"SDHash"`
	LZJD                string  `json:"LZJD"`
	SimilarityThreshold float64 `json:"SimilarityThreshold"` // For SSDeep, SDHash, LZJD.
	SendSample          bool    `json:"SendSample"`
	APIKey              string  `json:"APIKey"`
}

type ServerFileTypes

type ServerFileTypes struct {
	NumFileTypes int        `json:"NumFileTypes"`
	FileTypes    []FileType `json:"FileTypes"`
}

type ServerInfo

type ServerInfo struct {
	OSName     string `json:"OSName"`
	OSVersion  string `json:"OSVersion"`
	GoVersion  string `json:"GoVersion"`
	MDBVersion string `json:"MDBVersion"`
	DBVersion  string `json:"DBVersion"`
	NumSamples int    `json:"NumSamples"`
	Uptime     string `json:"Uptime"`
}

type SourceInfo

type SourceInfo struct {
	Id               int64     `json:"SourceID"`
	Name             string    `json:"SourceName"`
	Description      string    `json:"SourceDescription"`
	URL              string    `json:"SourceURL"`
	FirstAcquisition time.Time `json:"SourceAcquisition"`
	IsReleasable     bool      `json:"SourceReleasable"`
}

type Sources

type Sources struct {
	NumSources      int          `json:"NumSources"`
	Sources         []SourceInfo `json:"Sources"`
	ResponseMessage string       `json:"SourceResponseMessage"`
}

Jump to

Keyboard shortcuts

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