Esempio n. 1
0
 def policy_caps(self, **kwargs):
     return list(se.PolCapQuery(self, **kwargs).results())
    if args.nodeconquery or args.all:
        q = setools.NodeconQuery(p)
        if isinstance(args.nodeconquery, str):
            q.network = args.nodeconquery

        components.append(("Nodecon", q, lambda x: x.statement()))

    if args.permissivequery or args.all:
        q = setools.TypeQuery(p, permissive=True, match_permissive=True)
        if isinstance(args.permissivequery, str):
            q.name = args.permissivequery

        components.append(("Permissive Types", q, lambda x: x.statement()))

    if args.polcapquery or args.all:
        q = setools.PolCapQuery(p)
        if isinstance(args.polcapquery, str):
            q.name = args.polcapquery

        components.append(("Polcap", q, lambda x: x.statement()))

    if args.portconquery or args.all:
        q = setools.PortconQuery(p)
        if isinstance(args.portconquery, str):
            try:
                ports = [int(i) for i in args.portconquery.split("-")]
            except ValueError:
                parser.error(
                    "Enter a port number or range, e.g. 22 or 6000-6020")

            if len(ports) == 2: