def view_event(self, data): log_path = Utils.get_arg_at(data, 1, 2) if log_path == "": UI.error("Missing arguments") return log_path += ".log" rows = Utils.get_arg_at(data, 2, 2) if rows == "": rows = 10 else: try: rows = int(rows) except: rows = 10 log_path = Log.get_current_path(log_path) data = [] if Utils.file_exists(log_path): for line in open(log_path, "rb").readlines(): data.append(line) print("\nLast %d lines of log\n----------------------\n" % rows) data = list(data) for i in range(0, rows): try: print data[i] except: pass
def view_event(self, data): log_path = Utils.get_arg_at(data, 1, 2) if log_path == "": UI.error("Missing arguments") return log_path += ".log" rows = Utils.get_arg_at(data, 2, 2) if rows == "": rows = 10 else: try: rows = int(rows) except: rows = 10 log_path = Log.get_current_path(log_path) data = [] if Utils.file_exists(log_path): for line in open(log_path, "rb").readlines(): data.append(line) print "\nLast %d lines of log\n-----------------------\n" % rows data = list(reversed(data)) for i in range(0, rows): try: print data[i] except: pass
def get_shell_output(self): if self.auth(): guid = self.request.path.split("/")[3] guid = Utils.validate_guid(guid) path = Log.get_current_path("shell_%s.log" % guid) data = Utils.load_file(path, False, False) self.output["data"] = base64.b64encode(data) return self.output["data"]
def get_shell_output(self): if self.auth(): try: guid = self.request.path.split('/')[3] guid = Utils.validate_guid(guid) path = Log.get_current_path('shell_%s.log' % guid) data = Utils.load_file(path, False, False) self.output['data'] = base64.b64encode(data) except: return
def view_event(self, data): log_path = Utils.get_arg_at(data, 1, 2) if log_path == "": UI.error("Missing arguments") return if log_path == "key": UI.warn("Your encryption key is '%s'" % self.config.get("encryption-key")) return if log_path == "password": UI.warn("Your server password is '%s'" % self.config.get("server-password")) return if not log_path in ("http", "event", "error"): UI.error("Invalid path") return log_path += ".log" rows = Utils.get_arg_at(data, 2, 2) if rows == "": rows = 10 else: try: rows = int(rows) except: rows = 10 log_path = Log.get_current_path(log_path) data = [] if Utils.file_exists(log_path): for line in open(log_path, "rb").readlines(): data.append(line) data = list(reversed(data)) print("\nLast %d lines of log\n----------------------\n" % rows) data = list(data) for i in range(0, rows): try: print data[i] except: pass
def view_event(self, data): log_path = Utils.get_arg_at(data, 1, 2) if log_path == '': UI.error('Missing arguments') return if log_path == 'key': UI.warn("Your encryption key is '%s'" % self.config.get('encryption-key')) return if log_path == 'password': UI.warn("Your server password is '%s'" % self.config.get('server-password')) return if not log_path in ('http', 'event', 'error'): UI.error('Invalid path') return log_path += '.log' rows = Utils.get_arg_at(data, 2, 2) if rows == '': rows = 10 else: try: rows = int(rows) except: rows = 10 log_path = Log.get_current_path(log_path) data = [] if Utils.file_exists(log_path): for line in open(log_path, 'rb').readlines(): data.append(line) data = list(reversed(data)) print '''Last %d lines of log\n----------------------''' % rows data = list(data) for i in range(0, rows): try: print data[i] except: pass