npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

avast-client

v1.0.0

Published

Client for Avast scanner

Downloads

252

Readme

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