clamscan
Advanced tools
Comparing version 2.1.0 to 2.1.1
{ | ||
"name": "clamscan", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"author": "Kyle Farris <kyle.farris@infotechinc.com> (https://infotechinc.com)", | ||
@@ -5,0 +5,0 @@ "description": "Use Node JS to scan files on your server with ClamAV's clamscan/clamdscan binary or via TCP to a remote server or local UNIX Domain socket. This is especially useful for scanning uploaded files provided by un-trusted sources.", |
@@ -1,5 +0,16 @@ | ||
const fs = require('fs'); | ||
/** | ||
* This simple script simply allows us to generate an eicar file | ||
* as opposed to storing one in our repository which could cause | ||
* it to be immediately removed by antivirus software on contributors' | ||
* machines or, even worse, flagged by github for hosting a virus. | ||
* | ||
* Previously, this library relied on downloading the eircar file from | ||
* the eicar site but that proved slow and unreliable. | ||
*/ | ||
const { writeFileSync, copyFileSync, unlinkSync } = require('fs'); | ||
const { Readable } = require('stream'); | ||
const goodScanDir = `${__dirname}/good_scan_dir`; | ||
const badScanDir = `${__dirname}/bad_scan_dir`; | ||
const mixedScanDir = `${__dirname}/mixed_scan_dir` | ||
const badScanFile = `${badScanDir}/bad_file_1.txt`; | ||
@@ -20,8 +31,19 @@ | ||
const EicarGen = { | ||
writeFile: () => fs.writeFileSync(badScanFile, eicarBuffer.toString()), | ||
writeFile: () => writeFileSync(badScanFile, eicarBuffer.toString()), | ||
writeMixed: () => { | ||
EicarGen.writeFile(); | ||
copyFileSync(`${goodScanDir}/good_file_1.txt`, `${mixedScanDir}/folder1/good_file_1.txt`); | ||
copyFileSync(`${goodScanDir}/good_file_2.txt`, `${mixedScanDir}/folder2/good_file_2.txt`); | ||
copyFileSync(badScanFile, `${mixedScanDir}/folder1/bad_file_1.txt`); | ||
copyFileSync(badScanFile, `${mixedScanDir}/folder2/bad_file_2.txt`); | ||
}, | ||
emptyMixed: () => { | ||
unlinkSync(`${mixedScanDir}/folder1/good_file_1.txt`); | ||
unlinkSync(`${mixedScanDir}/folder2/good_file_2.txt`); | ||
unlinkSync(`${mixedScanDir}/folder1/bad_file_1.txt`); | ||
unlinkSync(`${mixedScanDir}/folder2/bad_file_2.txt`); | ||
}, | ||
getStream: () => Readable.from(eicarBuffer), | ||
}; | ||
// EicarGen.writeFile(); | ||
module.exports = EicarGen; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
275772
32
4280
11