简体   繁体   中英

I am not getting onion url from IPV4 Address using python socket

I am trying to get onion URL from IPV4 Address using python.

{
    try:
        return socket.gethostbyaddr(addr)[0]
    except socket.gaierror:
       print(addr+":nodename nor servname provided, or not known")
       return None
    except socket.herror:
        print(addr+':Unknown host')
        return None
    except socket.timeout:
        print(addr+':Timeout')
        return None
}

But from socket.gethostbyaddr(addr)[0] , I can't get onion URL and I can get only well-know hostname.

Thanks for your advice.

Interesting, You need to run with this code

import subprocess import ipaddress for ip in ipaddress.IPv4Network('5.0.0.0/24'): subprocess.call(["tor-resolve", "-x", ip])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM