@passmarked/malware
Version:
Rules that check if the page or linked pages on the same domain (or external) contain any unwanted software,malware or reported phishing attacks
48 lines (34 loc) • 1.11 kB
JavaScript
/**
* Required modules
**/
const S = require('string');
const Drivers = require('../drivers');
/**
* Runs the malware checks against the current sites page
**/
module.exports = exports = function(payload, fn) {
// get the data
var data = payload.getData();
// do the checks
Drivers.check(payload, [ data.redirected || data.url ], function(err, detections) {
// loop and add all the errors that were found
for(var i = 0; i < (detections || []).length; i++) {
// local reference
var detection = detections[i];
// add the rule
payload.addRule({
key: 'page.' + detection.type.toLowerCase(),
message: S(detection.type).capitalize().s + ' detected on page',
type: 'critical'
}, {
display: 'url',
url: detection.preview,
message: '$ reported that the page hosts $',
tool: 'open',
identifiers: [ detection.source, S(detection.type).capitalize().s ]
});
}
// done
fn(null);
});
};