Exemple #1
0
def menu():
    """Driver for the session management menu
    """
    while True:
        stream.dump_sessions()
        choice = util.print_menu(session_menu)

        if choice == 0:
            break
        elif choice == 1:
            (module, number) = stream.get_session_input()
            if not module is None:
                stream.stop_session(module, number)
        elif choice == 2:
            (module, number) = stream.get_session_input()
            if not module is None:
                stream.view_session(module, number)
        elif choice == 3:
            try:
                display = color.B_YELLOW + '[' + color.B_GREEN + '!' + color.B_YELLOW + \
                          '] Enter file to log to' + color.B_WHITE + ' > ' + color.END
                file_path = raw_input(display)
                if file_path is None:
                    return
                if util.does_file_exist(file_path) or path.islink(file_path):
                    util.Error('File already exists.')
                    return
                (module, number) = stream.get_session_input()
                if not module is None:
                    display = color.B_YELLOW + '[' + color.B_GREEN + '!' + color.B_YELLOW + \
                              '] Log output from %s session %s to %s. Is this correct? '  + \
                              color.B_GREEN + '[' + color.B_YELLOW + 'Y' + color.B_GREEN + \
                              '/' + color.B_YELLOW + 'n' + color.B_GREEN + '] ' + \
                              color.B_WHITE + '> ' + color.END
                    tmp = raw_input(display % (module, number, file_path))
                    if 'n' in tmp.lower():
                        return
                    stream.toggle_log(module, number, file_path, True)
            except KeyboardInterrupt:
                return
            except Exception:
                util.Error('Error logging to given file')
                return
        elif choice == 4:
            (module, number) = stream.get_session_input()
            if not module is None:
                stream.toggle_log(module, number)
        elif choice == -1:
            pass
        else:
            system('clear')
Exemple #2
0
def menu():
    """Driver for the session management menu
    """
    while True:
        stream.dump_sessions()
        choice = util.print_menu(session_menu)

        if choice == 0:
            break
        elif choice == 1:
            (module, number) = stream.get_session_input()
            if not module is None:
                stream.stop_session(module, number)
        elif choice == 2:
            (module, number) = stream.get_session_input()
            if not module is None:
                stream.view_session(module, number)
        elif choice == 3:
            try:
                display = color.B_YELLOW + '[' + color.B_GREEN + '!' + color.B_YELLOW + \
                          '] Enter file to log to' + color.B_WHITE + ' > ' + color.END
                file_path = raw_input(display)
                if file_path is None:
                    return
                if util.does_file_exist(file_path) or path.islink(file_path):
                    util.Error('File already exists.')
                    return
                (module, number) = stream.get_session_input()
                if not module is None:
                    display = color.B_YELLOW + '[' + color.B_GREEN + '!' + color.B_YELLOW + \
                              '] Log output from %s session %s to %s. Is this correct? '  + \
                              color.B_GREEN + '[' + color.B_YELLOW + 'Y' + color.B_GREEN + \
                              '/' + color.B_YELLOW + 'n' + color.B_GREEN + '] ' + \
                              color.B_WHITE + '> ' + color.END
                    tmp = raw_input(display % (module, number, file_path))
                    if 'n' in tmp.lower():
                        return
                    stream.toggle_log(module, number, file_path, True)
            except KeyboardInterrupt:
                return
            except Exception:
                util.Error('Error logging to given file')
                return
        elif choice == 4:
            (module, number) = stream.get_session_input()
            if not module is None:
                stream.toggle_log(module, number)
        elif choice == -1:
            pass
        else:
            system('clear')
Exemple #3
0
def menu():
	while True:
		stream.dump_sessions()
		choice = util.print_menu(session_menu)

		if choice == 0:
			break
		elif choice == 1:
			module, number = get_session_input()
			if not module is None:
				stream.stop_session(string.lower(module), int(number))
			else:
				return
		elif choice == 2:
		  	module, number = get_session_input()
		  	if not module is None:
				stream.view_session(string.lower(module), int(number))
			else:
				return
		elif choice == 3:
			print '[!] Enter file to log to: '
			file_path = raw_input('> ')
			if file_path is None:
				return
			if util.does_file_exist(file_path):
				util.Error('File already exists.')
				return
			util.Msg('Module must be a sniffer or valid logging module.')
			module = None
			(module, number) = get_session_input()
			try:
				if not module is None:
					tmp = raw_input('[!] Log output from %s session %s to %s.  Is this correct? '%
																	(module,number,file_path))
				else:
					return
			except Exception, j:
				util.Error('Error logging to given file')
				return
			if tmp == 'n':
				return
			stream.start_log_session(module, int(number), file_path)
		elif choice == 4:
			(module, number) = get_session_input()
			if not module is None:
				stream.stop_log_session(module, int(number))
Exemple #4
0
def menu():
    """Driver for the session management menu
    """
    while True:
        stream.dump_sessions()
        choice = util.print_menu(session_menu)

        if choice == 0:
            break
        elif choice == 1:
            (module, number) = stream.get_session_input()
            if not module is None:
                stream.stop_session(module, number)
        elif choice == 2:
            (module, number) = stream.get_session_input()
            if not module is None:
                stream.view_session(module, number)
        elif choice == 3:
            print '[!] Enter file to log to: '
            file_path = raw_input('> ')
            if file_path is None:
                return
            if util.does_file_exist(file_path) or path.islink(file_path):
                util.Error('File already exists.')
                return
            util.Msg('Module must be a sniffer or valid logging module.')
            (module, number) = stream.get_session_input()
            try:
                if not module is None:
                    tmp = raw_input('[!] Log output from %s session %s to %s.'
                        'Is this correct? [Y/n]' % (module, number, file_path))
                    if 'n' in tmp.lower():
                        return
                    stream.toggle_log(module, number, file_path, True)
            except Exception:
                util.Error('Error logging to given file')
                return
        elif choice == 4:
            (module, number) = stream.get_session_input()
            if not module is None:
                stream.toggle_log(module, number)
        elif choice == -1:
            pass
        else:
            system('clear')