fprot

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: MPL-2.0 Imports: 13 Imported by: 0

README

fprot

Golang Fprot Client

Ci codecov Go Report Card Go Reference MPLv2 License

Description

fprot is a Golang library and cmdline tool that implements the Fprot client protocol used by F-Prot.

Requirements

  • Golang 1.10.x or higher

Getting started

Fprot client

The fprot client can be installed as follows

$ go get github.com/baruwa-enterprise/fprot/cmd/fprotscan

Or by cloning the repo and then running

$ make build
$ ./bin/fprotscan
Fprot library

To install the library

go get github.com/baruwa-enterprise/fprot

You can then import it in your code

import "github.com/baruwa-enterprise/fprot"
Testing

make test

License

MPL-2.0

Documentation

Overview

Package fprot Golang F-Prot client Fprot - Golang F-Prot client

Index

Constants

This section is empty.

Variables

View Source
var (
	// ZeroTime holds the zero value of time
	ZeroTime time.Time
)

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

A Client represents a Fprot client.

func NewClient

func NewClient(address string) (c *Client, err error)

NewClient creates and returns a new instance of Client

func (*Client) Close

func (c *Client) Close(ctx context.Context) (err error)

Close closes the server connection

func (*Client) Info

func (c *Client) Info(ctx context.Context) (i Info, err error)

Info returns server information

func (*Client) ScanDir

func (c *Client) ScanDir(ctx context.Context, d string) (r []*Response, err error)

ScanDir submits a directory for scanning

func (*Client) ScanDirStream

func (c *Client) ScanDirStream(ctx context.Context, d string) (r []*Response, err error)

ScanDirStream submits a directory for scanning as streams

func (*Client) ScanFile

func (c *Client) ScanFile(ctx context.Context, f string) (r []*Response, err error)

ScanFile submits a single file for scanning

func (*Client) ScanFiles

func (c *Client) ScanFiles(ctx context.Context, f ...string) (r []*Response, err error)

ScanFiles submits multiple files for scanning

func (*Client) ScanReader

func (c *Client) ScanReader(ctx context.Context, i io.Reader) (r []*Response, err error)

ScanReader submits an io reader via a stream for scanning

func (*Client) ScanStream

func (c *Client) ScanStream(ctx context.Context, f ...string) (r []*Response, err error)

ScanStream submits a stream for scanning

func (*Client) SetCmdTimeout

func (c *Client) SetCmdTimeout(t time.Duration)

SetCmdTimeout sets the cmd timeout

func (*Client) SetConnRetries

func (c *Client) SetConnRetries(s int)

SetConnRetries sets the number of times connection is retried

func (*Client) SetConnSleep

func (c *Client) SetConnSleep(s time.Duration)

SetConnSleep sets the connection retry sleep duration in seconds

func (*Client) SetConnTimeout

func (c *Client) SetConnTimeout(t time.Duration)

SetConnTimeout sets the connection timeout

type Command

type Command int

A Command represents a Fprot Command

const (
	// Help is the HELP command
	Help Command = iota + 1
	// ScanFile is the SCAN FILE command
	ScanFile
	// ScanStream is the SCAN STREAM command
	ScanStream
	// Queue is the QUEUE command
	Queue
	// ScanQueue is the SCAN command
	ScanQueue
	// Quit is the QUIT command
	Quit
)

func (Command) String

func (c Command) String() (s string)

type Info

type Info struct {
	Version   string
	Engine    string
	Protocol  string
	Signature string
	Uptime    string
}

Info is the server information

type Response

type Response struct {
	Filename    string
	ArchiveItem string
	Signature   string
	Status      string
	StatusCode  StatusCode
	Infected    bool
	Raw         string
}

Response is the response from the server

type StatusCode

type StatusCode int

StatusCode represents the returned status code

const (
	// NoMatch 0 No signature was matched
	NoMatch StatusCode = 0
	// Infected 1 Atleast one virus-infected object was found
	Infected StatusCode = 1
	// HeuristicMatch 2 Atleast one suspicious (heuristic match) object was found
	HeuristicMatch StatusCode = 2
	// UserError 4 Interrupted by user
	UserError StatusCode = 4
	// RestrictionError 8 Scan restriction caused scan to skip files
	RestrictionError StatusCode = 8
	// SystemError 16 Platform error
	SystemError StatusCode = 16
	// InternalError 32 Internal engine error
	InternalError StatusCode = 32
	// SkipError 64 Atleast one object was not scanned
	SkipError StatusCode = 64
	// DisinfectError 128 Atleast one object was disinfected
	DisinfectError StatusCode = 128
)

func (StatusCode) String

func (c StatusCode) String() (s string)

Directories

Path Synopsis
cmd
fprotscan
Package fprot Golang F-Prot client Fprot - Golang F-Prot client Package fprot Golang F-Prot client Fprot - Golang F-Prot client
Package fprot Golang F-Prot client Fprot - Golang F-Prot client Package fprot Golang F-Prot client Fprot - Golang F-Prot client

Jump to

Keyboard shortcuts

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