node-virustotal
Advanced tools
Comparing version 0.3.2 to 0.3.3
{ | ||
"name": "node-virustotal", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "An implementation of the Virustotal API for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "code.js", |
@@ -198,3 +198,49 @@ var request = require("request"); | ||
}; | ||
var retrieveUrlAnalysis = function(URL, responseProc, errProc, rescan, extendedData, continueProc) { | ||
var query = "https://www.virustotal.com/vtapi/v2/url/report?apikey=" + key + "&url=" + encodeURIComponent(URL); | ||
if (rescan==true) { | ||
query = query + "&rescan=1"; | ||
} | ||
if (extendedData==true) { | ||
query = query + "&allinfo=1"; | ||
} | ||
request.get(query, function(error, response, body){ | ||
if (error) { | ||
errProc(error); | ||
return; | ||
} | ||
if (response.statusCode > 399) { | ||
errProc(body); | ||
return; | ||
} | ||
try { | ||
var data = JSON.parse(body); | ||
switch (data.response_code) { | ||
case -2: | ||
if (continueProc==null) { | ||
var next = function(){ | ||
retrieveUrlAnalysis(URL, responseProc, errProc, false, extendedData, null); | ||
}; | ||
setTimeout(next, 300000); | ||
return; | ||
} | ||
continueProc(data); | ||
return; | ||
case 1: | ||
case 0: | ||
responseProc(data); | ||
return; | ||
case -1: | ||
default: | ||
errProc(data); | ||
return; | ||
} | ||
} catch (e) { | ||
errProc(e); | ||
return; | ||
} | ||
}); | ||
return; | ||
}; | ||
this.retrieveUrlAnalysis = retrieveUrlAnalysis; | ||
this.submitFileForAnalysis = sendFilePreLogic; | ||
@@ -201,0 +247,0 @@ this.getDomainReport = function(domain, responseProc, errProc){ |
@@ -299,2 +299,5 @@ # node-virustotal | ||
### makePrivateConnection.retrieveUrlAnalysis() | ||
This version is very different from its counterpart in the public and honeypot API. What it's actually used for is identical though. This version has 5 or 6 parameters. The first parameter is the URL that a report is wanted on. The second and third parameters are the usual response and error callback functions with the usual parameters. The next one is a boolean variable which indicates if the script should request that Virustotal rescan the URL. The next boolean variable is if you want the extended data, with false giving the same output you'd get with public and honeypot mode; and true giving extra sandbox information. The final parameter is optional. If the final parameter is not specified; then if Virustotal doesn't have results for the URL yet, then the function will keep retrying every 5 minutes until it gets results. If the function is specified; then if Virustotal hasn't scanned the URL yet, then the function will be fired with the response body as the only parameter. | ||
### makePrivateConnection example | ||
@@ -357,2 +360,9 @@ ``` | ||
}); | ||
con.retrieveUrlAnalysis("http://wikionemore.com",function(data){ | ||
console.dir(data); | ||
}, function(err){ | ||
console.error(err); | ||
}, false, true, function(stillWaiting){ | ||
console.log(stillWaiting); | ||
}); | ||
``` | ||
@@ -359,0 +369,0 @@ |
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
49402
644
376