Created
March 27, 2014 16:33
-
-
Save mattburch/9811815 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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