
global gtarget
global gport
global ghash
global gwordlist
global guser
global gap
global ginterface
global ip
global iprange
global modules
global show
global time_now

# class SimpleCompleter(object):
#
#     def __init__(self, options):
#         self.options = sorted(options)
#         return
#
#     def complete(self, text, state):
#         response = None
#         if state == 0:
#             # This is the first time for this text, so build a match list.
#             if text:
#                 self.matches = [s
#                                 for s in self.options
#                                 if s and s.startswith(text)]
#                 logging.debug('%s matches: %s', repr(text), self.matches)
#             else:
#                 self.matches = self.options[:]
#                 logging.debug('(empty input) matches: %s', self.matches)
#
#         # Return the state'th item from the match list,
#         # if we have that many.
#         try:
#             response = self.matches[state]
#         except IndexError:
#             response = None
#         logging.debug('complete(%s, %s) => %s',
#                       repr(text), state, repr(response))
#         return response
def completer(text, state):
    try:
        matches = completions[text]
    except KeyError:
        matches = [value for value in command_list
                   if text.upper() in value.upper()]
        completions[text] = matches
    try:
        return matches[state]
    except IndexError:
        return None
