linkcheck.plugins.viruscheck

Check page content for virus infection with clamav.

Functions

canonical_clamav_conf()

Default clamav configs for various platforms.

get_clamav_conf(filename)

Initialize clamav configuration.

get_sockinfo(host[, port])

Return socket.getaddrinfo for given host and port.

scan(data, clamconf)

Scan data for viruses.

Classes

ClamavConfig(filename)

Clamav configuration wrapper, with clamd connection method.

ClamdScanner(clamav_conf)

Virus scanner using a clamd daemon process.

VirusCheck(config)

Checks the page content for virus infections with clamav.

Exceptions

ClamavError

Raised on clamav errors.

exception linkcheck.plugins.viruscheck.ClamavError[source]

Bases: Exception

Raised on clamav errors.

class linkcheck.plugins.viruscheck.ClamavConfig(filename)[source]

Bases: dict

Clamav configuration wrapper, with clamd connection method.

Parse clamav configuration file.

create_local_socket()[source]

Create local socket, connect to it and return socket object.

create_tcp_socket(host)[source]

Create tcp socket, connect to it and return socket object.

new_connection()[source]

Connect to clamd for stream scanning.

Returns:

tuple (connected socket, host)

parseconf(filename)[source]

Parse clamav configuration from given file.

class linkcheck.plugins.viruscheck.ClamdScanner(clamav_conf)[source]

Bases: object

Virus scanner using a clamd daemon process.

Initialize clamd daemon process sockets.

close()[source]

Get results and close clamd daemon sockets.

new_scansock()[source]

Return a connected socket for sending scan data to it.

scan(data)[source]

Scan given data for viruses.

class linkcheck.plugins.viruscheck.VirusCheck(config)[source]

Bases: _ContentPlugin

Checks the page content for virus infections with clamav. A local clamav daemon must be installed.

Initialize clamav configuration.

applies_to(url_data)[source]

Check for clamav and extern.

check(url_data)[source]

Scan content for viruses.

classmethod read_config(configparser)[source]

Read configuration file options.

linkcheck.plugins.viruscheck.canonical_clamav_conf()[source]

Default clamav configs for various platforms.

linkcheck.plugins.viruscheck.get_clamav_conf(filename)[source]

Initialize clamav configuration.

linkcheck.plugins.viruscheck.get_sockinfo(host, port=None)[source]

Return socket.getaddrinfo for given host and port.

linkcheck.plugins.viruscheck.scan(data, clamconf)[source]

Scan data for viruses.

Returns:

(infection msgs, errors)

Return type:

([], [])