Beispiel #1
0
    def get_used_ports_info(self):
        try:
            nc = NodeCache().get_cache()
            print nc
            result = []

            for n,c in nc.iteritems():
                res = "\n\n Server : '%s'" % n

                for p,d in c['ports'].iteritems():
                    res += "\n\t Port : '%s' , Time : '%s'" % (p, d)

                result.append(res)

            return highlight('\n'.join(result), PythonLexer(), HtmlFormatter(full=False, noclasses=True))

        except Exception as ex:
            print_traceback()
            return '<html>Error getting Ports information.</html>'
Beispiel #2
0
 def get_unused_port(self, start, end):
     used_ports = self.get_used_ports()
     nc = NodeCache()
     selected_port = nc.get_port(self.hostname, constants.PORTS, used_ports, start, end)
     return selected_port