def onConnect(self, request): myAES = AESCipher(key) if 'cookie' in request.headers: try: cookie = Cookie.SimpleCookie() cookie.load(str(request.headers['cookie'])) except Cookie.CookieError: pass if ('gtoken' in cookie) and ('wsid' in cookie): gtoken = cookie['gtoken'].value wsid = cookie['wsid'].value user_data = json.loads(myAES.decrypt(wsid)) mycams = CamCheck().cbquery(user_data['user_id']) if mycams == user_data['cams']: return None else: self.sendClose() elif ('wsid' in cookie) and ('PSClient' in request.headers['user-agent']): wsid = cookie['wsid'].value cambot = json.loads(myAES.decrypt(wsid)) if cambot['id'] in request.path: return None else: self.sendClose() else: self.sendClose() else: self.sendClose()
def onConnect(self,request): myAES = AESCipher(key) if 'cookie' in request.headers: try: cookie = Cookie.SimpleCookie() cookie.load(str(request.headers['cookie'])) except Cookie.CookieError: pass if ('gtoken' in cookie) and ('wsid' in cookie): gtoken = cookie['gtoken'].value wsid = cookie['wsid'].value user_data = json.loads(myAES.decrypt(wsid)) mycams = CamCheck().cbquery(user_data['user_id']) if mycams == user_data['cams']: return None else: self.sendClose() elif ('wsid' in cookie) and ('PSClient' in request.headers['user-agent']): wsid = cookie['wsid'].value cambot = json.loads(myAES.decrypt(wsid)) if cambot['id'] in request.path: return None else: self.sendClose() else: self.sendClose() else: self.sendClose()
def makePage(self,request): myAES = AESCipher(key) gtoken = request.getCookie('gtoken') wsid = request.getCookie('wsid') try: vid = int(request.args['vid'][0]) except (KeyError,ValueError,IndexError): vid = None user_data = json.loads(myAES.decrypt(wsid)) gitkit_user = gitkit_instance.VerifyGitkitToken(gtoken) if gitkit_user and user_data['user_id']: userdetails = {'display_name': gitkit_user.name, 'photo_url':gitkit_user.photo_url} if gitkit_user.photo_url is None: userdetails['photo_url']='/images/home/slider/slide1/cloud1.png' mycams = CamCheck().cbquery(gitkit_user.user_id) if mycams == user_data['cams']: try: camid, camname = mycams[vid] except (TypeError,IndexError): camid, camname = mycams[0] wsurl = '/cam/view/'+camid live = PSjinja_env.get_template('live_MSE.html') request.write(live.render(user=userdetails,cam=camname,wsurl=wsurl).encode('utf-8')) return request else: self.errorPage(request) else: self.errorPage(request)
def onConnect(self, request): myAES = AESCipher(key) if 'cookie' in request.headers: try: cookie = Cookie.SimpleCookie() cookie.load(str(request.headers['cookie'])) except Cookie.CookieError: pass if ('wsid' in cookie) and ('PSClient' in request.headers['user-agent']): wsid = cookie['wsid'].value cambot = json.loads(myAES.decrypt(wsid)) if cambot['id'] in request.path: self.temp_location = self.factory.temp_path.child( cambot['id']) if not self.temp_location.exists(): self.temp_location.makedirs() f = self.temp_location.child(u'index.html') g = FilePath("/home/chetan/pscore/templates/live_hls.html" ).asTextMode() content = g.getContent() new = content.replace("++camid++", cambot['id']) f.setContent(new) return None else: self.sendClose(1000, "Not authorised") else: self.sendClose(1000, "Not authorised") else: self.sendClose(1000, "Not authorised")
def makePage(self,request): myAES = AESCipher(key) gtoken = request.getCookie('gtoken') wsid = request.getCookie('wsid') try: vid = int(request.args['vid'][0]) except (KeyError,ValueError,IndexError): vid = None user_data = json.loads(myAES.decrypt(wsid)) gitkit_user = gitkit_instance.VerifyGitkitToken(gtoken) if gitkit_user and user_data['user_id']: userdetails = {'display_name': gitkit_user.name, 'photo_url':gitkit_user.photo_url} if gitkit_user.photo_url is None: userdetails['photo_url']='/images/home/slider/slide1/cloud1.png' mycams = CamCheck().cbquery(gitkit_user.user_id) if mycams == user_data['cams']: try: camid, camname = mycams[vid] except (TypeError,IndexError): camid, camname = mycams[0] wsurl = '/cam/stream/'+camid live = PSjinja_env.get_template('live.html') request.write(live.render(user=userdetails,cam=camname,wsurl=wsurl).encode('utf-8')) return request else: self.errorPage(request) else: self.errorPage(request)
def onConnect(self,request): myAES = AESCipher(key) if 'cookie' in request.headers: try: cookie = Cookie.SimpleCookie() cookie.load(str(request.headers['cookie'])) except Cookie.CookieError: pass if ('wsid' in cookie) and ('PSClient' in request.headers['user-agent']): wsid = cookie['wsid'].value cambot = json.loads(myAES.decrypt(wsid)) if cambot['id'] in request.path: self.temp_location = self.factory.temp_path.child(cambot['id']) if not self.temp_location.exists(): self.temp_location.makedirs() f = self.temp_location.child(u'index.html') g = FilePath("/home/chetan/pscore/templates/live_hls.html").asTextMode() content = g.getContent() new = content.replace("++camid++",cambot['id']) f.setContent(new) return None else: self.sendClose(1000,"Not authorised") else: self.sendClose(1000,"Not authorised") else: self.sendClose(1000,"Not authorised")
def onConnect(self, request): myAES = AESCipher(key) if 'cookie' in request.headers: try: cookie = Cookie.SimpleCookie() cookie.load(str(request.headers['cookie'])) except Cookie.CookieError: pass if ('wsid' in cookie) and ('PSClient' in request.headers['user-agent']): wsid = cookie['wsid'].value cambot = json.loads(myAES.decrypt(wsid)) if cambot['id'] in request.path: self.temp_location = self.factory.temp_path.child( cambot['id']) if not self.temp_location.exists(): self.temp_location.makedirs() f = self.temp_location.child(u'index.html') g = FilePath("/home/chetan/pscore/templates/live_hls.html" ).asTextMode() content = g.getContent() new = content.replace("++camid++", cambot['id']) f.setContent(new) return None else: self.sendClose(1000, "Not authorised") elif ('wsid' in cookie) and ('gtoken' in cookie): wsid = cookie['wsid'].value gtoken = cookie['gtoken'].value user_data = json.loads(myAES.decrypt(wsid)) gitkit_user = gitkit_instance.VerifyGitkitToken(gtoken) mycams = CamCheck().cbquery(gitkit_user.user_id) camid = request.path.split("/")[3] self.temp_location = self.factory.temp_path.child(camid) if any(camid in x for x in mycams): return None else: self.sendClose(1000, "Not authorised") else: self.sendClose(1000, "Not authorised") else: self.sendClose(1000, "Not authorised")
def onConnect(self,request): myAES = AESCipher(key) if 'cookie' in request.headers: try: cookie = Cookie.SimpleCookie() cookie.load(str(request.headers['cookie'])) except Cookie.CookieError: pass if ('wsid' in cookie) and ('PSClient' in request.headers['user-agent']): wsid = cookie['wsid'].value cambot = json.loads(myAES.decrypt(wsid)) if cambot['id'] in request.path: self.temp_location = self.factory.temp_path.child(cambot['id']) if not self.temp_location.exists(): self.temp_location.makedirs() f = self.temp_location.child(u'index.html') g = FilePath("/home/chetan/pscore/templates/live_hls.html").asTextMode() content = g.getContent() new = content.replace("++camid++",cambot['id']) f.setContent(new) return None else: self.sendClose(1000,"Not authorised") elif ('wsid' in cookie) and ('gtoken' in cookie): wsid = cookie['wsid'].value gtoken = cookie['gtoken'].value user_data = json.loads(myAES.decrypt(wsid)) gitkit_user = gitkit_instance.VerifyGitkitToken(gtoken) mycams = CamCheck().cbquery(gitkit_user.user_id) camid = request.path.split("/")[3] self.temp_location = self.factory.temp_path.child(camid) if any(camid in x for x in mycams): return None else: self.sendClose(1000,"Not authorised") else: self.sendClose(1000,"Not authorised") else: self.sendClose(1000,"Not authorised")
def checkAuth(self, request): myAES = AESCipher(key) gtoken = request.getCookie('gtoken') wsid = request.getCookie('wsid') user_data = json.loads(myAES.decrypt(wsid)) gitkit_user = gitkit_instance.VerifyGitkitToken(gtoken) mycams = CamCheck().cbquery(gitkit_user.user_id) if mycams == user_data['cams']: print "1--> {0} authenticated".format(gitkit_user.user_id) return request else: return failure.Failure()
def checkAuth(self,request): myAES = AESCipher(key) gtoken = request.getCookie('gtoken') wsid = request.getCookie('wsid') user_data = json.loads(myAES.decrypt(wsid)) gitkit_user = gitkit_instance.VerifyGitkitToken(gtoken) mycams = CamCheck().cbquery(gitkit_user.user_id) if mycams == user_data['cams']: print "1--> {0} authenticated".format(gitkit_user.user_id) return request else: return failure.Failure()
def checkAuth(self, camid, request): myAES = AESCipher(key) gtoken = request.getCookie('gtoken') wsid = request.getCookie('wsid') try: user_data = json.loads(myAES.decrypt(wsid)) gitkit_user = gitkit_instance.VerifyGitkitToken(gtoken) mycams = CamCheck().cbquery(gitkit_user.user_id) if any(camid in x for x in mycams): self.webAuthenticated = True else: self.webAuthenticated = False except TypeError: self.webAuthenticated = False return self.webAuthenticated
def checkAuth(self,camid,request): myAES = AESCipher(key) gtoken = request.getCookie('gtoken') wsid = request.getCookie('wsid') try: user_data = json.loads(myAES.decrypt(wsid)) gitkit_user = gitkit_instance.VerifyGitkitToken(gtoken) mycams = CamCheck().cbquery(gitkit_user.user_id) if any(camid in x for x in mycams): self.webAuthenticated = True else: self.webAuthenticated = False except TypeError: self.webAuthenticated = False return self.webAuthenticated
def onConnect(self,request): myAES = AESCipher(key) if 'cookie' in request.headers: try: cookie = Cookie.SimpleCookie() cookie.load(str(request.headers['cookie'])) except Cookie.CookieError: pass if ('wsid' in cookie) and ('PSClient' in request.headers['user-agent']): wsid = cookie['wsid'].value cambot = json.loads(myAES.decrypt(wsid)) if cambot['id'] in request.path: return None else: self.sendClose() else: self.sendClose() else: self.sendClose()