How to use the passivetotal.common.utilities.prune_args function in passivetotal

To help you get started, we’ve selected a few passivetotal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github passivetotal / python_api / passivetotal / cli / client.py View on Github external
def call_actions(args):
    """Abstract call to actions-based queries."""
    client = ActionsClient.from_config()
    pruned = prune_args(
        query=args.query,
        tags=args.tags,
        classification=args.classification,
        monitor=args.monitor,
        sinkhole=args.sinkhole,
        dynamic_dns=args.dynamic_dns,
        ever_compromised=args.ever_compromised,
        metadata=args.metadata
    )

    if args.tags:
        tag_values = [x.strip() for x in args.tags.split(',')]
        pruned['tags'] = tag_values
        if args.add_tags:
            data = client.add_tags(**pruned)
        elif args.remove_tags:
github passivetotal / python_api / passivetotal / cli / client.py View on Github external
def call_attribute(args):
    """Abstract call to attribute-based queries."""
    client = AttributeRequest.from_config()
    pruned = prune_args(
        query=args.query,
        type=args.type
    )

    if args.type == 'tracker':
        data = client.get_host_attribute_trackers(**pruned)
    else:
        data = client.get_host_attribute_components(**pruned)

    return data
github passivetotal / python_api / passivetotal / cli / client.py View on Github external
def call_ssl(args):
    """Abstract call to SSL-based queries."""
    client = SslRequest.from_config()
    pruned = prune_args(
        query=args.query,
        compact_record=args.compact,
        field=args.field,
        type=args.type
    )

    valid_types = ['search', 'history']
    if args.type and args.type not in valid_types:
        raise ValueError("Invalid type specified.")

    if not args.type:
        data = client.get_ssl_certificate_details(**pruned)
    elif args.type == 'history':
        data = client.get_ssl_certificate_history(**pruned)
    elif args.type == 'search' and args.field:
        data = client.search_ssl_certificate_by_field(**pruned)
github passivetotal / python_api / passivetotal / cli / client.py View on Github external
def call_whois(args):
    """Abstract call to WHOIS-based queries."""
    client = WhoisRequest.from_config()
    pruned = prune_args(
        query=args.query,
        compact_record=args.compact,
        field=args.field
    )

    if not args.field:
        data = client.get_whois_details(**pruned)
    else:
        data = client.search_whois_by_field(**pruned)

    return data
github passivetotal / python_api / passivetotal / cli / client.py View on Github external
def call_dns(args):
    """Abstract call to DNS-based queries."""
    client = DnsRequest.from_config()
    pruned = prune_args(
        query=args.query,
        end=args.end,
        start=args.start,
        timeout=args.timeout,
        sources=args.sources
    )

    if args.unique:
        data = client.get_unique_resolutions(**pruned)
    else:
        data = client.get_passive_dns(**pruned)

    return data