Exemple #1
0
def get_tea_pass(q, p, v):
    # MD5 密码
    md5 = hashlib.md5()
    md5.update(p)
    p = md5.digest()

    # TEA 的KEY
    md5 = hashlib.md5()
    md5.update(p + ("%0.16X" % q).decode('hex'))
    m = md5.digest()

    # RSA的加密结果
    n = rsa.encrypt(p, key)

    # RSA 结果的长度
    d = ("%0.4X" % len(n)).decode('hex')

    # RSA 加密结果
    d += n

    # salt
    d += ("%0.16X" % q).decode('hex')

    # 验证码长度
    d += ("%0.4X" % len(v)).decode('hex')

    # 验证码
    d += v.upper()

    # TEA 加密并Base64编码
    r = base64.b64encode(Tea.encrypt(d, m))

    # 对特殊字符进行替换
    return r.replace('/', '-').replace('+', '*').replace('=', '_')
Exemple #2
0
def getTEAPass(q, p, v):
  #MD5 密码
  p = md5.new(p).digest()

  #TEA 的KEY
  m = md5.new(p + ("%0.16X" % q).decode('hex')).digest()

  #RSA的加密结果
  n = rsa.encrypt(p, key)

  #RSA 结果的长度
  d = ("%0.4X" % len(n)).decode('hex')

  #RSA 加密结果
  d += n

  #salt
  d += ("%0.16X" % q).decode('hex')

  #验证码长度
  d += ("%0.4X" % len(v)).decode('hex')

  #验证码
  d += v.upper()

  #TEA 加密并Base64编码
  r = base64.b64encode(Tea.encrypt(d, m))

  #对特殊字符进行替换
  return r.replace('/', '-').replace('+', '*').replace('=', '_')
Exemple #3
0
def getUrl(url,myHttpRequest):
    skey = ''
    for ck in myHttpRequest.cj:
            if ck.name=='skey':
                skey = ck.value
    base_url = url
    base_url = base_url.replace('GTK', str(Tea.getGTK(skey)))
    return base_url
Exemple #4
0
def getUrl(url, myHttpRequest):
    skey = ''
    for ck in myHttpRequest.cj:
        if ck.name == 'skey':
            skey = ck.value
    base_url = url
    base_url = base_url.replace('GTK', str(Tea.getGTK(skey)))
    return base_url
Exemple #5
0
def getUrl(url,myHttpRequest,account = None):
    skey = ''
    for ck in myHttpRequest.cj:
            if ck.name=='skey':
                skey = ck.value
    base_url = url
    base_url = base_url.replace('GTK', str(Tea.getGTK(skey)))
    if account is not None:
        base_url = base_url.replace('QQ',account)
    return base_url
Exemple #6
0
def getMagicInfo(myhttpRequest, account):
    skey = ''
    for ck in myhttpRequest.cj:
        if ck.name == 'skey':
            skey = ck.value
    postData = {'code': '', 'uin': account}
    base_url = constant.CARDLOGINURL
    base_url = base_url.replace('GTK', str(Tea.getGTK(skey)))
    page_content = myhttpRequest.get_response(base_url,
                                              postData).read().decode('utf-8')
    return page_content
Exemple #7
0
def getMagicInfo2(myhttpRequest,account):
    skey = ''
    for ck in myhttpRequest.cj:
            if ck.name=='skey':
                skey = ck.value
    postData = {
           'uin':constant.USERNAME,
           'opuin':account,
    }
    base_url = constant.CARDLOGINURL
    base_url = base_url.replace('GTK', str(Tea.getGTK(skey)))
    page_content = myhttpRequest.get_response(base_url,postData).read().decode('utf-8')
    return   page_content
Exemple #8
0
<input type="hidden" name="gId" value="{}">
<input type="hidden" name="gName" value="{}">
<input type="hidden" name="gMail" value="{}">
<input type="hidden" name="gImage" value="{}">
<input type="hidden" name="oper">
</form>
'''.format(gid, name, gMail, gImg))
if gid == '':
	gUtils.googleSignIn()
else:
	users = Users.Users()
	authTea = users.authenticate(gid, name, gMail, gImg, users.TEA)
	authAdm = users.authenticate(gid, name, gMail, gImg, users.ADMIN)
	print(authTea[1])
	if authTea[0] == '1':
		tea = Tea.Tea()
		if oper != '':
			if authAdm[0] == '1':
				pid = form.getvalue('id', '')
				first = form.getvalue('first', '')
				last = form.getvalue('last', '')
				src = form.getvalue('src', '')
				ggl = form.getvalue('ggl', '')
				teaString = ''
				for t in sorted(tea.dates, reverse=True):
					if form.getvalue('c{}'.format(t), '') == 'on':
						teaString += '1'
					else:
						teaString += '0'
				if oper == 'add':
					tea.people[pid] = {}