Python cmd.Cmd.__init__() Examples
The following are 30
code examples of cmd.Cmd.__init__().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
cmd.Cmd
, or try the search function
.
Example #1
Source File: interactive.py From PyDev.Debugger with Eclipse Public License 1.0 | 6 votes |
def __init__(self): """ Interactive console debugger. @see: L{Debug.interactive} """ Cmd.__init__(self) EventHandler.__init__(self) # Quit the debugger when True. self.debuggerExit = False # Full path to the history file. self.history_file_full_path = None # Last executed command. self.__lastcmd = "" #------------------------------------------------------------------------------ # Debugger # Use this Debug object.
Example #2
Source File: interactive.py From OpenXMolar with BSD 3-Clause "New" or "Revised" License | 6 votes |
def __init__(self): """ Interactive console debugger. @see: L{Debug.interactive} """ Cmd.__init__(self) EventHandler.__init__(self) # Quit the debugger when True. self.debuggerExit = False # Full path to the history file. self.history_file_full_path = None # Last executed command. self.__lastcmd = "" #------------------------------------------------------------------------------ # Debugger # Use this Debug object.
Example #3
Source File: tick.py From thetick with GNU Lesser General Public License v3.0 | 6 votes |
def __init__(self, sock): # Socket connected to a remote shell. self.sock = sock # Flag we'll use to tell the background thread to stop. self.alive = True # Call the parent class constructor. super(RemoteShell, self).__init__() # Set the thread as a daemon so way when the # main thread dies, this thread will die too. self.daemon = True # This method is invoked in a background thread. # It forwards everything coming from the remote shell to standard output.
Example #4
Source File: tick.py From thetick with GNU Lesser General Public License v3.0 | 6 votes |
def __init__(self, src_sock, dst_sock): # Keep the source and destination sockets. # This class only forwards in one direction, # so you have to instance it twice and swap # the source and destination sockets. self.src_sock = src_sock self.dst_sock = dst_sock # Flag we'll use to tell the background thread to stop. self.alive = False # Call the parent class constructor. super(TCPForward, self).__init__() # Set the thread as a daemon so way when the # main thread dies, this thread will die too. self.daemon = True # This method is invoked in a background thread. # It forwards everything from the source socket # into the destination socket. If either socket # dies the other is closed and the thread dies.
Example #5
Source File: SharPyShellPrompt.py From SharPyShell with GNU General Public License v3.0 | 6 votes |
def __init__(self, password, channel_enc_mode, default_shell, url, user_agent, cookies, custom_headers, insecure_ssl, proxy): reload(sys) sys.setdefaultencoding('utf8') signal.signal(signal.SIGTSTP, lambda s, f: self.do_quit()) Cmd.__init__(self) if channel_enc_mode == 'aes128': self.password = hashlib.md5(password).hexdigest() else: self.password = hashlib.sha256(password).hexdigest() self.channel_enc_mode = channel_enc_mode self.default_shell = default_shell request_object = Request(url, user_agent, cookies, custom_headers, insecure_ssl, proxy) self.env_obj = Environment(self.password, self.channel_enc_mode, request_object) env_dict = self.env_obj.make_env(random_generator()) if '{{{Offline}}}' in env_dict: self.do_quit([env_dict]) self.online = True self.modules_settings = env_dict self.load_modules(request_object)
Example #6
Source File: cli.py From ipmininet with GNU General Public License v2.0 | 6 votes |
def __init__(self, mininet, stdin=sys.stdin, script=None): """Start and run interactive or batch mode CLI mininet: Mininet network object stdin: standard input for CLI script: script to run in batch mode""" self.mn = mininet # Local variable bindings for py command self.locals = {'net': mininet} # Attempt to handle input self.stdin = stdin self.inPoller = poll() self.inPoller.register(stdin) self.inputFile = script Cmd.__init__(self, stdin=self.stdin) lg.info('*** Starting CLI:\n') if self.inputFile: self.do_source(self.inputFile) return self.initReadline() self.run()
Example #7
Source File: cli.py From nightmare with GNU General Public License v2.0 | 6 votes |
def __init__(self, memobj, config=None, symobj=None): self.extcmds = {} Cmd.__init__(self, stdout=self) self.shutdown = threading.Event() # If they didn't give us a resolver, make one. if symobj == None: symobj = e_resolv.SymbolResolver() if config == None: config = e_config.EnviConfig(defaults=cfgdefs) self.config = config self.memobj = memobj self.symobj = symobj self.canvas = e_canvas.MemoryCanvas(memobj, syms=symobj)
Example #8
Source File: Console.py From MultiProxies with GNU General Public License v3.0 | 6 votes |
def __init__(self, Module): MultiProxiesClient.__init__(self) self.Module, self.ModuleName, self.ModulePath = Module self.nextStatus = True try: self.moduleHandle = useModule(self.ModuleName) self.moduleHandle.load() self.moduleParams = self.moduleHandle.moduleParams self.moduleInfo = self.moduleHandle.moduleInfo self.moduleDoc = self.moduleHandle.moduleDoc updateFromClient(self.moduleParams, Client.globals['user']) self.prompt = 'MultiProxies> ' + self.Module + ")" self.nextStatus = True except ImportError, errmsg: self.nextStatus = False color.echo("[!] %s : %s" % (self.ModulePath, errmsg), RED, verbose=True) color.echo('[!] maybe you need to install the packages above.', RED, verbose=True) self.prompt = 'MultiProxies> ' + self.Module + " [error] )"
Example #9
Source File: interactive.py From filmkodi with Apache License 2.0 | 6 votes |
def __init__(self): """ Interactive console debugger. @see: L{Debug.interactive} """ Cmd.__init__(self) EventHandler.__init__(self) # Quit the debugger when True. self.debuggerExit = False # Full path to the history file. self.history_file_full_path = None # Last executed command. self.__lastcmd = "" #------------------------------------------------------------------------------ # Debugger # Use this Debug object.
Example #10
Source File: cli.py From games-puzzles-algorithms with MIT License | 6 votes |
def __init__(self, puzzle, solver, heuristic=None): """ Initialize the interface. puzzle, solver, and heuristic are all strings giving the names of a puzzle in PUZZLES, a search algorithm in SOLVERS, and a valid heuristic for puzzle. """ Cmd.__init__(self) self.time_limit = 30 self.verbose = True self.size1 = 3 self.size2 = 3 if solver == "A*" and heuristic is None: heuristic = "manhattan distance" self.heuristic = heuristic if puzzle in self.PUZZLES: self.puzzle_name = self.PUZZLES[puzzle] self.puzzle = self.puzzle_name(size1=self.size1, size2=self.size2) if solver in self.SOLVERS: self.solver_name = self.SOLVERS[solver] self.new_solver() self.solver.set_verbose(self.verbose)
Example #11
Source File: backend.py From chiasm-shell with MIT License | 5 votes |
def __init__(self): """ Create a new Backend instance. """ Cmd.__init__(self) self._init_backend() self.launch_module = None
Example #12
Source File: afc.py From pymobiledevice with GNU General Public License v3.0 | 5 votes |
def __init__(self, lockdown=None, udid=None, logger=None): super(AFCCrashLog, self).__init__(lockdown, serviceName="com.apple.crashreportcopymobile", udid=udid)
Example #13
Source File: afc.py From pymobiledevice with GNU General Public License v3.0 | 5 votes |
def __init__(self, lockdown=None,udid=None, logger=None): super(AFC2Client, self).__init__(lockdown, serviceName="com.apple.afc2",udid=udid)
Example #14
Source File: shapeshifterproxytest.py From FibbingNode with GNU General Public License v2.0 | 5 votes |
def __init__(self, client, *args, **kwargs): Cmd.__init__(self, *args, **kwargs) self.client = client
Example #15
Source File: afc.py From pymobiledevice with GNU General Public License v3.0 | 5 votes |
def __init__(self, afcname='com.apple.afc', completekey='tab', stdin=None, stdout=None, client=None, udid=None, logger=None): Cmd.__init__(self, completekey=completekey, stdin=stdin, stdout=stdout) self.logger = logger or logging.getLogger(__name__) self.lockdown = LockdownClient() self.afc = client if client else AFCClient(self.lockdown, serviceName=afcname, udid=udid) self.curdir = '/' self.prompt = 'AFC$ ' + self.curdir + ' ' self.complete_cat = self._complete self.complete_ls = self._complete
Example #16
Source File: afc.py From pymobiledevice with GNU General Public License v3.0 | 5 votes |
def __init__(self, lockdown=None, serviceName="com.apple.afc", service=None, udid=None, logger=None): self.logger = logger or logging.getLogger(__name__) self.serviceName = serviceName self.lockdown = lockdown if lockdown else LockdownClient(udid=udid) self.service = service if service else self.lockdown.startService(self.serviceName) self.packet_num = 0
Example #17
Source File: tick.py From thetick with GNU Lesser General Public License v3.0 | 5 votes |
def __init__(self, listener, uuid, bind_addr = "127.0.0.1", port = 1080, username = "", password = ""): # The listener that requested to proxy through a bot. self.listener = listener # The UUID of the bot we'll use to route proxy requests. self.uuid = uuid # The address to bind to when listening for SOCKS requests. # Normally 0.0.0.0 for a shared proxy, 127.0.0.1 for private. self.bind_addr = bind_addr # The port to listen to for incoming SOCKS proxy requests. self.port = port # Optional username and password for the SOCKS proxy. self.username = username self.password = password if (username or password) and not (username and password): raise ValueError("Must specify both username and password or neither") # Flag we'll use to tell the background thread to stop. self.alive = False # Listening socket for incoming SOCKS proxy requests. # Will be created and destroyed inside the run() method. self.listen_sock = None # This is where we'll keep all the TCP forwarders. self.bouncers = [] # Call the parent class constructor. super(SOCKSProxy, self).__init__() # Set the thread as a daemon so way when the # main thread dies, this thread will die too. self.daemon = True # This method is invoked in a background thread.
Example #18
Source File: ctu.py From CageTheUnicorn with ISC License | 5 votes |
def __init__(self, ctu): self.ctu = ctu self.jar = {}
Example #19
Source File: tick.py From thetick with GNU Lesser General Public License v3.0 | 5 votes |
def __init__(self, sock, uuid, from_addr): # True if we can send commands to this instance, False otherwise. # False could either mean the bot is dead or the socket is being # used for something else, since some commands reuse the C&C socket. self.alive = True # The C&C socket to talk to this bot. self.sock = sock # The UUID for this bot instance. # See Listener.run() for more details. self.uuid = uuid # IP address and remote port where the connection came from. # # The IP address may not be correct if the bot is behind a NAT. # You can run the file_exec command to figure out the real IP. # Use your imagination. ;) # # The port is not terribly useful right now, but when we add # support for having the bot listen on a port rather than # connect to us, this may come in handy. self.from_addr = from_addr # Useful for debugging.
Example #20
Source File: tick.py From thetick with GNU Lesser General Public License v3.0 | 5 votes |
def __init__(self, callback, bind_addr = "0.0.0.0", port = 5555): # True when running, False when shutting down. self.alive = False # Callback to be invoked every time a new bot connects. # The callback will receive two arguments, the listener # itself and the bot that just connected. self.callback = callback # Bind address and port. self.bind_addr = bind_addr self.port = port # Listening socket. self.listen_sock = None # Ordered dictionary with the bots that connected. # It will become apparent why we're using an ordered dict # instead of a regular dict once you read the source code # to the Console class. self.bots = OrderedDict() # Call the parent class constructor. super(Listener, self).__init__() # Set the thread as a daemon so way when the # main thread dies, this thread will die too. self.daemon = True # Context manager to ensure all the sockets are closed on exit. # The bind and listen code is here to make sure its use is mandatory.
Example #21
Source File: Console.py From BiliBiliHelper with GNU General Public License v3.0 | 5 votes |
def __init__(self, loop): self.loop = loop Cmd.__init__(self)
Example #22
Source File: threatshell.py From threatshell with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, args): Cmd.__init__(self) self.args = args self.threat_q = ThreatQ(config) self.geo_tools = GeoTools(config) self.infoblox = Infoblox(config) self.passive_total = PassiveTotal(config) self.riq = RiskIQ(config) self.novetta = Novetta(config) self.config_manager = ConfigManager(config) self.ss = ShadowServer() self.cymru = Cymru() self.opendns = OpenDNS_API(config) self.umbrella = Umbrella(config) self.tx = ThreatExchange(config) self.module_map = {} for entry in dir(self): entry = getattr(self, entry) if hasattr(entry, "__module__"): if "commands" in entry.__module__: self.module_map[entry.__module__] = entry try: readline.read_history_file(self.history_file) except IOError: pass readline.set_history_length(300) # TODO: Maybe put this in a config
Example #23
Source File: consoles.py From vulscan with MIT License | 5 votes |
def __init__(self): if IS_WIN: coloramainit() BaseInterpreter.__init__(self) conf.report = False conf.retry = 0 conf.delay = 0 conf.quiet = False conf.isPocString = False conf.isPycFile = False conf.requires = False conf.requiresFreeze = False conf.url = None conf.proxy = None conf.params = None conf.urlFile = None conf.agent = None conf.referer = None conf.cookie = None conf.proxy = None conf.randomAgent = False conf.threads = 1 conf.timeout = 5 conf.httpHeaders = HTTP_DEFAULT_HEADER self.prompt = "Pocsuite> " banner() self.case_insensitive = False self.showcommands = [_ for _ in dir(self) if _.startswith('show_')] self.current_pocid = 1
Example #24
Source File: consoles.py From vulscan with MIT License | 5 votes |
def is_a_poc(self, filename): """Is a valid pocsuite poc""" if not filename: return False fname_lower = filename.lower() if fname_lower in ("__init__.py"): return False if fname_lower.endswith('.py') or fname_lower.endswith('.json'): return True else: return False
Example #25
Source File: Console.py From MultiProxies with GNU General Public License v3.0 | 5 votes |
def __init__(self): Cmd.__init__(self)
Example #26
Source File: Console.py From MultiProxies with GNU General Public License v3.0 | 5 votes |
def __init__(self): BasicConsole.__init__(self)
Example #27
Source File: cli.py From nightmare with GNU General Public License v2.0 | 5 votes |
def __init__(self, cli, func): self.cli = cli self.func = func self.__doc__ = func.__doc__
Example #28
Source File: CmdInterpreter.py From Jarvis with MIT License | 5 votes |
def __init__(self, jarvis): self._jarvis = jarvis self.spinner_running = False
Example #29
Source File: main.py From FibbingNode with GNU General Public License v2.0 | 5 votes |
def __init__(self, mngr, *args, **kwargs): self.fibbing = mngr Cmd.__init__(self, *args, **kwargs)
Example #30
Source File: interact.py From legion with MIT License | 5 votes |
def __init__(self, parser, proto, host, workdir, port, intensity, username, ulist, plist, notuse, extensions, path, password, ipv6, domain, verbose): Cmd.__init__(self) self.all_values = {"proto": proto, "host": host, "workdir": workdir, "port": port, "intensity": intensity, "username": username, "ulist": ulist, "plist": plist, "notuse": notuse, "extensions": extensions, "path": path, "password": password, "ipv6": ipv6, "domain": domain, "verbose": verbose, "reexec": False} self.priv_values = {"interactive": True, "protohelp": False, "executed": [], "exec": ""} self.parser = parser self.ws = [] self.general = "" self.msgs = {}