之前玩了下http://reg007.com,他可以判断手机号或者邮箱在哪些网站注册过.

于是试着写了一下判断帐号是否在淘宝注册的脚本.

原理很简单,就是用该帐号登陆,判断返回的页面是不是用户名与密码不匹配..只不过跑的次数太多了会出验证码,没有研究过怎么过验证码,所以还没办法测试大量的帐号.

用到了re,urllib2,request库.request用于简化登陆步骤,re正则简单判断返回页面有无关键字

#!/usr/bin/python
#coding:utf-8
import requests
from bs4 import BeautifulSoup
import urllib2 , urllib
from requests.auth import HTTPBasicAuth
import re




def taobao(username):
    """Query if username has been registed in taobao """
    login_url="https://login.taobao.com/member/login.jhtml"

    post_data = {
        "ua":'',
        "TPL_username" : username,
        "TPL_password":'123',
        "TPL_checkcode":'',
        "loginsite":0,
        "newlogin":0,
        "TPL_redirect_url": 'http://www.taobao.com/' ,
        "from":'tbTop',
        "fc":'default',
        "style":'default',
        "css_style":'',
        "tid":'',
        "support":'000001',
        "CtrlVersion":'1,0,0,7',
        "loginType": 3 ,
        "minititle":'',
        "minipara":'',
        "umto":'T8e1b2fd5644980ce48890080e8ca17da',
        "pstrong":1,
        "llnick":'',
        "sign":'',
        "need_sign":'',
        "isIgnore":'',
        "full_redirect":'',
        "popid":'',
        "callback":'',
        "guf":'',
        "not_duplite_str":'',
        "need_user_id":'',
        "poy":'',
        "gvfdcname":10,
        "gvfdcre":'',
        "from_encoding":'',
        "sub":'false',
        "TPL_password_2":'',
        "loginASR":0,
        "loginASRSuc":0,
        "allp":'',
        "oslanguage":'en-US',
        "sr":'1366*768',
        "osVer":'',
        "naviVer":'chrome|37.0206294',
        }
    headers = {
        'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1',  
        'Referer' : "https://login.taobao.com/member/login.jhtml"
    }  
    client = requests.session()
    direct = client.post(login_url,data=post_data,headers=headers)
    html = direct.text.encode(direct.encoding)
    if re.findall("<p class=\"error\">\xc4\xfa",html): #Mismatch between username and password
        print username,"has been registed" 
def main():
    username = "your user name"
    username = str(username)
    taobao(username)

if __name__ == "__name__":
	main()