Ejemplo n.º 1
0
def feeder(message, count=0):

    if flag_the_hive or flag_misp:
        tag, item_id = message.split(';')

        ## FIXME: remove it
        if not item_basic.exist_item(item_id):
            if count < 10:
                r_serv_db.zincrby('mess_not_saved_export', message, 1)
                return 0
            else:
                r_serv_db.zrem('mess_not_saved_export', message)
                print('Error: {} do not exist, tag= {}'.format(item_id, tag))
                return 0

        source = item_basic.get_source(item_id)

        if HiveApi != False:
            if int(r_serv_db.get('hive:auto-alerts')) == 1:
                if r_serv_db.sismember('whitelist_hive', tag):
                    create_the_hive_alert(source, item_id, tag)
            else:
                print('hive, auto alerts creation disable')
        if flag_misp:
            if int(r_serv_db.get('misp:auto-events')) == 1:
                if r_serv_db.sismember('whitelist_misp', tag):
                    misp_wrapper.pushToMISP(uuid_ail, item_id, tag)
            else:
                print('misp, auto events creation disable')
Ejemplo n.º 2
0
def exist_item(item_id):
    return item_basic.exist_item(item_id)