Virustotal API v2.0 wrapper class
npm i virustotal-api
const fs = require('fs')
const VirusTotalApi = require('virustotal-api')
const virusTotal = new VirusTotalApi('<YOUR API KEY>')
fs.readFile(__filename, (err, data) => {
if (err) {
console.log(`Cannot read file. ${err}`)
} else {
virusTotal.fileScan(data, 'file.js')
.then((response) => {
let resource = response.resource
// sometime later try:
virusTotal.fileReport(resource)
.then((result) => {
console.log(result)
})
})
.catch(err => console.log(`Scan failed. ${err}`))
}
})
For more info please refer to documentation
- Passing
options
to web client (needle). Thanks to @thepocp.
- Dependency update to fix security vulnerabilities.
- Dependency update to fix security vulnerabilities (js-yaml).
- Dependency update to fix security vulnerabilities (lodash).
- Documentation updated to include error handling.
- Validating buffer size in
fileScan
in case anti-malware blocks access to file.
Documentation update on urlReport
Initial release