domain_name

import re
import urllib
import urllib2
import cookielib
def check (name):
        data = {"d_name":"","dtype":"common"}
        data["d_name"] = name
        post_data = urllib.urlencode(data)
        cj = cookielib.CookieJar
        opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
        headers = {"User-agent":"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1"}
        req = urllib2.Request("http://www.zgsj.com/domain_reg/domaintrans.asp",post_data,headers)
        content = urllib2.urlopen(req)
        c=content.read()
        p = re.compile('<tr height=.*?value=\'(.*?)\' />').findall(c)
        if p:
            print name
def apply():
    a=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
    for i1 in a:
        check(i1+'.com')
        for i2 in a:
             check(i1+i2+'.com')
             for i3 in a:
                 check(i1+i2+i3+'.com')
                 for i4 in a:
                       check(i1+i2+i3+i4+'.com')
                       for i5 in a:
                           check(i1+i2+i3+i4+i5+'.com')

apply()