File Scan | Golang SDK
RequestUploadURL
func (e *FileScan) RequestUploadURL(ctx context.Context, input *FileScanGetURLRequest, file *os.File) (*pangea.PangeaResponse[FileScanResult], error)Scan
func (e *FileScan) Scan(ctx context.Context, input *FileScanRequest, file *os.File) (*pangea.PangeaResponse[FileScanResult], error)Scan a file for malicious content.
input := &file_scan.FileScanRequest{
Raw: true,
Verbose: true,
Provider: "crowdstrike",
}
// This should be your own file to scan
file, err := os.Open("./path/to/file.pdf")
if err != nil {
log.Fatal("expected no error got: %v", err)
}
resp, err := client.Scan(ctx, input, file)
if err != nil {
log.Fatal(err.Error())
}
UploadFile
func (fu *FileUploader) UploadFile(ctx context.Context, url string, tm pangea.TransferMethod, fd pangea.FileData) errorType Client
type Client interfacetype Client interface {
Scan(ctx context.Context, input *FileScanRequest, file *os.File) (*pangea.PangeaResponse[FileScanResult], error)
RequestUploadURL(ctx context.Context, input *FileScanGetURLRequest, file *os.File) (*pangea.PangeaResponse[FileScanResult], error)
// Base service methods
pangea.BaseServicer
}
Type FileScan
type FileScan structtype FileScan struct {
pangea.BaseService
}
Type FileScanData
type FileScanData structtype FileScanData struct {
Category []string `json:"category"`
Score int `json:"score"`
Verdict string `json:"verdict"`
}
Type FileScanFileParams
type FileScanFileParams structNOTE: Will be deprecated in next major update in favor of pangea.UploadFileParams
type FileScanFileParams struct {
Size int `json:"size,omitempty"`
CRC string `json:"crc32c,omitempty"`
SHA256 string `json:"sha256,omitempty"`
}
Type FileScanFullRequest
type FileScanFullRequest structtype FileScanFullRequest struct {
FileScanRequest
FileScanFileParams
}
Type FileScanGetURLRequest
type FileScanGetURLRequest structtype FileScanGetURLRequest struct {
TransferMethod pangea.TransferMethod
Verbose bool
Raw bool
Provider string
FileParams *FileScanFileParams
}
Type FileScanRequest
type FileScanRequest structtype FileScanRequest struct {
// Base request has ConfigID for multi-config projects
pangea.BaseRequest
pangea.TransferRequest
Verbose bool `json:"verbose,omitempty"`
Raw bool `json:"raw,omitempty"`
Provider string `json:"provider,omitempty"`
SourceURL string `json:"source_url,omitempty"`
}
Type FileScanResult
type FileScanResult structtype FileScanResult struct {
Data FileScanData `json:"data"`
Parameters interface{} `json:"parameters,omitempty"`
RawData interface{} `json:"raw_data,omitempty"`
}
Type FileUploader
type FileUploader structtype FileUploader struct {
client *pangea.Client
}