(feeds, analyst, begin=None, end=None, import_now=False)
return results
Given a list of feeds, individually poll each, save the data to
    the DB, and return a preview for each and status.

    :param feeds: Feeds to poll represented as [server_name, feed#]
    :type feeds: list
    :param analyst: Userid of the analyst initiating the poll
    :type analyst: string
    :param begin: Exclusive begin component of the timerange to be polled
    :type begin: :class:`datetime.datetime`
    :param end: Inclusive end component of the timerange to be polled
    :type end: :class:`datetime.datetime`
    :param import_now: If True, import all STIX data into CRITs
    :type import_now: boolean
    :returns: dict with keys:
              "polls" (list) - The metadata for each poll
              "status" (bool) - False if any poll failed
              "poll_msg" (str) - Status message
Given a list of feeds, individually poll each, save the data to
    the DB, and return a preview for each and status.
Given a list of feeds individually poll each save the data to the DB and return a preview for each and status .
def poll_taxii_feeds(feeds, analyst, begin=None, end=None, import_now=False):
    """
    Given a list of feeds, individually poll each, save the data to
    the DB, and return a preview for each and status.

    :param feeds: Feeds to poll represented as [server_name, feed#]
    :type feeds: list
    :param analyst: Userid of the analyst initiating the poll
    :type analyst: string
    :param begin: Exclusive begin component of the timerange to be polled
    :type begin: :class:`datetime.datetime`
    :param end: Inclusive end component of the timerange to be polled
    :type end: :class:`datetime.datetime`
    :param import_now: If True, import all STIX data into CRITs
    :type import_now: boolean
    :returns: dict with keys:
              "polls" (list) - The metadata for each poll
              "status" (bool) - False if any poll failed
              "poll_msg" (str) - Status message
    """
    results = {'polls': [], 'status': True}
    success_polls = failed_polls = 0
    poll_details = []
    sc = get_config('taxii_service').taxii_servers

    if import_now:
        ret = {
                'successes': 0,
                'failures': [],
                'Certificate': [],
                'Domain': [],
                'Email': [],
                'Event': [],
                'Indicator': [],
                'IP': [],
                'PCAP': [],
                'RawData': [],
                'Sample': [],
               }

    for feed in feeds:
        svrc = sc[feed[0]]
        hostname = svrc['hostname']
        https = svrc['https']
        port = svrc['port']
        path = svrc['ppath']
        version = svrc['version']
        akey = str(svrc['keyfile'])
        user = str(svrc.get('user'))
        pword = str(svrc.get('pword'))
        acert = str(svrc['lcert'])
        feedc = svrc['feeds'][feed[1]]
        feed_name = feedc['feedname']
        subID = feedc.get('subID')
        ecert = feedc.get('fcert')
        ekey = feedc.get('fkey')

        result = execute_taxii_agent(hostname, https, port, path, version,
                                     feed_name, akey, acert, subID, analyst,
                                     user, pword, ecert, ekey, begin, end,
                                     import_now)

        fails = result['failures']
        fails = "<br>".join(cgi.escape(x) for x in fails)

        if fails:
            results['status'] = False
            failed_polls += 1
            success = False
        else:
            success = True
            success_polls += 1

        if 'import' in result:
            for k in ret:
                if k == 'successes':
                    ret[k] += result['import'][k]
                else:
                    ret[k].extend(result['import'][k])

        poll_details = {'hostname': hostname,
                        'feed': feed_name,
                        'mid': result['taxii_msg_id'],
                        'poll_id': result['poll_id'],
                        'blk_count': result['blk_count'],
                        'start': result['start'],
                        'end': result['end'],
                        'success': success,
                        'msg': fails}
        results['polls'].append(poll_details)

    total_polls = success_polls + failed_polls
    msg = "%s of %s polls were processed successfully" % (success_polls,
                                                          total_polls)
    if import_now:
        results['imported'] = ret
    results['poll_msg'] = msg
    return results
def poll_taxii_feeds ( feeds , analyst , begin = None , end = None , import_now = False ) : results = { 'polls' : [ ] , 'status' : True } success_polls = failed_polls = 0 poll_details = [ ] sc = get_config ( 'taxii_service' ) . taxii_servers if import_now : ret = { 'successes' : 0 , 'failures' : [ ] , 'Certificate' : [ ] , 'Domain' : [ ] , 'Email' : [ ] , 'Event' : [ ] , 'Indicator' : [ ] , 'IP' : [ ] , 'PCAP' : [ ] , 'RawData' : [ ] , 'Sample' : [ ] , } for feed in feeds : svrc = sc [ feed [ 0 ] ] hostname = svrc [ 'hostname' ] https = svrc [ 'https' ] port = svrc [ 'port' ] path = svrc [ 'ppath' ] version = svrc [ 'version' ] akey = str ( svrc [ 'keyfile' ] ) user = str ( svrc . get ( 'user' ) ) pword = str ( svrc . get ( 'pword' ) ) acert = str ( svrc [ 'lcert' ] ) feedc = svrc [ 'feeds' ] [ feed [ 1 ] ] feed_name = feedc [ 'feedname' ] subID = feedc . get ( 'subID' ) ecert = feedc . get ( 'fcert' ) ekey = feedc . get ( 'fkey' ) result = execute_taxii_agent ( hostname , https , port , path , version , feed_name , akey , acert , subID , analyst , user , pword , ecert , ekey , begin , end , import_now ) fails = result [ 'failures' ] fails = "<br>" . join ( cgi . escape ( x ) for x in fails ) if fails : results [ 'status' ] = False failed_polls += 1 success = False else : success = True success_polls += 1 if 'import' in result : for k in ret : if k == 'successes' : ret [ k ] += result [ 'import' ] [ k ] else : ret [ k ] . extend ( result [ 'import' ] [ k ] ) poll_details = { 'hostname' : hostname , 'feed' : feed_name , 'mid' : result [ 'taxii_msg_id' ] , 'poll_id' : result [ 'poll_id' ] , 'blk_count' : result [ 'blk_count' ] , 'start' : result [ 'start' ] , 'end' : result [ 'end' ] , 'success' : success , 'msg' : fails } results [ 'polls' ] . append ( poll_details ) total_polls = success_polls + failed_polls msg = "%s of %s polls were processed successfully" % ( success_polls , total_polls ) if import_now : results [ 'imported' ] = ret results [ 'poll_msg' ] = msg return results