本文整理汇总了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] )"
示例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)
示例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.
示例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()
示例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)
示例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.
示例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)
示例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"
示例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
示例10: __init__
# 需要导入模块: from cmd import Cmd [as 别名]
# 或者: from cmd.Cmd import __init__ [as 别名]
def __init__(self, jarvis):
self._jarvis = jarvis
self.spinner_running = False
示例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
示例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 = {}
示例13: __init__
# 需要导入模块: from cmd import Cmd [as 别名]
# 或者: from cmd.Cmd import __init__ [as 别名]
def __init__(self, debugger):
Cmd.__init__(self)
self.debugger = debugger
示例14: __init__
# 需要导入模块: from cmd import Cmd [as 别名]
# 或者: from cmd.Cmd import __init__ [as 别名]
def __init__(self):
Cmd.__init__(self)
示例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