You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
tuxcoder d20ce2efbc add retry and reduce timeout to improve performance 4 months ago
.vscode init - Im to fast 4 months ago
src add retry and reduce timeout to improve performance 4 months ago
.gitignore add nixos and bugfixes 4 months ago
Cargo.lock init - Im to fast 4 months ago
Cargo.toml init - Im to fast 4 months ago
README.md init - Im to fast 4 months ago
default.nix add nixos and bugfixes 4 months ago
flake.lock add nixos and bugfixes 4 months ago
flake.nix add nixos and bugfixes 4 months ago
module.nix add nixos and bugfixes 4 months ago
shell.nix add nixos and bugfixes 4 months ago

README.md

old code:

import ipaddress
from multiprocessing import Pool
import socket
import sys
import json

def get_list():
    with open('list.json') as fd:
        return json.load(fd)

def get_ips(domain:str):
    return [ ipaddress.ip_address(i[4][0]) for i in socket.getaddrinfo(domain,port=25,type=1) ]

def check(address,entry):
    response = None
    try:
        if entry['ipv4'] and address.version == 4:
            response = socket.gethostbyname(address.reverse_pointer.replace('in-addr.arpa',entry['dbl']))
        if entry['ipv6'] and address.version == 6:
            response =socket.gethostbyname(address.reverse_pointer.replace('ip6.arpa',entry['dbl']))
    except socket.gaierror:
        pass
    if response is not None and entry['type']=='b':
        print('{} {:s} {:s}'.format(address, entry['link'],response))
        return False
    return True


def check_domain(domain):
    with Pool(100) as p:
        for address in get_ips(domain):
            p.starmap(check, [ (address,entry) for entry in get_list() ] )

if __name__ == '__main__':

    check_domain(sys.argv[1])