New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

github.com/Lyimmi/go-clamd

Package Overview
Dependencies
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/Lyimmi/go-clamd

Source
Go Modules
Version
v1.0.4
Version published
Created
Source

go-clamd

Go build & test

A Go client for ClamAV daemon over TCP or UNIX socket.

Requirements

  • Minimum Go version 1.20
  • Only targeted for Linux.

Features

GoCalmAvDescription
PingPINGCheck the server's state. It should reply with "PONG".
VersionVERSIONPrint program and database versions.
ReloadRELOADReload the virus databases.
ShutdownSHUTDOWNPerform a clean exit.
ScanSCANScan a file or a directory (recursively) with archive support enabled (if not disabled in clamd.conf). A full path is required.
ScanAllCONTSCANScan file or directory (recursively) with archive support enabled and don't stop the scanning when a virus is found.
ScanStreamINSTREAMScan a stream of data. The stream is sent to clamd in chunks, after INSTREAM, on the same socket on which the command was sent. This avoids the overhead of establishing new TCP connections and problems with NAT. Note: do not exceed StreamMaxLength as defined in clamd.conf, otherwise clamd will reply with INSTREAM size limit exceeded and close the connection.
StatsSTATSReplies with statistics about the scan queue, contents of scan queue, and memory usage. The exact reply format is subject to change in future releases.

Usage

go get github.com/lyimmi/go-clamd
import (
    "fmt"
    "github.com/lyimmi/go-clamd"
)

c := clamd.NewClamd()

if ok, _ := c.Ping(ctx); !ok {
    fmt.Println("clamd nok")
}

if ok, err := c.Scan(ctx, fileName); !ok {
    if err != nil {
        panic(err)
    }
    fmt.Printf("%s has maleware\n", fileName)
}

if ok, err := c.ScanAll(ctx, "/tmp"); !ok {
    if err != nil {
        panic(err)
    }
    fmt.Printf("%s has maleware\n", fileName)
}

stats, err := c.Stats(ctx)
if err != nil {
    panic(err)
}
d, err := json.MarshalIndent(stats, "", "  ")
if err != nil {
    panic(err)
}
fmt.Println(string(d))

License

The MIT License (MIT)

FAQs

Package last updated on 20 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts