当前位置: 首页>>代码示例>>Python>>正文


Python Cmd.__init__方法代码示例

本文整理汇总了Python中cmd2.Cmd.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Cmd.__init__方法的具体用法?Python Cmd.__init__怎么用?Python Cmd.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cmd2.Cmd的用法示例。


在下文中一共展示了Cmd.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
def __init__(self):
        """The class initializer"""

        Cmd.__init__(self, startup_script=config.STARTUP_SCRIPT)

        self.aliases.update({'exit': 'quit'})
        self.hidden_commands.extend(['load', 'pyscript', 'set', 'shortcuts', 'alias', 'unalias', 'py'])

        self.current_victim = None
        self.mqtt_client = None
        self.current_scan = None

        self.t = Terminal()

        self.base_prompt = get_prompt(self)
        self.prompt = self.base_prompt

        categorize((
            BaseMixin.do_edit,
            BaseMixin.do_help,
            BaseMixin.do_history,
            BaseMixin.do_quit,
            BaseMixin.do_shell,
        ), BaseMixin.CMD_CAT_GENERAL) 
开发者ID:akamai-threat-research,项目名称:mqtt-pwn,代码行数:26,代码来源:__init__.py

示例2: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
def __init__(self):
        self.about = AboutProject()
        self.url_req = URLRequest()

        Cmd.doc_header = "Core Commands"
        Cmd.prompt = "{}belati{} > ".format(UNDERLINE, ENDC)
        Cmd.path_complete

        Cmd.__init__(self)

        self.list_parameter = ['domain', 'username', 'email', 'orgcomp', 'proxy', 'proxy_file']
        self.parameters = {}
        self.multiple_proxy_list = []
        self.current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')

        self.show_banner()
        self.conf = Config()
        self.db = Database() 
开发者ID:aancw,项目名称:Belati,代码行数:20,代码来源:Belati.py

示例3: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
def __init__(self, ROOT_DIR):
        Lobotomy.__init__(self)
        self.ROOT_DIR = ROOT_DIR
        self.t = Terminal()
        self.logger = Logger()
        self.util = Util()
        self.apk = None
        self.package = None
        self.vm = None
        self.vmx = None
        self.gmx = None
        self.components = None
        self.dex = None
        self.strings = None
        self.permissions = None
        self.permissions_details = None
        self.files = None
        self.attack_surface = None 
开发者ID:xtiankisutsa,项目名称:MARA_Framework,代码行数:20,代码来源:commands.py

示例4: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
def __init__(self):
  Cmd.__init__(self)

  self.colors = {
   'red': '\033[31m',
   'blue': '\033[34m',
   'white': '\033[0m',
   'green': '\033[32m',
   'yellow': '\033[33m'
   }

  self.debug = True
  self.ruler = '-'
  self.default_to_shell = True
  self.doc_header = '\n{0}Possible Commands {2}({2}type {1}help <{2}command{1}>{2})'.\
  format(self.colors['blue'], self.colors['yellow'], self.colors['white'])
  self.intro = '\n\ttype {}help{} for help\n'.\
  format(self.colors['yellow'], self.colors['white'])

  Popen('clear'.split()).wait()
  if not os.path.exists('/tmp/msg'):
   with open('/tmp/msg','w') as f:pass
   print '\n[-] Enter help for help\n[-] Enter help [CMD_NAME] for more detail''' 
开发者ID:Pure-L0G1C,项目名称:FleX,代码行数:25,代码来源:console.py

示例5: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
def __init__(self, voltha_grpc, voltha_sim_rest, etcd, global_request=False):
        VolthaCli.voltha_grpc = voltha_grpc
        VolthaCli.voltha_sim_rest = voltha_sim_rest
        VolthaCli.global_request = global_request
        VolthaCli.etcd = etcd
        Cmd.__init__(self)
        self.prompt = '(' + self.colorize(
            self.colorize(self.prompt, 'blue'), 'bold') + ') '
        self.channel = None
        self.stub = None
        self.device_ids_cache = None
        self.device_ids_cache_ts = time()
        self.logical_device_ids_cache = None
        self.logical_device_ids_cache_ts = time()

    # we override cmd2's method to avoid its optparse conflicting with our
    # command line parsing 
开发者ID:opencord,项目名称:voltha,代码行数:19,代码来源:main.py

示例6: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
def __init__(self, message):
        self.logger = Logger()
        self.message = message
        self.logger.log("critical", "Command : {}".format(self.message)) 
开发者ID:xtiankisutsa,项目名称:MARA_Framework,代码行数:6,代码来源:binja.py

示例7: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
def __init__(self, message):
        self.logger = Logger()
        self.message = message
        self.logger.log("critical", "Surgical : {}".format(self.message)) 
开发者ID:xtiankisutsa,项目名称:MARA_Framework,代码行数:6,代码来源:surgical.py

示例8: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
def __init__(self):
		Cmd.__init__(self)
		
	### TOOLBOX ### 
开发者ID:Orange-Cyberdefense,项目名称:fenrir-ocd,代码行数:6,代码来源:Interface.py

示例9: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
def __init__(self):
        Cmd.__init__(self, use_ipython=True) 
开发者ID:momalab,项目名称:ICSREF,代码行数:4,代码来源:icsref.py

示例10: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
def __init__(self):

        Lobotomy.__init__(self)

    # APK related commands
    # --------------------
    # loader, decompile, debuggable,
    # profiler, permissions, components
    # 
开发者ID:AndroidSecurityTools,项目名称:lobotomy,代码行数:11,代码来源:cmd.py

示例11: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
def __init__(self, get_stub):
        Cmd.__init__(self)
        self.get_stub = get_stub
        self.prompt = '(' + self.colorize(
            self.colorize('alarm_filters', 'red'), 'bold') + ') ' 
开发者ID:opencord,项目名称:voltha,代码行数:7,代码来源:alarm_filters.py

示例12: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
def __init__(self, logical_device_id, get_stub):
        Cmd.__init__(self)
        self.get_stub = get_stub
        self.logical_device_id = logical_device_id
        self.prompt = '(' + self.colorize(
            self.colorize('logical device {}'.format(logical_device_id), 'red'),
            'bold') + ') ' 
开发者ID:opencord,项目名称:voltha,代码行数:9,代码来源:logical_device.py

示例13: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
def __init__(self, device_id, get_stub):
        Cmd.__init__(self)
        self.get_stub = get_stub
        self.device_id = device_id
        self.prompt = '(' + self.colorize(
            self.colorize('omci {}'.format(device_id), 'green'),
            'bold') + ') ' 
开发者ID:opencord,项目名称:voltha,代码行数:9,代码来源:omci.py

示例14: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
def __init__(self, get_channel, device_id):
        Cmd.__init__(self)
        self.get_channel = get_channel
        self.device_id = device_id
        self.prompt = '(' + self.colorize(
            self.colorize('voltha-xpon {}'.format(device_id), 'green'),
            'bold') + ') ' 
开发者ID:opencord,项目名称:voltha,代码行数:9,代码来源:xpon.py

示例15: __init__

# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import __init__ [as 别名]
def __init__(self):
        try:
            Cmd.__init__(self)
            self.allow_cli_args = False
            self.register_cmdfinalization_hook(self.finalize_hook)
            builtins.print = self.shell_print
            self.histfile = ".unpacker_history"
            self.clear_queue = False
            self.sample = None
            self.disassembler = Cs(CS_ARCH_X86, CS_MODE_32)
            self.disassembler.detail = True
            parser = argparse.ArgumentParser(
                prog='unipacker',
                description='Automatic and platform-independent unpacker for Windows binaries based on emulation')
            parser.add_argument('samples', metavar='sample', type=file_or_dir, nargs='*',
                                help='The path to a sample (or directory containing samples) you want unpacked')
            parser.add_argument('-d', '--dest', nargs='?', default='.',
                                help='The destination directory for unpacked binaries')
            parser.add_argument('-p', '--partition-by-packer', action='store_true',
                                help='Group the unpacked files by packer')
            parser.add_argument('-i', '--interactive', action='store_true',
                                help='Open the chosen sample(s) in the un{i}packer shell')
            parser.add_argument('--version', action='store_true', help='Show version information and exit')

            args = parser.parse_args()
            if args.version:
                print_version_and_exit()
            if args.samples:
                samples = []
                for s in args.samples:
                    if os.path.exists(s):
                        samples.extend(Sample.get_samples(s, interactive=args.interactive))
                    else:
                        print(f"Path does not exist: {s}")
                if args.interactive:
                    while True:
                        self.sample_loop(samples)
                        self.shell_event.wait()
                        samples = None
                else:
                    IOHandler(samples, args.dest, args.partition_by_packer)
            else:
                while True:
                    self.sample_loop()
                    self.shell_event.wait()

        except (EOFError, KeyboardInterrupt):
            with open(f"{os.path.dirname(unipacker.__file__)}/fortunes") as f:
                fortunes = f.read().splitlines()
            print(f"\n{Fore.LIGHTRED_EX}{choice(fortunes)}{Fore.RESET}\n")
            sys.exit(0) 
开发者ID:unipacker,项目名称:unipacker,代码行数:53,代码来源:shell.py


注:本文中的cmd2.Cmd.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。