Example #1
0
def process_domain(registered_domain, updated_domains, now=None):
    """Update the statistics for all fuzz results for this domain."""
    if now is None:
        now = datetime.datetime.now()

    updated_domains = set(updated_domains)

    delta_report = repository.get_delta_report(registered_domain)
    if delta_report is None:
        return updated_domains

    for domain in delta_reports.extract_domains(delta_report):

        if domain in updated_domains:
            continue

        updated = statistics_repository.noise_stat_last_updated(domain)
        if updated is not None and (now - updated) < FREQUENCY:
            continue

        stat = statistics_repository.get_noise_stat(domain)
        if stat is None:
            stat = NoiseStatistic(domain, deltas=1)
        else:
            stat.increment()
            stat.update_window()

        statistics_repository.set_noise_stat(stat)
        statistics_repository.mark_noise_stat_as_updated(domain)
        updated_domains.add(domain)

    return updated_domains
Example #2
0
def get_noisy_domains(candidate_domains):
    """Filter list of domains to those that are noisy."""
    results = []
    for domain in candidate_domains:
        noise_stat = statistics_repository.get_noise_stat(domain)
        if noise_stat is not None and noise_stat.is_noisy is True:
            results.append(domain)
    return results
Example #3
0
def get_noisy_domains(candidate_domains):
    """Filter list of domains to those that are noisy."""
    results = set()
    for domain in candidate_domains:
        noise_stat = statistics_repository.get_noise_stat(domain)
        if noise_stat is not None and noise_stat.is_noisy is True:
            results.add(domain)
    return results
Example #4
0
def update_windows(skip_list, now=None):
    """Update all the windows.

    Skip those updated already, as the window is updated as part of the
    increment process too.
    """
    updated_count = 0

    if now is None:
        now = datetime.datetime.now()

    domains_iter = statistics_repository.inoisy_domains()

    while True:
        try:
            domain = domains_iter.next()
        except StopIteration:
            break

        if domain is None:
            continue

        if domain in skip_list:
            continue

        updated = statistics_repository.noise_stat_last_updated(domain)
        if updated is not None and (now - updated) < FREQUENCY:
            continue

        stat = statistics_repository.get_noise_stat(domain)
        if stat is None:
            continue

        stat.update_window()
        statistics_repository.set_noise_stat(stat)
        statistics_repository.mark_noise_stat_as_updated(domain)

        updated_count += 1

    return updated_count
Example #5
0
def process_domain(registered_domain, now=None):
    """Update the statistics for all fuzz results for this domain."""
    if now is None:
        now = datetime.datetime.now()

    delta_report = repository.get_delta_report(registered_domain)
    if delta_report is None:
        return

    for domain in delta_reports.extract_domains(delta_report):

        updated = statistics_repository.noise_stat_last_updated(domain)
        if updated is not None and (now - updated) < FREQUENCY:
            continue

        stat = statistics_repository.get_noise_stat(domain)
        if stat is None:
            stat = NoiseStatistic(domain, deltas=1)
        else:
            stat.increment()
            stat.update_window()

        statistics_repository.set_noise_stat(stat)
        statistics_repository.mark_noise_stat_as_updated(domain)