Ejemplo n.º 1
0
    def network_list(cls):
        networks = []

        base_dir = os.path.join(sexy.get_base_dir("db"), "net-ipv4")

        for entry in os.listdir(base_dir):
            # With or without the mask is the question...
            #network = cls(entry)
            #networks.append("%s/%s" % (entry, network.mask))
            networks.append("%s" % (entry))

        return networks
Ejemplo n.º 2
0
    def network_list(cls):
        networks = []

        base_dir = os.path.join(sexy.get_base_dir("db"), "net-ipv4")

        for entry in os.listdir(base_dir):
            # With or without the mask is the question...
            #network = cls(entry)
            #networks.append("%s/%s" % (entry, network.mask))
            networks.append("%s" % (entry))

        return networks
Ejemplo n.º 3
0
    def hosts_list(cls, host_type=None):
        hosts = []

        if host_type:
            if host_type not in HOST_TYPES:
                raise Error("Host type must be one of %s" % (" ".join(HOST_TYPES)))

        base_dir = os.path.join(sexy.get_base_dir("db"), "host")

        if not os.path.isdir(base_dir):
            return []

        for entry in os.listdir(base_dir):
            if host_type:
                host = cls(entry)
                if host.host_type == host_type:
                    hosts.append(entry)
            else:
                hosts.append(entry)

        return hosts
Ejemplo n.º 4
0
    def hosts_list(cls, host_type=None):
        hosts = []

        if host_type:
            if host_type not in HOST_TYPES:
                raise Error("Host type must be one of %s" %
                            (" ".join(HOST_TYPES)))

        base_dir = os.path.join(sexy.get_base_dir("db"), "host")

        if not os.path.isdir(base_dir):
            return []

        for entry in os.listdir(base_dir):
            if host_type:
                host = cls(entry)
                if host.host_type == host_type:
                    hosts.append(entry)
            else:
                hosts.append(entry)

        return hosts
Ejemplo n.º 5
0
 def get_base_dir(fqdn):
     return os.path.join(sexy.get_base_dir("db"), "host", fqdn)
Ejemplo n.º 6
0
 def get_base_dir(network):
     return os.path.join(sexy.get_base_dir("db"), "net-ipv4", network)
Ejemplo n.º 7
0
Archivo: mac.py Proyecto: BergSoft/sexy
 def get_base_dir():
     return sexy.get_base_dir("db/mac")
Ejemplo n.º 8
0
 def get_base_dir(fqdn):
     return os.path.join(sexy.get_base_dir("db"), "host", fqdn)
Ejemplo n.º 9
0
 def get_base_dir(network):
     return os.path.join(sexy.get_base_dir("db"), "net-ipv4", network)
Ejemplo n.º 10
0
 def get_base_dir():
     return sexy.get_base_dir("db/mac")