本文整理匯總了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)
示例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()
示例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
示例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'''
示例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
示例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))
示例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))
示例8: __init__
# 需要導入模塊: from cmd2 import Cmd [as 別名]
# 或者: from cmd2.Cmd import __init__ [as 別名]
def __init__(self):
Cmd.__init__(self)
### TOOLBOX ###
示例9: __init__
# 需要導入模塊: from cmd2 import Cmd [as 別名]
# 或者: from cmd2.Cmd import __init__ [as 別名]
def __init__(self):
Cmd.__init__(self, use_ipython=True)
示例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
#
示例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') + ') '
示例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') + ') '
示例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') + ') '
示例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') + ') '
示例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)