node-virustotal
Advanced tools
Comparing version 0.1.7 to 0.1.8
46
code.js
@@ -166,5 +166,47 @@ var https = require("https"); | ||
}; | ||
var sendFile = function(filename, filetype, filecontent, responseProc, errProc){ | ||
var sendOptions = { | ||
url: "https://www.virustotal.com/vtapi/v2/file/scan?apikey=" + key, | ||
formData: { | ||
file: { | ||
value: filecontent, | ||
options: { | ||
filename: filename, | ||
filetype: filetype | ||
} | ||
} | ||
} | ||
}; | ||
var sendFileProc = function(){ | ||
request.post(sendOptions, function(error, response, body){ | ||
if (error) { | ||
errProc(error); | ||
return; | ||
} | ||
try{ | ||
var data = JSON.parse(body); | ||
switch (data.response_code) { | ||
case 1: | ||
responseProc(data); | ||
return; | ||
case 0: | ||
case -1: | ||
case -2: | ||
default: | ||
errProc(data); | ||
return; | ||
} | ||
} catch (e) { | ||
errProc(e); | ||
return; | ||
} | ||
}); | ||
}; | ||
addJob(sendFileProc); | ||
}; | ||
this.submitFileForAnalysis = sendFile; | ||
this.publishFileComment = publishUrlComment; | ||
this.publishUrlComment = publishUrlComment; | ||
this.retrieveUrlAnalysis = PostWithoutBody("http://www.virustotal.com/vtapi/v2/url/report?resource=", -2); | ||
this.retrieveUrlAnalysisWithRescan = PostWithoutBody("http://www.virustotal.com/vtapi/v2/url/report?scan=1&resource=", -2); | ||
this.retrieveUrlAnalysis = PostWithoutBody("https://www.virustotal.com/vtapi/v2/url/report?resource=", -2); | ||
this.retrieveUrlAnalysisWithRescan = PostWithoutBody("https://www.virustotal.com/vtapi/v2/url/report?scan=1&resource=", -2); | ||
this.submitUrlForScanning = PostWithoutBody("https://www.virustotal.com/vtapi/v2/url/scan?url=", 0); | ||
@@ -171,0 +213,0 @@ this.checkIPv4 = makeGet("https://www.virustotal.com/vtapi/v2/ip-address/report?ip="); |
{ | ||
"name": "node-virustotal", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "An implementation of the Virustotal API for Node.js", | ||
@@ -25,7 +25,7 @@ "main": "code.js", | ||
"dependencies": { | ||
"yellow-stream": "^0.0.13", | ||
"speedconcat": "^1.0.2", | ||
"request": "^2.72.0" | ||
"yellow-stream": "^0.0.14", | ||
"speedconcat": "^1.0.2", | ||
"request": "^2.72.0" | ||
}, | ||
"homepage": "https://github.com/natewatson999/node-virustotal#readme" | ||
} |
@@ -29,3 +29,8 @@ var vt = require("./code.js"); | ||
}); | ||
con.submitFileForAnalysis("obvious_virus.svg", "text/svg", fs.readFileSync("./obvious_virus.svg"), function(data){ | ||
console.log(data); | ||
}, function(mistake){ | ||
console.log(mistake); | ||
}); | ||
/*Sidenote: That's a real phishing site. It was shut down, but I still advise against going to it.*/ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20879
258
+ Addedyellow-stream@0.0.14(transitive)
- Removedyellow-stream@0.0.13(transitive)
Updatedyellow-stream@^0.0.14