一个判断帐号是否在淘宝注册过的Py脚本

2014-09-10 Mithrilwoodrat 更多博文 » 博客 » GitHub »

原文链接 http://woodrat.xyz/2014/09/10/%e4%b8%80%e4%b8%aa%e5%88%a4%e6%96%ad%e5%b8%90%e5%8f%b7%e6%98%af%e5%90%a6%e5%9c%a8%e6%b7%98%e5%ae%9d%e6%b3%a8%e5%86%8c%e8%bf%87%e7%9a%84py%e8%84%9a%e6%9c%ac/
注:以下为加速网络访问所做的原文缓存,经过重新格式化,可能存在格式方面的问题,或偶有遗漏信息,请以原文为准。


之前玩了下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()