def get(self, session_id): result = g.messenger.send_recieve('sniffdelete', 'sniffer-commands', {'session_id': session_id}) print "Result", result if result == "notfound": # session not found return { 'status': 'Sniffer session %s does not exist' % session_id, 'success': 0 } if result == "running": # session running return { 'status': "Can't delete session %s: session running" % session_id, 'success': 0 } if result == "removed": # session successfully stopped current_user.remove_sniffer_session(session_id) UserManager.save_user(current_user) return { 'status': "Sniffer session %s has been deleted" % session_id, 'success': 1 }
def sniffer_session_delete(session_id, session_info=None): session_id = session_info['id'] result = g.messenger.send_recieve('sniffdelete', 'sniffer-commands', {'session_id': session_id}) if result == "notfound": # session not found return (dumps({ 'status': 'Sniffer session %s does not exist' % session_id, 'success': 0 }), 200, { 'Content-Type': 'application/json' }) if result == "running": # session running return (dumps({ 'status': "Can't delete session %s: session running" % session_id, 'success': 0 }), 200, { 'Content-Type': 'application/json' }) if result == "removed": # session successfully stopped current_user.remove_sniffer_session(session_id) UserManager.save_user(current_user) return (dumps({ 'status': "Sniffer session %s has been deleted" % session_id, 'success': 1 }), 200, { 'Content-Type': 'application/json' })
def get(self, session_id): result = g.messenger.send_recieve('sniffdelete', 'sniffer-commands', {'session_id': session_id}) if result == "notfound": # session not found return {'status': 'Sniffer session %s does not exist' % session_id, 'success': 0} if result == "running": # session running return {'status': "Can't delete session %s: session running" % session_id, 'success': 0} if result == "removed": # session successfully stopped current_user.remove_sniffer_session(session_id) g.UserManager.save_user(current_user) return {'status': "Sniffer session %s has been deleted" % session_id, 'success': 1}
def sniffer_session_delete(session_id, session_info=None): session_id = session_info['id'] result = g.messenger.send_recieve('sniffdelete', 'sniffer-commands', {'session_id': session_id}) if result == "notfound": # session not found return (dumps({'status':'Sniffer session %s does not exist' % session_id, 'success': 0}), 200, {'Content-Type': 'application/json'}) if result == "running": # session running return (dumps({'status':"Can't delete session %s: session running" % session_id, 'success': 0}), 200, {'Content-Type': 'application/json'}) if result == "removed": # session successfully stopped current_user.remove_sniffer_session(session_id) UserManager.save_user(current_user) return (dumps({'status':"Sniffer session %s has been deleted" % session_id, 'success': 1}), 200, {'Content-Type': 'application/json'})