1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

URLtoDOMAIN - fast and sure way of extracting domains or subdomains from URL

Discussion in 'Black Hat SEO Tools' started by FrankJack, Dec 21, 2013.

  1. FrankJack

    FrankJack Newbie

    Joined:
    Dec 17, 2013
    Messages:
    8
    Likes Received:
    2
    I wouldn't call it a 'black SEO' tool - it is rather for webmasters who want to go the right way and disavow bad incoming links : ). Maybe some of you will also find it useful because it can save time - URLtoDOMAIN (cannot add full link here).
     
  2. JustUs

    JustUs Power Member

    Joined:
    May 6, 2012
    Messages:
    609
    Likes Received:
    451
    You would not mean like this, would you?

    Code:
    string IpAddressString = "208.5.42.49";
    
    try 
    {
       IPAddress hostIPAddress = IPAddress.Parse(IpAddressString);
       IPHostEntry hostInfo = Dns.GetHostByAddress(hostIPAddress);
       // Get the IP address list that resolves to the host names contained in 
       // the Alias property.
       IPAddress[] address = hostInfo.AddressList;
       // Get the alias names of the addresses in the IP address list.
       String[] alias = hostInfo.Aliases;
    
       Console.WriteLine("Host name : " + hostInfo.HostName);
       Console.WriteLine("\nAliases :");
       for(int index=0; index < alias.Length; index++) {
         Console.WriteLine(alias[index]);
       } 
       Console.WriteLine("\nIP address list : ");
       for(int index=0; index < address.Length; index++) {
          Console.WriteLine(address[index]);
       }
    }
    catch(SocketException e) 
    {
       Console.WriteLine("SocketException caught!!!");
       Console.WriteLine("Source : " + e.Source);
       Console.WriteLine("Message : " + e.Message);
    }
    catch(FormatException e)
    {
       Console.WriteLine("FormatException caught!!!");
       Console.WriteLine("Source : " + e.Source);
       Console.WriteLine("Message : " + e.Message);
    }
    catch(ArgumentNullException e)
    {
       Console.WriteLine("ArgumentNullException caught!!!");
       Console.WriteLine("Source : " + e.Source);
       Console.WriteLine("Message : " + e.Message);
    }
    catch(Exception e)
    {
        Console.WriteLine("Exception caught!!!");
        Console.WriteLine("Source : " + e.Source);
        Console.WriteLine("Message : " + e.Message);
    }
     
  3. FrankJack

    FrankJack Newbie

    Joined:
    Dec 17, 2013
    Messages:
    8
    Likes Received:
    2
    I guess you refer to IP address, not URL and domain. But I might be wrong ;).
     
  4. JustUs

    JustUs Power Member

    Joined:
    May 6, 2012
    Messages:
    609
    Likes Received:
    451
    OR

    Get IP address from host name.

    Code:
    [COLOR=Blue]public[/COLOR] [COLOR=Blue]static[/COLOR] [COLOR=Blue]void[/COLOR] DoGetHostEntry([COLOR=Blue]string[/COLOR] hostname)
    {
        IPHostEntry host;
    
        host = Dns.GetHostEntry(hostname);
    
        Console.WriteLine([COLOR=#A31515]"GetHostEntry({0}) returns:"[/COLOR], hostname);
    
        [COLOR=Blue]foreach[/COLOR] (IPAddress ip [COLOR=Blue]in[/COLOR] host.AddressList)
        {
            Console.WriteLine([COLOR=#A31515]"    {0}"[/COLOR], ip);
        }
    }
    Then plug IP address into previous code.
     
    Last edited: Dec 22, 2013