How to use local DNS to resolve a host name

  • Admin

    If you want to pass an IP address to a proxy instead of the domain name you can resolve it locally through a simple IronPython script like this (where you put your own URL inside the URL variable):

    SET VAR "URL" ""
    PARSE "<URL>" REGEX "^(?:https?:\/\/)?(?:[^@\/\n][email protected])?(?:www\.)?([^:\/?\n]+)" "[1]" -> VAR "DOMAIN"
    BEGIN SCRIPT IronPython
    from System.Net import Dns
    entry = Dns.GetHostEntry(DOMAIN)
    ip = entry.AddressList[0]
    END SCRIPT -> VARS "ip"
    PRINT <ip>

Log in to reply