def post(self, *args, **kwargs): uuid = self.get_argument('uuid', '') payload = Payload.by_uuid(uuid) user = self.get_current_user() if payload is not None and payload in user.history: dbsession.delete(payload) dbsession.flush() self.redirect('/history')
def get(self, *args, **kwargs): user = self.get_current_user() uuid = self.get_argument('uuid', None) if uuid is not None: payload = Payload.by_uuid(uuid) if payload is not None and payload in user.history: self.render('history/view_payload.html', payload=payload) else: self.render('history/view_table.html', payloads=user.chronological_history)
def get(self, *args, **kwargs): user = self.get_current_user() uuid = self.get_argument('uuid', None) if uuid is not None: payload = Payload.by_uuid(uuid) if payload is not None and payload in user.history: self.render('history/view_payload.html', payload=payload) else: self.render('history/view_table.html', payloads=user.chronological_history )
def download_rc(self): user = self.get_current_user() uuid = self.get_argument('uuid', '') payload = Payload.by_uuid(uuid) if payload is not None and payload in user.history: data = payload.get_rc_file() self.set_header('Content-Type', 'text/plain') self.set_header('Content-Length', len(data)) self.set_header('Content-Disposition', 'attachment; filename=%s' % payload.rc_file_name.replace('\n', '') # Shouldn't be any ) self.write(data) self.finish() else: self.render('public/404.html')
def download_exe(self): user = self.get_current_user() uuid = self.get_argument('uuid', '') payload = Payload.by_uuid(uuid) if payload is not None and payload in user.history: f = open(payload.file_path, 'r') data = f.read() self.set_header('Content-Type', 'application/x-msdos-program') self.set_header('Content-Length', len(data)) self.set_header('Content-Disposition', 'attachment; filename=%s' % payload.file_name.replace('\n', '') # Shouldn't be any ) self.write(data) f.close() self.finish() else: self.render('public/404.html')
def download_rc(self): user = self.get_current_user() uuid = self.get_argument('uuid', '') payload = Payload.by_uuid(uuid) if payload is not None and payload in user.history: data = payload.get_rc_file() self.set_header('Content-Type', 'text/plain') self.set_header('Content-Length', len(data)) self.set_header( 'Content-Disposition', 'attachment; filename=%s' % payload.rc_file_name.replace('\n', '') # Shouldn't be any ) self.write(data) self.finish() else: self.render('public/404.html')
def download_exe(self): user = self.get_current_user() uuid = self.get_argument('uuid', '') payload = Payload.by_uuid(uuid) if payload is not None and payload in user.history: f = open(payload.file_path, 'r') data = f.read() self.set_header('Content-Type', 'application/x-msdos-program') self.set_header('Content-Length', len(data)) self.set_header( 'Content-Disposition', 'attachment; filename=%s' % payload.file_name.replace('\n', '') # Shouldn't be any ) self.write(data) f.close() self.finish() else: self.render('public/404.html')