How to use the passivetotal.libs.actions.ActionsClient 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 / tests / test_actions.py View on Github external
def setup_class(self):
        self.patch_get = patch('passivetotal.api.Client._get', fake_request)
        self.patch_set = patch('passivetotal.api.Client._send_data', fake_request)
        self.patch_get.start()
        self.patch_set.start()
        self.client = ActionsClient('--No-User--', '--No-Key--')
github PUNCH-Cyber / stoq-plugins-public / v1 / worker / passivetotal / passivetotal / passivetotal.py View on Github external
def get_action(self, **kwargs):
        client = ActionsClient(self.username, self.apikey)

        keys = ['query', 'tags', 'classification', 'monitor', 'sinkhole',
                'dynamic_dns', 'ever_compromised', 'metadata']

        params = self._cleanup_params(keys, **kwargs)

        res = None

        if params.get('tags'):
            params['tags'] = [tag.strip() for tag in params['tags'].split(',')]

            if kwargs.get('add_tags'):
                res = client.add_tags(**params)
            elif kwargs.get('remove_tags'):
                res = client.remove_tags(**params)
            elif kwargs.get('set_tags'):
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)
github passivetotal / python_api / passivetotal / libs / actions.py View on Github external
def __init__(self, *args, **kwargs):
        """Setup the primary client instance."""
        super(ActionsClient, self).__init__(*args, **kwargs)