def get_domain_all_correlation(domain, correlation_names=[], get_nb=False): ''' Retun all correlation of a given domain. :param domain: crawled domain :type domain: str :return: a dict of all correlation for a given domain :rtype: dict ''' if not correlation_names: correlation_names = Correlate_object.get_all_correlation_names() domain_correl = {} for correlation_name in correlation_names: if correlation_name == 'cryptocurrency': res = get_domain_cryptocurrency(domain, get_nb=get_nb) elif correlation_name == 'pgp': res = get_domain_pgp(domain, get_nb=get_nb) elif correlation_name == 'username': res = get_domain_username(domain, get_nb=get_nb) elif correlation_name == 'decoded': res = get_domain_decoded(domain) elif correlation_name == 'screenshot': res = get_domain_screenshot(domain) else: res = None # add correllation to dict if res: domain_correl[correlation_name] = res return domain_correl
def get_item_all_correlation(item_id, correlation_names=[], get_nb=False): ''' Retun all correlation of a given item id. :param item_id: item id :type domain: str :return: a dict of all correlation for a item id :rtype: dict ''' if not correlation_names: correlation_names = Correlate_object.get_all_correlation_names() item_correl = {} for correlation_name in correlation_names: if correlation_name == 'cryptocurrency': res = get_item_cryptocurrency(item_id, get_nb=get_nb) elif correlation_name == 'pgp': res = get_item_pgp(item_id, get_nb=get_nb) elif correlation_name == 'username': res = get_item_username(item_id, get_nb=get_nb) elif correlation_name == 'decoded': res = get_item_decoded(item_id) elif correlation_name == 'screenshot': res = get_item_all_screenshot(item_id) else: res = None # add correllation to dict if res: item_correl[correlation_name] = res return item_correl
def sanitise_correlation_names(correlation_names): ''' correlation_names ex = 'pgp,crypto' ''' all_correlation_names = Correlate_object.get_all_correlation_names() if correlation_names is None: return all_correlation_names else: l_correlation_names = [] for correl in correlation_names.split(','): if correl in all_correlation_names: l_correlation_names.append(correl) if l_correlation_names: return l_correlation_names else: return all_correlation_names