forked from lair-framework/browser-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete_down_hosts.js
32 lines (29 loc) · 960 Bytes
/
delete_down_hosts.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
var deleteDownHosts = function () {
// Deletes hosts that are "down". This means there are no
// open ports, not even icmp response.
//
// Usage: deleteDownHosts()
// Created by: @uth_cr33p (Jeff Stiles)
// Requires client-side updates: ??
var PROJECT_ID = Session.get('projectId');
var portarray = [];
var delarray = [];
var hosts = Hosts.find({
'project_id': PROJECT_ID
}).fetch();
hosts.forEach(function (host) {
var hostid = host._id;
var ports = Ports.find({
'project_id': PROJECT_ID,
'host_id': host._id
}).fetch();
if (ports.length == 0) {
console.log('Removing HostID: ' + hostid);
Meteor.call('removeHost', PROJECT_ID, hostid, function (err) {
if (!err) {
Meteor.call('removeHostFromVulnerabilities', PROJECT_ID, hostid);
}
});
}
});
};