Beispiel #1
0
def create_inactive_row(tracker, dns, dns_lookups, ip_key):
    """Creates a tracker tuple where the result is inactive"""
    ip = six.text_type(ip_key)
    row = {'ip': ip, 'ip_int_value': normalize_ip_to_string(ip)}
    if dns:
        if (dns_lookups[ip] and not isinstance(dns_lookups[ip], Exception)):
            row['dns_lookup'] = dns_lookups[ip][0]
        else:
            row['dns_lookup'] = ""
    tracker[(ip, "")] = [row]
Beispiel #2
0
def create_active_row(tracker, dns, dns_lookups, ip_key, ip_result):
    """Creates a tracker tuple where the result is active"""
    ip = six.text_type(ip_key)
    rows = ip_result[ip_key]
    for row in rows:
        row = process_ip_row(row, dns=False)
        if dns:
            if (isinstance(dns_lookups[ip], Exception) or not dns_lookups[ip]):
                row.dns_lookup = ""
            else:
                row.dns_lookup = dns_lookups[ip][0]
        row.ip_int_value = normalize_ip_to_string(row.ip)
        if (row.ip, row.mac) not in tracker:
            tracker[(row.ip, row.mac)] = []
        tracker[(row.ip, row.mac)].append(row)