Created
March 24, 2011 19:43
-
-
Save 9b/885715 to your computer and use it in GitHub Desktop.
Key off anti-virus name and collect signatures, unique signature count and total detection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var map = function () { | |
this.scans.virustotal.report.results.scanners.forEach( | |
function (z) { | |
emit(z.antivirus, {signatures: [z.signature] , count: 1, total: 0}); | |
} | |
); | |
} | |
var reduce = function (key, values) { | |
var count = 0; | |
var total = 0; | |
var sigs = []; | |
values.forEach( | |
function(z){ | |
total += z.count; | |
z.signatures.forEach( | |
function(y) { | |
if(y != "") { sigs.push(y); } | |
} | |
) | |
} | |
) | |
var newArray=new Array(); | |
label:for(var i=0; i<sigs.length;i++ ) { | |
for(var j=0; j<newArray.length;j++ ) { | |
if(newArray[j]==sigs[i]) | |
continue label; | |
} | |
newArray[newArray.length] = sigs[i]; | |
} | |
count = newArray.length; | |
return { count: count, total: total, signatures: newArray }; | |
} | |
db.malware.mapReduce(map,reduce, {out: "composite_scans" }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment