forked from aquasecurity/cloudsploit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
56 lines (50 loc) · 1.94 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
var async = require('async');
// var AWSConfig = {
// accessKeyId: '',
// secretAccessKey: '',
// sessionToken: '',
// region: 'us-east-1'
// };
var AWSConfig = require(__dirname + '/../../cloudsploit-secure/scan-test-credentials.json');
var plugins = [
'iam/rootAccountSecurity.js',
'iam/usersMfaEnabled.js',
'iam/passwordPolicy.js',
'iam/accessKeys.js',
'iam/groupSecurity.js',
'cloudtrail/cloudtrailEnabled.js',
'cloudtrail/cloudtrailBucketDelete.js',
'ec2/accountLimits.js',
'ec2/certificateExpiry.js',
'ec2/insecureCiphers.js',
'vpc/detectClassic.js',
'ec2/securityGroups.js',
's3/s3Buckets.js',
'route53/domainSecurity.js',
'rds/databaseSecurity.js'
];
console.log('CATEGORY\t\tPLUGIN\t\t\t\tTEST\t\t\t\tRESOURCE\t\t\tREGION\t\tSTATUS\tMESSAGE');
async.eachSeries(plugins, function(pluginPath, callback){
var plugin = require(__dirname + '/plugins/' + pluginPath);
plugin.run(AWSConfig, function(err, result){
//console.log(JSON.stringify(result, null, 2));
for (i in result.tests) {
for (j in result.tests[i].results) {
var statusWord;
if (result.tests[i].results[j].status === 0) {
statusWord = 'OK';
} else if (result.tests[i].results[j].status === 1) {
statusWord = 'WARN';
} else if (result.tests[i].results[j].status === 2) {
statusWord = 'FAIL';
} else {
statusWord = 'UNKNOWN';
}
console.log(result.category + '\t\t' + result.title + '\t' + result.tests[i].title + '\t' + (result.tests[i].results[j].resource || 'N/A') + '\t' + (result.tests[i].results[j].region || 'Global') + '\t\t' + statusWord + '\t' + result.tests[i].results[j].message);
}
}
callback(err);
});
}, function(err, data){
if (err) return console.log(err);
});