def get(self): if not self.get_arguments('jatkt'): uaBaseURL="http://jaccount.sjtu.edu.cn/jaccount/" returl = 'http://'+domain+':'+str(port)+'/jalogin' iv = string.join(random.sample('1234567890abcdef',8),'') self.set_secure_cookie('iv' , iv , None) redirectURL = uaBaseURL + "jalogin?sid="+siteID+"&returl="+encrypt(returl,iv)+"&se="+encrypt(iv,iv) self.redirect(redirectURL) else: try: if len(self.get_argument('jatkt')) == 0: raise tornado.web.HTTPError(404) except TypeError: raise tornado.web.HTTPError(404) iv = self.get_secure_cookie('iv') jatkt = self.get_argument('jatkt') data = decrypt(jatkt,iv) data = find(data,ur'ja[\s\S]*') ProfileData = splitdata(data) if ProfileData['ja3rdpartySessionID'] != iv: self.add_header('error',1) return self.update_user(ProfileData) self.set_secure_cookie('uid' , ProfileData['id'] , None) chiname = urllib.quote(ProfileData['chinesename']) # logging.info(chiname.__class__) self.set_cookie('chiname' , chiname , None) # logging.info(self.cookies) self.add_header('error',0)
def get(self): if not self.get_arguments('jatkt'): uaBaseURL="http://jaccount.sjtu.edu.cn/jaccount/" returl = 'http://'+domain+':'+str(port)+'/admin/jalogin' iv = string.join(random.sample('1234567890abcdef',8),'') # print "iv:" , iv self.set_secure_cookie('iv' , iv , None) redirectURL = uaBaseURL + "jalogin?sid="+siteID+"&returl="+encrypt(returl,iv)+"&se="+encrypt(iv,iv) self.redirect(redirectURL) else: try: if len(self.get_argument('jatkt')) == 0: raise tornado.web.HTTPError(404) except TypeError: raise tornado.web.HTTPError(404) iv = self.get_secure_cookie('iv') jatkt = self.get_argument('jatkt') data = decrypt(jatkt,iv) data = find(data,ur'ja[\s\S]*') # utf-8编码 data.decode('utf-8') ProfileData = parse_data(data) if self.checkUser(ProfileData): self.set_secure_cookie('uid' , ProfileData['id'] , None) self.set_secure_cookie('chiname', ProfileData['chinesename'],None) self.set_cookie('login','0') if ProfileData['ja3rdpartySessionID'] != iv: self.write('Hacking Attempt~!') return else: self.set_cookie('login','1') self.redirect('/admin')