Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

avast-client

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

avast-client

Client for Avast scanner

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

avast-client

Connects to Avast scanner daemon and scans files for viruses.

const AvastClient = require('avast-client');
const scanner = new AvastClient();
scanner.scan('virus.exe', fs.readFileSync('virus.exe'), (err, response)=>{
    console.log(err || response);
    // you can keep using the same scanner instance until you call quit()
    scanner.quit();
});

Methods

getFlags

Return current flags as an object with key:value pairs where key is a flag and value is a boolean indicating if the flag is set or not

scanner.getFlags((err, flags) => {
    console.log(flags);
});

Example response

{ fullfiles: false, allfiles: true, scandevices: false }

setFlags

Allows to change flags. Returns current flags as an object with key:value pairs where key is a flag and value is a boolean indicating if the flag is set or not

scanner.setFlags({ allfiles: false, fullfiles: true }, (err, flags) => {
    console.log(flags);
});

Example response

{ fullfiles: true, allfiles: false, scandevices: false }

getSensitivity

Return current sensitvity as an object with key:value pairs where key is an option and value is a boolean indicating if the sensitivity option is set or not

scanner.getSensitivity((err, opts) => {
    console.log(opts);
});

Example response

{ worm: true,
  trojan: true,
  adware: true,
  spyware: true,
  dropper: true,
  kit: true,
  joke: true,
  dangerous: true,
  dialer: true,
  rootkit: true,
  exploit: true,
  pup: true,
  suspicious: true,
  pube: true }

setSensitivity

Allows to change sensitvity options. Return current sensitvity as an object with key:value pairs where key is an option and value is a boolean indicating if the sensitivity option is set or no

scanner.setSensitivity({ dialer: false }, (err, opts) => {
    console.log(opts);
});

Example response

{ worm: true,
  trojan: true,
  adware: true,
  spyware: true,
  dropper: true,
  kit: true,
  joke: true,
  dangerous: true,
  dialer: false,
  rootkit: true,
  exploit: true,
  pup: true,
  suspicious: true,
  pube: true }

getPack

Return current packer settings as an object with key:value pairs where key is an option and value is a boolean indicating if the packer option is set or not

scanner.getPack((err, opts) => {
    console.log(opts);
});

Example response

{ mime: true,
  zip: true,
  arj: true,
  rar: true,
  cab: true,
  tar: true,
  gz: true,
  bzip2: true,
  ace: true,
  arc: true,
  zoo: true,
  lharc: true,
  chm: true,
  cpio: true,
  rpm: true,
  '7zip': true,
  iso: true,
  tnef: true,
  dbx: true,
  sys: true,
  ole: true,
  exec: true,
  winexec: true,
  install: true,
  dmg: true }

setPack

Allows to change packer options. Return current packer settings as an object with key:value pairs where key is an option and value is a boolean indicating if the packer option is set or not

scanner.setPack({ mime: false }, (err, opts) => {
    console.log(opts);
});

Example response

{ mime: false,
  zip: true,
  arj: true,
  rar: true,
  cab: true,
  tar: true,
  gz: true,
  bzip2: true,
  ace: true,
  arc: true,
  zoo: true,
  lharc: true,
  chm: true,
  cpio: true,
  rpm: true,
  '7zip': true,
  iso: true,
  tnef: true,
  dbx: true,
  sys: true,
  ole: true,
  exec: true,
  winexec: true,
  install: true,
  dmg: true }

checkUrl

Allows to check if an url is blacklisted or not

scanner.checkUrl('http://www.google.com/', (err, status) => {
    if (status) {
        console.log('URL is OK');
    } else {
        console.log('URL is blacklisted');
    }
});

getVPS

Get current virus definitions version. Return the version number as a string.

scanner.getVPS((err, version) => {
    console.log(version);
});

scan

Scans a buffer or a stream and returns scan result

scanner.scan(filename, data, callback)

Where

  • filename is a name of the file. This is not real path, it just indicates the type of the data to be scanned
  • data is file contents, either a Buffer, a String (ascii or utf8) or a Stream
  • callback (err, response) is the function to run once scanning is complete
    • err is the error respone if scanning failed for some system error
    • response is scan response object
      • status is either 'clean', 'infected' or 'error'
      • message is either the injection or error message
      • path is set if the infected file was found from a container, eg the scanned file was a zip file
scanner.scan('message.eml', fs.readFileSync('/var/mail/message.eml'), (err, result) => {
    console.log(result);
});

Example response

{ status: 'infected', message: 'Win32:Malware-gen' }

quit

Closes the socket to the daemon and does not allow to use this instance anymore.

License

MIT

Keywords

FAQs

Package last updated on 14 May 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc