-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathnikto_Top_Findings.js
64 lines (58 loc) · 1.67 KB
/
nikto_Top_Findings.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
57
58
59
60
61
62
63
64
/* eslint-disable no-unused-vars */
/* globals Session Services Hosts Meteor */
function niktoTopFindings (custom, filter) {
// Lists Nikto Top Findings results per host/vhost
//
// Created by: Matt Burch
// Usage: niktoTopFindings([], true)
// Usage: niktoTopFindings(['(.*might be interesting.*)'], true)
// Usage: niktoTopFindings([], false)
var nikto = new RegExp('Nikto')
var findings = {}
var projectId = Session.get('projectId')
var topFindings = [
'(.*might be interesting.*)',
'(.*Public HTTP Methods:.*PUT.*)',
'(.*[Ww]eb[Dd]av.*)',
'(.*Directory indexing found.*)',
'(.*default file found.*)',
'(.*Server leaks.*IP.*)',
'(.*OSVDBID:.*)'
]
if (custom.length > 0) {
topFindings = custom
}
var services = Services.find({
'projectId': projectId
}).fetch()
services.forEach(function (service) {
var host = Hosts.findOne({
'projectId': projectId,
'_id': service.hostId
})
service.notes.forEach(function (note) {
if (nikto.test(note.title)) {
var title = note.title.match(/\(.*\)/)
if (filter) {
var search = new RegExp(topFindings.join('|') + '\\n', 'g')
var f = note.content.match(search)
if (f) {
if (!(findings[host.ipv4 + ' ' + title])) {
findings[host.ipv4 + ' ' + title] = []
}
findings[host.ipv4 + ' ' + title].push(f.join(''))
}
} else {
console.log(host.ipv4 + ' ' + title)
console.log(note.content)
}
}
})
})
if (filter) {
for (var key in findings) {
console.log(key)
console.log(findings[key].join(''))
}
}
}