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.
|
4 months ago | |
---|---|---|
.vscode | 4 months ago | |
src | 4 months ago | |
.gitignore | 4 months ago | |
Cargo.lock | 4 months ago | |
Cargo.toml | 4 months ago | |
README.md | 4 months ago | |
default.nix | 4 months ago | |
flake.lock | 4 months ago | |
flake.nix | 4 months ago | |
module.nix | 4 months ago | |
shell.nix | 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])