當前位置: 首頁>>代碼示例>>Python>>正文


Python Cmd.__init__方法代碼示例

本文整理匯總了Python中cmd.Cmd.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python Cmd.__init__方法的具體用法?Python Cmd.__init__怎麽用?Python Cmd.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cmd.Cmd的用法示例。


在下文中一共展示了Cmd.__init__方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from cmd import Cmd [as 別名]
# 或者: from cmd.Cmd import __init__ [as 別名]
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] )" 
開發者ID:x0day,項目名稱:MultiProxies,代碼行數:22,代碼來源:Console.py

示例2: __init__

# 需要導入模塊: from cmd import Cmd [as 別名]
# 或者: from cmd.Cmd import __init__ [as 別名]
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) 
開發者ID:joxeankoret,項目名稱:nightmare,代碼行數:21,代碼來源:cli.py

示例3: __init__

# 需要導入模塊: from cmd import Cmd [as 別名]
# 或者: from cmd.Cmd import __init__ [as 別名]
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. 
開發者ID:fabioz,項目名稱:PyDev.Debugger,代碼行數:24,代碼來源:interactive.py

示例4: __init__

# 需要導入模塊: from cmd import Cmd [as 別名]
# 或者: from cmd.Cmd import __init__ [as 別名]
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() 
開發者ID:cnp3,項目名稱:ipmininet,代碼行數:24,代碼來源:cli.py

示例5: __init__

# 需要導入模塊: from cmd import Cmd [as 別名]
# 或者: from cmd.Cmd import __init__ [as 別名]
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) 
開發者ID:antonioCoco,項目名稱:SharPyShell,代碼行數:22,代碼來源:SharPyShellPrompt.py

示例6: __init__

# 需要導入模塊: from cmd import Cmd [as 別名]
# 或者: from cmd.Cmd import __init__ [as 別名]
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. 
開發者ID:nccgroup,項目名稱:thetick,代碼行數:19,代碼來源:tick.py

示例7: __init__

# 需要導入模塊: from cmd import Cmd [as 別名]
# 或者: from cmd.Cmd import __init__ [as 別名]
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) 
開發者ID:ryanbhayward,項目名稱:games-puzzles-algorithms,代碼行數:26,代碼來源:cli.py

示例8: __init__

# 需要導入模塊: from cmd import Cmd [as 別名]
# 或者: from cmd.Cmd import __init__ [as 別名]
def __init__(self):
        Cmd.__init__(self)
        self.do_help.__func__.__doc__ = "Show help menu" 
開發者ID:vulscanteam,項目名稱:vulscan,代碼行數:5,代碼來源:consoles.py

示例9: is_a_poc

# 需要導入模塊: from cmd import Cmd [as 別名]
# 或者: from cmd.Cmd import __init__ [as 別名]
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 
開發者ID:vulscanteam,項目名稱:vulscan,代碼行數:15,代碼來源:consoles.py

示例10: __init__

# 需要導入模塊: from cmd import Cmd [as 別名]
# 或者: from cmd.Cmd import __init__ [as 別名]
def __init__(self, jarvis):
        self._jarvis = jarvis
        self.spinner_running = False 
開發者ID:sukeesh,項目名稱:Jarvis,代碼行數:5,代碼來源:CmdInterpreter.py

示例11: __init__

# 需要導入模塊: from cmd import Cmd [as 別名]
# 或者: from cmd.Cmd import __init__ [as 別名]
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 
開發者ID:salesforce,項目名稱:threatshell,代碼行數:33,代碼來源:threatshell.py

示例12: __init__

# 需要導入模塊: from cmd import Cmd [as 別名]
# 或者: from cmd.Cmd import __init__ [as 別名]
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 = {} 
開發者ID:carlospolop,項目名稱:legion,代碼行數:15,代碼來源:interact.py

示例13: __init__

# 需要導入模塊: from cmd import Cmd [as 別名]
# 或者: from cmd.Cmd import __init__ [as 別名]
def __init__(self, debugger):
        Cmd.__init__(self)
        self.debugger = debugger 
開發者ID:NoviceLive,項目名稱:bintut,代碼行數:5,代碼來源:repl.py

示例14: __init__

# 需要導入模塊: from cmd import Cmd [as 別名]
# 或者: from cmd.Cmd import __init__ [as 別名]
def __init__(self):
        Cmd.__init__(self) 
開發者ID:fdiskyou,項目名稱:kcshell,代碼行數:4,代碼來源:kcshell.py

示例15: __init__

# 需要導入模塊: from cmd import Cmd [as 別名]
# 或者: from cmd.Cmd import __init__ [as 別名]
def __init__(self, client, *args, **kwargs):
        Cmd.__init__(self, *args, **kwargs)
        self.client = client 
開發者ID:Fibbing,項目名稱:FibbingNode,代碼行數:5,代碼來源:sjmptest.py


注:本文中的cmd.Cmd.__init__方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。