diff options
Diffstat (limited to 'asn.py')
-rwxr-xr-x | asn.py | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -121,9 +121,11 @@ class WHOISListener(Common): Common.__init__(self) self.db = db if v4: - self._listen_v4(v4, port) + listen_v4 = Thread(target=self._listen_v4, args=(v4, port)) + listen_v4.start() if v6: - self._listen_v6(v6, port) + listen_v6 = Thread(target=self._listen_v6, args=(v6, port)) + listen_v6.start() def _listen_v4(self, host, port): with socket.socket() as _socket: @@ -136,8 +138,7 @@ class WHOISListener(Common): args=(conn,addr,), daemon=True).start() def _listen_v6(self, host, port): - with (socket.socket(socket.AF_INET6, socket.SOCK_DGRAM, - socket.IPPROTO_UDP) as _socket): + with socket.socket(family=socket.AF_INET6) as _socket: _socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) _socket.bind((host, port)) _socket.listen() @@ -324,7 +325,7 @@ class DB: break if __name__ == '__main__': - desc = 'asn: map hosts to their corresponding ASN via WHOIS' + desc = 'asn: map hosts to their corresponding ASN via HTTP/WHOIS' parser = argparse.ArgumentParser(description=desc, formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('--bind-whois-v4', dest='whois_v4', type=str, action='store', |