當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。