Skip to content

Instantly share code, notes, and snippets.

@mattburch
Created March 27, 2014 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattburch/9811815 to your computer and use it in GitHub Desktop.
Save mattburch/9811815 to your computer and use it in GitHub Desktop.
var deliverableUniquePortList = function(protocol) {
// Generates a of reports for deliverable template
// Usages: deliverableUniquePortList()
// Created by: Matt Burch
// Requires client-side updates: false
var PROJECT_ID = Session.get('projectId');
var unique = {};
var ports = Ports.find({'project_id' : PROJECT_ID}).fetch()
ports.forEach( function(port) {
if (port.port == 0){
return;
}
if (!(port.service)) {
port.service = "unknown"
}
if (!(port.service.toUpperCase() + " (" + port.port + "/" + port.protocol.toUpperCase() + ")" in unique)) {
unique[port.service.toUpperCase() + " (" + port.port + "/" + port.protocol.toUpperCase() + ")"] = 1;
}
else {
unique[port.service.toUpperCase() + " (" + port.port + "/" + port.protocol.toUpperCase() + ")"] ++;
}
})
for (key in unique){
console.log(key); //+ "\t" + unique[key] );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment