Random Resource Locator

I once heard, that every domain containing three letters of the alphabet and ending with ‘.com’ was assigned to some web server. This would mean, all 17576¹ domains were used.
To test it, I wrote this little Python program.

Usage

  • To use it, simply press enter to open a random page. Because you often will get redirected, the program will print out the url on the screen.

A few urls it tried¹Any three letters of the twenty-six in the alphabet result in 26^3 = 17576.


# Python 2.7.7 Code
# Jonathan Frech 18th of August, 2015

# import
import random, webbrowser

# header
s = "Random Resource Locator"
print "=" * (len(s) + 2)
print " " + s + " "
print "=" * (len(s) + 2)

# loop
while True:
	# wait for user
	raw_input("> ")
	
	# create url
	r = ""
	for _ in range(0, 3):
		r += "abcdefghijklmnopqrstuvwxyz"[random.randint(0, 25)]
	url = "http://" + r + ".com/"
	
	# print and open
	print "Opening '" + url + "'..."
	webbrowser.open(url, 1)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s