Exemplo n.º 1
0
    def login(self, email, pwd):
        key = self.getEncryptKey()

        if self.getShowCaptcha(email) == 1:
            fn = 'icode.%s.jpg' % os.getpid()
            self.getICode(fn)
            print "Please input the code in file '%s':" % fn
            icode = raw_input().strip()
            os.remove(fn)
        else:
            icode = ''

        data = {
            'email': email,
            'origURL': 'http://www.renren.com/home',
            'icode': icode,
            'domain': 'renren.com',
            'key_id': 1,
            'captcha_type': 'web_login',
            'password': encryptString(key['e'], key['n'], pwd) if key['isEncrypt'] else pwd,
            'rkey': key['rkey']
        }
        print "login data: %s" % data

        url = 'http://www.renren.com/ajaxLogin/login?1=1&uniqueTimestamp=%f' % random.random()
        r = self.post(url, data)
        result = r.json()
        if result['code']:
            print 'login successfully'
            self.email = email
            r = self.get(result['homeUrl'])
            self.getToken(r.text)
        else:
            print 'login error', r.text
Exemplo n.º 2
0
 def login(self, email, pwd):
     key = self.getEncryptKey()
     data = {
         'email':
         email,
         'origURL':
         'http://www.renren.com/home',
         'icode':
         '',
         'domain':
         'renren.com',
         'key_id':
         1,
         'captcha_type':
         'web_login',
         'password':
         encryptString(key['e'], key['n'], pwd)
         if key['isEncrypt'] else pwd,
         'rkey':
         key['rkey']
     }
     url = 'http://www.renren.com/ajaxLogin/login?1=1&uniqueTimestamp=%f' % random.random(
     )
     r = self.post(url, data)
     result = r.json()
     if result['code']:
         print 'login successfully'
         self.email = email
         r = self.get(result['homeUrl'])
         self.getToken(r.text)
     else:
         print 'login error', r.text
Exemplo n.º 3
0
    def login(self, email, pwd, icode):
        key = self.getEncryptKey()

        data = {
            'email': email,
            'origURL': 'http://www.renren.com/home',
            'icode': icode,
            'domain': 'renren.com',
            'key_id': 1,
            'captcha_type': 'web_login',
            'password': encryptString(key['e'], key['n'], pwd) if key['isEncrypt'] else pwd,
            'rkey': key['rkey']
        }
        print "login data: %s" % data
        url = 'http://www.renren.com/ajaxLogin/login?1=1&uniqueTimestamp=%f' % random.random()
        r = self.post(url, data)
        
        data = {
                'func':'login',
                'result':r.text}
        dbManager.putRequestLog(data)
        
        
        result = r.json()
        if result['code']:
            print 'login successfully'
            self.email = email
            r = self.get(result['homeUrl'])
            self.getToken(r.text)
            return True, True
        else:
            print 'login error', r.text
            return False, r.text
Exemplo n.º 4
0
    def login(self, email, pwd):
        key = self.getEncryptKey()

        if self.getShowCaptcha(email) == 1:
            fn = "icode.%s.jpg" % os.getpid()
            self.getICode(fn)
            print "Please input the code in file '%s':" % fn
            icode = raw_input().strip()
            os.remove(fn)
        else:
            icode = ""

        data = {
            "email": email,
            "origURL": "http://www.renren.com/home",
            "icode": icode,
            "domain": "renren.com",
            "key_id": 1,
            "captcha_type": "web_login",
            "password": encryptString(key["e"], key["n"], pwd) if key["isEncrypt"] else pwd,
            "rkey": key["rkey"],
        }
        print "login data: %s" % data
        url = "http://www.renren.com/ajaxLogin/login?1=1&uniqueTimestamp=%f" % random.random()
        r = self.post(url, data)
        result = r.json()
        if result["code"]:
            print "login successfully"
            self.email = email
            r = self.get(result["homeUrl"])
            self.getToken(r.text)
        else:
            print "login error", r.text
Exemplo n.º 5
0
	def encryptPassword(self, passwd, key):
		debug('Encryption: ' + ('enabled' if key['isEncrypted'] else 'disabled'))
		if not key['isEncrypted']:
			return passwd
		encrypted = encryptString(key['e'], key['n'], passwd)
		info('Encrypted password: ' + encrypted)
		return encrypted
Exemplo n.º 6
0
    def login(self, email, pwd):
        key = self.getEncryptKey()

        if self.getShowCaptcha(email) == 1:
            fn = 'icode.%s.jpg' % os.getpid()
            self.getICode(fn)
            print "Please input the code in file '%s':" % fn
            icode = raw_input().strip()
            os.remove(fn)
        else:
            icode = ''

        data = {
            'email': email,
            'origURL': 'http://www.renren.com/home',
            'icode': icode,
            'domain': 'renren.com',
            'key_id': 1,
            'captcha_type': 'web_login',
            'password': encryptString(key['e'], key['n'], pwd) if key['isEncrypt'] else pwd,
            'rkey': key['rkey']
        }
        print "login data: %s" % data
        url = 'http://www.renren.com/ajaxLogin/login?1=1&uniqueTimestamp=%f' % random.random()
        r = self.post(url, data)
        result = r.json()
        if result['code']:
            print 'login successfully'
            self.email = email
            r = self.get(result['homeUrl'])
            self.getToken(r.text)
        else:
            print 'login error', r.text
Exemplo n.º 7
0
 def get_passwd(self, raw_passwd):
     # TODO: 这是一个密码加密的地方,貌似是MD5
     r = requests.get("http://login.renren.com/ajax/getEncryptKey").text
     rr = json.loads(r)
     self.rkey = rr["rkey"]
     n = rr["n"]
     e = "10001"
     return encryptString(e, n, raw_passwd)
Exemplo n.º 8
0
 def login(self, email, pwd):
     key = self.getEncryptKey()
     data = {
         'email': email,
         'origURL': 'http://www.renren.com/home',
         'icode': '',
         'domain': 'renren.com',
         'key_id': 1,
         'captcha_type': 'web_login',
         'password': encryptString(key['e'], key['n'], pwd) if key['isEncrypt'] else pwd,
         'rkey': key['rkey']
     }
     url = 'http://www.renren.com/ajaxLogin/login?1=1&uniqueTimestamp=%f' % random.random()
     r = self.post(url, data)
     result = r.json()
     if result['code']:
         print 'login successfully'
         self.email = email
         r = self.get(result['homeUrl'])
         self.getToken(r.text)
     else:
         print 'login error', r.text
Exemplo n.º 9
0
 def login(self, email, pwd):
     key = self.getEncryptKey()
     data = {
         "email": email,
         "origURL": "http://www.renren.com/home",
         "icode": "",
         "domain": "renren.com",
         "key_id": 1,
         "captcha_type": "web_login",
         "password": encryptString(key["e"], key["n"], pwd) if key["isEncrypt"] else pwd,
         "rkey": key["rkey"],
     }
     url = "http://www.renren.com/ajaxLogin/login?1=1&uniqueTimestamp=%f" % random.random()
     r = self.post(url, data)
     result = r.json()
     if result["code"]:
         print "login successfully"
         self.email = email
         r = self.get(result["homeUrl"])
         self.getToken(r.text)
     else:
         print "login error", r.text