Пример #1
0
def ipv6_connection(act, target={}, args={}, *extra_args, **extra_kwargs):
    if not isinstance(args, dict) and len(set(args) - ValidArgs) > 0:
        print("Invalid Allow Args")
        return exceptions.bad_argument()

    return exceptions.action_exception('allow',
                                       except_msg='target implementation TBD')
Пример #2
0
def slpf(act, target={}, args={}, *extra_args, **extra_kwargs):
    if not isinstance(args, dict) and len(
            set(args) - {"response_requested", "start_time"}) > 0:
        print("Invalid Delete Args")
        return exceptions.bad_argument()

    return exceptions.action_exception('delete',
                                       except_msg='target implementation TBD')
Пример #3
0
def features(act, target=[], args={}, *extra_args, **extra_kwargs):
    if not isinstance(args, dict) and len(set(args) - {"response"}) > 0:
        print("Invalid Query Args")
        return exceptions.bad_argument()

    if not isinstance(target,
                      list) and len(set(target) - set(Features.keys())) > 0:
        return exceptions.bad_request()

    else:
        rtn = dict(status=200, results={k: Features[k](act) for k in target})

        return {k: v for k, v in rtn.items() if v}
Пример #4
0
def ipv6_addr(act, target="", args={}, *extra_args, **extra_kwargs):
    if not isinstance(args, dict) and len(set(args) - ValidArgs) > 0:
        print("Invalid Deny Args")
        return exceptions.bad_argument()

    ip = valid_ip(target)
    if ip:
        direction = args.get("direction", None)  # Apply to both INPUT and OUTPUT if None
        print(f"Deny ipv6_addr: {ip} - {direction}")
        return exceptions.action_exception('deny', except_msg='target implementation TBD')

    print("Invalid Deny/IPv6_Addr target")
    return exceptions.bad_request(except_msg="Validation Error: Target: ipv6_addr")