[advanced search]
Results from the most recent live auction are here.
16 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming > CODE
User Name
Password

Old 11-22-2007, 01:25 AM   · #1
Palyriot
NamePros Regular
 
Palyriot's Avatar
 
Name: Derek
Location: Seattle, Wa
Trader Rating: (14)
Join Date: Jul 2004
Posts: 597
NP$: 69.00 (Donate)
Palyriot is a jewel in the roughPalyriot is a jewel in the roughPalyriot is a jewel in the rough
Arrow Available Random Domain Generator in C#

I was bored and decided to make an available random domain generator in C#, inspired by Jim_'s thread, Available 3-Character Domain Scanner. I know some of you are going to complain that it may spam whois servers, but you can just add a few more whois websites to the "whoisWebsites" array. It's not commented, because I hate commenting, but if there are any questions, feel free to ask. I also know that people will fix and add stuff to this, so feel free to.

Code:
using System; using System.Text; using System.Net; class Program { static Random rand = new Random(); static void Main() { //Config const int NUMBER_OF_DOMAINS_TO_CHECK = 10; //Will actually check this amount multiplied by the number of extensions listed below. const int LENGTH_OF_DOMAINS = 4; const bool UPPERCASE = false; string[] extensions = new string[] {"com", "net", "org"}; Console.WriteLine("Checking {0} domains: \n", (NUMBER_OF_DOMAINS_TO_CHECK * extensions.Length)); int domainCount = 0; for (int i = 1; i <= NUMBER_OF_DOMAINS_TO_CHECK; i++) { string domain = CreateDomain(LENGTH_OF_DOMAINS, UPPERCASE); foreach (string extension in extensions) { Console.Write(domain + "." + extension); if (CheckDomain(domain + "." + extension)) { Console.WriteLine(" <---Available---"); domainCount++; } else { Console.WriteLine(); } } } if (domainCount != 0) Console.WriteLine("\n{0} available domains found.", domainCount); else Console.WriteLine("No domains found."); Console.Read(); } static bool CheckDomain(string domain) { string[] whoisWebsites = new string[] {"http://registrar.verisign-grs.com/cgi-bin/whois?whois_nic="}; WebClient reader = new WebClient(); string url = whoisWebsites[rand.Next(0, whoisWebsites.Length - 1)] + domain; byte[] reqHTML; reqHTML = reader.DownloadData(url); UTF8Encoding objUTF8 = new UTF8Encoding(); string contents = objUTF8.GetString(reqHTML); if (contents.IndexOf("No match") == -1 && contents.IndexOf("Not Found") == -1) { return false; } else { return true; } } static string CreateDomain(int length, bool uppercase) { string domain = null; for (int i = 1; i <= length; i++) { char letter = (char)rand.Next(97, 123); domain += letter.ToString(); } if (uppercase) domain = domain.ToUpper(); return domain; } }


Please register or log-in into NamePros to hide ads

Last edited by Palyriot : 11-22-2007 at 01:42 AM. Reason: PIR currently restrict whois access for the general public to 4 lookups
Palyriot is offline   Reply With Quote
Old 11-28-2007, 05:02 AM   · #2
ninedogger
DNOA Member
 
ninedogger's Avatar
 
Location: Iowa
Trader Rating: (38)
Join Date: Jun 2004
Posts: 656
NP$: 13.10 (Donate)
ninedogger is a glorious beacon of lightninedogger is a glorious beacon of lightninedogger is a glorious beacon of lightninedogger is a glorious beacon of lightninedogger is a glorious beacon of lightninedogger is a glorious beacon of light
Save The Children
This looks pretty cool.

I will give it a try later. I always looked for C# domain tools
__________________
Want to prove yourself?

CHECK OUT MY DOMAINS!
ninedogger is offline  
  Reply With Quote
Old 11-28-2007, 08:46 AM   · #3
Peter
NamePros Staff
 
Peter's Avatar
 
Name: Peter McDonald
Location: Dundee, Scotland
Trader Rating: (42)
Join Date: Nov 2003
Posts: 4,051
NP$: 178.95 (Donate)
Peter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud of
Child Abuse Save The Children Save The Children
very neat indeed.

If anyone is unsure at the moment the tool creates random domain names of 4 characters. It then checks whether the .com, .net and .org are taken for that phrase. It does this for 10 phrases at a time.
Peter is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


Site Sponsors
Buy Flash Arcade Game Script http://www.mobisitetrader.com/ Hunting Moon
Advertise your business at NamePros
All times are GMT -7. The time now is 11:17 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0