(url)
return retVal
Returns proper Host header value for a given target URL

    >>> getHostHeader('http://www.target.com/vuln.php?id=1')
    'www.target.com'
Returns proper Host header value for a given target URL
Returns proper Host header value for a given target URL
def getHostHeader(url):
    """
    Returns proper Host header value for a given target URL

    >>> getHostHeader('http://www.target.com/vuln.php?id=1')
    'www.target.com'
    """

    retVal = url

    if url:
        retVal = urlparse.urlparse(url).netloc

        if re.search("http(s)?://\[.+\]", url, re.I):
            retVal = extractRegexResult("http(s)?://\[(?P<result>.+)\]", url)
        elif any(retVal.endswith(':%d' % _) for _ in (80, 443)):
            retVal = retVal.split(':')[0]

    return retVal
def getHostHeader ( url ) : retVal = url if url : retVal = urlparse . urlparse ( url ) . netloc if re . search ( "http(s)?://\[.+\]" , url , re . I ) : retVal = extractRegexResult ( "http(s)?://\[(?P<result>.+)\]" , url ) elif any ( retVal . endswith ( ':%d' % _ ) for _ in ( 80 , 443 ) ) : retVal = retVal . split ( ':' ) [ 0 ] return retVal