示例#1
0
 def __init__(self, game):
     Cmd.__init__(self)
     self._transcript_files = None
     self.prompt = ">"
     self.game = game
     self.map = game.world.map
     self.player_loc = game.player_loc
示例#2
0
 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') + ') '
示例#3
0
 def __init__(self, url_root='http://localhost'):
     Cmd.__init__(self)
     self.allow_cli_args = False
     self._format_url_root(url_root)
     self.resource = ''
     self._set_prompt()
     self.response = None
示例#4
0
文件: analyse.py 项目: kin9-0rz/saam
    def __init__(self, file_path):
        Cmd.__init__(self)
        self.prompt = 'saam > '

        self.shortcuts.remove(('@', 'load'))
        self.shortcuts.append(('@', 'adb_cmd'))
        self.shortcuts.remove(('@@', '_relative_load'))
        self.shortcuts.append(('$', 'adb_shell_cmd'))
        self.shortcuts.append(('qc', 'quit_and_clean'))

        self.apk_path = file_path
        self.apk = APK(self.apk_path)
        self.apk_out = os.path.basename(file_path) + ".out"
        self.smali_files = None
        self.smali_dir = None
        self.adb = None
        self.smali_method_descs = []
        self.java_files = []

        vsmali_action = CmdLineApp.vsmali_parser.add_argument(
            'sfile', help='smali file path')
        setattr(vsmali_action, argparse_completer.ACTION_ARG_CHOICES,
                ('delimiter_complete', {
                    'delimiter': '/',
                    'match_against': self.smali_method_descs
                }))

        vjava_action = CmdLineApp.vjava_parser.add_argument(
            'jfile', help='java file path')
        setattr(vjava_action, argparse_completer.ACTION_ARG_CHOICES,
                ('delimiter_complete', {
                    'delimiter': '/',
                    'match_against': self.java_files
                }))
示例#5
0
    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)
示例#6
0
    def __init__(self):
        Cmd.__init__(self)

        # Disable CLI level arguments
        self.allow_cli_args = False

        # Enable debug - prints trace in case there is an issue
        self.debug = True

        # Remove the unused built-in commands from help
        self.exclude_from_help.append('do_edit')
        self.exclude_from_help.append('do_pyscript')
        self.exclude_from_help.append('do_load')
        self.exclude_from_help.append('do_py')
        self.exclude_from_help.append('do_shell')

        # Normal stuff
        self.gClient = None
        self.modelMap= { "wifi-mac": "wifi/mac/openconfig-wifi-mac.yang",
                         "wifi-phy": "wifi/phy/openconfig-wifi-phy.yang",
                         "wifi-system": "wifi/system/openconfig-system-wifi-ext.yang",
                         "vlan": "vlan/openconfig-vlan.yang",
                         "interfaces": "interfaces/openconfig-interfaces.yang",
                         "acl": "acl/openconfig-acl.yang",
                         }
示例#7
0
    def __init__(self, config, server, sandbox, quiet=False):
        persistent_history_file = config.get('Shell Parameters',
                                             'persistent_history_file')

        # Prevents running of commands by abbreviation
        self.abbrev = False
        self.debug = True
        self.help_path = os.path.join(os.path.dirname(__file__), "shell_help/")
        self.psiturk_header = 'psiTurk command help:'
        self.super_header = 'basic CMD command help:'

        self.config = config
        self.quiet = quiet
        self.server = server

        self.sandbox = sandbox
        self.sandbox_hits = 0
        self.live_hits = 0

        Cmd.__init__(self, persistent_history_file=persistent_history_file)

        if not self.amt_services_wrapper:
            sys.exit()

        self.maybe_update_hit_tally()

        if not self.quiet:
            self.prompt = self.color_prompt()
            self.intro = self.get_intro_prompt()
        else:
            self.intro = ''
示例#8
0
 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') + ') '
示例#9
0
    def __init__(self, *args, **kwargs):
        self.cutoff = None
        self.allow_cli_args = False

        self.titration = kwargs.get('titration')

        # environment attributes
        self.name = self.titration.name
        Cmd.__init__(self)
        self._set_prompt()

        # Exclude irrelevant cmds from help menu
        self.exclude_from_help += [
            'do__relative_load', 'do_cmdenvironment', 'do_edit', 'do_run'
        ]

        # Set path completion for save/load
        self.complete_save_job = self.path_complete
        self.complete_load_job = self.path_complete
        self.complete_add_step = self.path_complete
        self.complete_concentrations = self.path_complete
        self.complete_make_init = self.path_complete
        self.complete_init = self.path_complete
        self.complete_update = self.path_complete

        self.intro = "\n".join([
            "\n\n\tWelcome to Shift2Me !",
            "{summary}\n{intro}".format(summary=self.titration.summary,
                                        intro=self.intro)
        ])
示例#10
0
文件: dynash.py 项目: raff/dynash
    def __init__(self, verbose=False):
        Cmd.__init__(self)

        self.pp = pprint.PrettyPrinter(indent=4)

        try:
            self.conn = boto.connect_dynamodb()
        except Exception as e:
            self.conn = None
            print e
            print "Cannot connect to dynamodb - Check your credentials in ~/.boto or use the 'login' command"

        # by default readline thinks - and other characters are word delimiters :(
        if readline:
            readline.set_completer_delims(re.sub('[-~]', '', readline.get_completer_delims()))

            path = os.path.join(os.environ.get('HOME', ''), HISTORY_FILE)
            self.history_file = os.path.abspath(path)
        else:
            self.history_file = None

        self.tables = []
        self.table = None
        self.consistent = False
        self.consumed = False
        self.verbose = verbose
        self.next_key = None
        self.schema = {}

        if verbose:
            self._onchange_verbose(None, verbose)
示例#11
0
    def __init__(self, *args, **kwargs):
        Cmd.__init__(self, *args, **kwargs)
        self.core = Core()
        self.t = Terminal()

        self.last_result = None
        self.args = None
        self.noninteractive = None
        self.config = None

        self.logdir = '.'
        self.piddir = '.'

        self.daemon = None
        self.running = True
        self.run_thread = None
        self.stop_event = threading.Event()
        self.local_data = threading.local()

        self.crawl_thread = None
        self.publish_thread = None
        self.publish_fb_thread = None

        self.db_config = None
        self.engine = None
        self.session = None

        self.api = None
        self.auth = None
        self.graph = None
 def __init__(self):
     Cmd.__init__(self)
     mixins.bootstrap.BootstrapMixin.__init__(self)
     self._load_config()
     if 'url' in self.config and self.config['url']:
         self._init_stacks()
     self._validate_auth()
示例#13
0
    def __init__(self, persistent_history_file=history_file):

        # self.settable.update({'row': 'Number of crossbar rows'})
        # self.settable.update({'col': 'Number of crossbar columns'})
        # self.settable.update({'dev': '1S1R or VTEAM'})
        super().__init__()
        Cmd.__init__(self)
示例#14
0
	def __init__(self, namefile):
		Cmd.__init__(self)
		self.last = []
		self.last.append([])
		self.prompt = bcolors.PROMPT + "ForPCAP >>> " + bcolors.ENDC
		self.loadPcap(namefile)
		self.cmd = ""
示例#15
0
 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') + ') '
示例#16
0
 def __init__(self, workspace_path):
     Cmd.__init__(self)
     self.prompt = "> "
     self.intro = "Welcome to TEP solver console"
     self.tep_workspace = []  # type: TepSolverWorkspace
     self.open_workspace(workspace_path)
     self.timing = True
示例#17
0
文件: dupan.py 项目: zTrix/dupan
 def __init__(self):
     Cmd.__init__(self)
     try:
         import readline
         readline.set_completer_delims(' \t\n"') # initially it was ' \t\n`!@#$^&*()=+[{]}\\|;:\'",<>?', but I dont want to break on too many
     except:
         pass
示例#18
0
文件: dupan.py 项目: fqj1994/dupan
 def __init__(self):
     Cmd.__init__(self)
     try:
         import readline
         readline.set_completer_delims(' \t\n"') # initially it was ' \t\n`!@#$^&*()=+[{]}\\|;:\'",<>?', but I dont want to break on too many
     except:
         pass
示例#19
0
文件: cli.py 项目: ksunden/h5cli
 def __init__(self):
     Cmd.shortcuts.update({'!': 'bang', '$': 'shell'})
     Cmd.__init__(self)
     self.abbrev = True
     self.prompt = '[] > '
     self.explorer = None
     self.dir_stack = list()
示例#20
0
    def __init__(self,
                 attempts=5,
                 threads=1,
                 state=None,
                 state_file=None,
                 config_file=None,
                 audit_file=None,
                 max_mem=None,
                 *args,
                 **kwargs):

        Cmd.__init__(self, *args, **kwargs)
        self.t = Terminal()

        self.args = None
        self.attempts = int(attempts)
        self.total = None
        self.terminate = False

        self.last_users_count = None
        self.user_lock = Lock()
        self.processed_user_set = set()
        self.processed_user_set_lock = Lock()
        self.orgs_loaded_set = set()
        self.orgs_loaded_lock = Lock()

        self.max_mem = max_mem
        self.state = state
        self.state_file_path = state_file
        self.rate_limit_reset = None
        self.rate_limit_remaining = None

        self.config = None
        self.config_file = config_file

        self.audit_file = audit_file
        self.audit_records_buffered = []
        self.audit_lock = Lock()

        self.stop_event = threading.Event()
        self.threads = int(threads)
        self.link_queue = Queue.PriorityQueue()  # Store links to download here
        self.worker_threads = []

        self.state_thread = None
        self.state_thread_lock = Lock()

        self.resources_list = []
        self.resources_queue = Queue.PriorityQueue()
        self.local_data = threading.local()

        self.new_users_events = EvtDequeue()
        self.new_keys_events = EvtDequeue()

        self.db_config = None
        self.engine = None
        self.session = None

        self.mem_tracker = None
示例#21
0
 def __init__(self, user, pswd, enable_pswd):
     Cmd.__init__(self)
     self.controller = DBController()
     self.runner = TestRunner(self.controller)
     self.user = user
     self.pswd = pswd
     self.enable_pswd = enable_pswd if enable_pswd else pswd
     self.current_results = {}
示例#22
0
 def __init__(self, session_obj):
     Cmd.__init__(self)
     self.my_session = session_obj
     self.supported_namespaces = ['poortego', 'cmd2']
     self.namespace = 'poortego'
     self.no_namespace_commands = ['help', 'welcome', 'namespace', 'exit']
     self.get_names_addendum = [] # list of additional class methods not returned from python dir() at runtime
     self.prompt = self.my_session.my_conf.conf_settings['poortego_prompt'] + ' '
示例#23
0
 def __init__(self):
     Cmd.__init__(self)
     logging.basicConfig(filename='/tmp/darkdashboard.log', level=logging.INFO,\
                     format='%(asctime)s:%(name)s:%(levelname)s:%(message)s')
     self.logger = logging.getLogger("darkdashboard")
     self.prompt = 'dark> '
     self.rdb = redis_connection()
     print(self.bold(self.colorize('Welcome to DarkServer Dashboard', 'blue')))
示例#24
0
 def __init__(self, *args, **kwargs):
     self.user = kwargs.pop("user")
     self.username = kwargs.pop("username")
     self.passwd = kwargs.pop("passwd")
     self.api_auth = HTTPBasicAuth(self.username, self.passwd)
     self.site = Site.objects.get_current()
     self.prompt = "Schemanizer(%s)> " % (self.username)
     Cmd.__init__(self, *args, **kwargs)
示例#25
0
 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('device {}'.format(device_id), 'red'), 'bold') + ') '
     self.pm_config_last = None
     self.pm_config_dirty = False
示例#26
0
 def __init__(self, app: ShowtimeApp, dry_run=False) -> None:
     """Inits Showtime"""
     config = app.config_get()
     Cmd.__init__(
         self, persistent_history_file=config.get('History', 'Path'))
     self.app = app
     self.dry_run = dry_run
     self.output = Output(self.poutput, self.perror, self.pfeedback, self.ppaged)
     self.prompt = self._get_prompt('')
示例#27
0
    def __init__(self):
        Cmd.__init__(self)
        self.cli_parser = argparse.ArgumentParser()

        subparsers = self.cli_parser.add_subparsers(help='internal commands')

        publish_parser = subparsers.add_parser('publish', help='publish')
        publish_parser.add_argument('--to', dest="to", metavar='PATH', type=str,
                                    help='acoustic model directory', required=True)
示例#28
0
文件: jack.py 项目: gjcoombes/jack
 def __init__(self, parent):
     Cmd.__init__(self)
     self.parent = parent
     self.prompt = self.parent.prompt[:-2] + "find:: "
     self.machines = []
     self.project = ""
     self.locdata_dirs = []
     self.project_dirs = []
     self.record = self.parent.record
示例#29
0
    def __init__(self):
        # Enable the optional ipy command if IPython is installed by setting use_ipython=True
        Cmd.__init__(self, use_ipython=True)
        self._set_prompt()
        self.autorun_on_edit = False
        self.intro = 'Happy 𝛑 Day.  Note the full Unicode support:  😇  (Python 3 only)  💩'

        # For option commands, pass a list of argument strings instead of a single argument string to the do_* methods
        set_use_arg_list(True)
示例#30
0
 def __init__(self, **kwargs):
     Cmd.__init__(self, **kwargs)
     self.prompt = 'BES> '
     #self.do_conf(None)
     
     self.BES_ROOT_SERVER = None
     self.BES_USER_NAME = None
     self.BES_PASSWORD = None
     self.bes_conn = None
示例#31
0
    def __init__(self):
        package = kolala.actions
        for loader, name, is_pkg in pkgutil.walk_packages(package.__path__):
            module = loader.find_module(name).load_module(name)
            if getattr(module, 'main', None) is not None:
                setattr(self, 'do_' + name, module.main)
            if getattr(module, 'help', None) is not None:
                setattr(self, 'help_' + name, module.help)

        Cmd.__init__(self)
示例#32
0
 def __init__(self, session_obj):
     Cmd.__init__(self)
     self.my_session = session_obj
     self.supported_namespaces = ['poortego', 'cmd2']
     self.namespace = 'poortego'
     self.no_namespace_commands = ['help', 'welcome', 'namespace', 'exit']
     self.get_names_addendum = [
     ]  # list of additional class methods not returned from python dir() at runtime
     self.prompt = self.my_session.my_conf.conf_settings[
         'poortego_prompt'] + ' '
示例#33
0
 def __init__(self):
     Cmd.__init__(self)
     logging.basicConfig(filename='/tmp/darkdashboard.log', level=logging.INFO,\
                     format='%(asctime)s:%(name)s:%(levelname)s:%(message)s')
     self.logger = logging.getLogger("darkdashboard")
     self.prompt = 'dark> '
     self.rdb = redis_connection()
     print(
         self.bold(self.colorize('Welcome to DarkServer Dashboard',
                                 'blue')))
示例#34
0
 def __init__(self, log=None, ygg_browser=None, **kwargs):
     Cmd.__init__(self, **kwargs)
     self.log = log or yggscr.ylogging.init_default_logger()
     self.intro = "Welcome to Ygg Shell. Type help or ? to list commands.\n"
     self.prompt = "> "
     self.allow_redirection = False
     if ygg_browser is not None:
         self.ygg_browser = ygg_browser
     else:
         self.ygg_browser = yggscr.ygg.YggBrowser(self.log)
示例#35
0
 def __init__(self, files, apk):
     Binja.__init__(self)
     self.t = Terminal()
     self.logger = Logger()
     self.files = files
     self.apk = apk
     self.libs = list()
     self.rpc = None
     self.target_library = None
     self._init_binja()
示例#36
0
    def __init__(self, data_store, spec):
        Cmd.__init__(self)
        self.data_store = data_store
        self.spec = spec

        self.print_header()
        self.similar_specs = data_store.find_similar(spec)
        print
        print self.colorize("Similar specs", 'green')
        self.do_print('similar_specs')
示例#37
0
    def __init__(self):
        Cmd.__init__(self)

        self.bin_loaded = False
        self.bin_running = False

        self.arm_dbg = None

        if DEBUG_MODE:
            import ipdb; ipdb.set_trace()
示例#38
0
    def __init__(self):
        self.multilineCommands = ['orate']
        self.maxrepeats = 3

        # Add stuff to settable and shortcuts before calling base class initializer
        self.settable['maxrepeats'] = 'max repetitions for speak command'
        self.shortcuts.update({'&': 'speak'})

        # Set use_ipython to True to enable the "ipy" command which embeds and interactive IPython shell
        Cmd.__init__(self, use_ipython=False)
示例#39
0
 def __init__(self, voltha_grpc, voltha_sim_rest):
     VolthaCli.voltha_grpc = voltha_grpc
     VolthaCli.voltha_sim_rest = voltha_sim_rest
     Cmd.__init__(self)
     self.prompt = '(' + self.colorize(self.colorize(self.prompt, 'blue'),
                                       'bold') + ') '
     self.channel = 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()
示例#40
0
    def __init__(self,host,port,*args,**kwargs):
        """
        @brief  Instantiate new KatcpCli instance

        @params client A DeviceClient instance
        """
        self.host = host
        self.port = port
        self.katcp_parser = katcp.MessageParser()
        self.start_client()
        Cmd.__init__(self, *args, **kwargs)
示例#41
0
    def __init__(self, port, debug):
        Cmd.__init__(self)

        if readline:
            path = os.path.join(os.environ.get('HOME', ''), HISTORY_FILE)
            self.history_file = os.path.abspath(path)
        else:
            self.history_file = None

        self.debug = debug
        self.port = port
        self.init_search()
示例#42
0
    def __init__(self, silent, user, passwd):

        self.base_cmds = ['exec', 'help', 'history','manual', 'quit', 'use', 'contexts', 'script']
        base_cmd2 = ['li', 'load', 'pause', 'py', 'run', 'save', 'shortcuts', 'set', 'show', 'historysession']
        self.base_cmds += base_cmd2

        self._locals = {}
        self._globals = {}

        self.user = user
        self.passwd = ""
        
        self.passwdtype = "ldappass"
        userCred = FGCredential(self.passwdtype,passwd)
        if not self.check_simpleauth(userCred):
            sys.exit()


        #Load Config
        self._conf = fgShellConf()
        
        #Setup log  
        self._log = fgLog(self._conf.getLogFile(), self._conf.getLogLevel(), "FGShell", False)

        self._log.debug("\nReading Configuration file from " + self._conf.getConfigFile() + "\n")

        Cmd.__init__(self)        
        fgShellUtils.__init__(self)        

        #Context        
        self.env = ["repo", "hadoop", "image", "rain", ""]
        self.text = {'image': 'Image Management',
                     'repo':'Image Repository',
                     'rain':'FG Dynamic Provisioning',
                     'hadoop':'Apache Hadoop'}
        self._use = ""
        self._requirements = []
        self._contextOn = [] # initialized contexts

        #Help
        self._docHelp = []
        self._undocHelp = []
        self._specdocHelp = []
        self.getDocUndoc("")

        self.prompt = "fg> "
        self.silent = silent
        if self.silent:
            self.intro = ""
        else:
            self.intro = self.loadBanner()
        ##Load History
        self.loadhist("no argument needed")
示例#43
0
 def __init__(self, voltha_grpc, voltha_sim_rest, global_request=False):
     VolthaCli.voltha_grpc = voltha_grpc
     VolthaCli.voltha_sim_rest = voltha_sim_rest
     VolthaCli.global_request = global_request
     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()
示例#44
0
    def __init__(self):
        self.multilineCommands = ['orate']
        self.maxrepeats = 3

        # Add stuff to settable and shortcutgs before calling base class initializer
        self.settable['maxrepeats'] = 'max repetitions for speak command'
        self.shortcuts.update({'&': 'speak'})

        # Set use_ipython to True to enable the "ipy" command which embeds and interactive IPython shell
        Cmd.__init__(self, use_ipython=False)

        # For option commands, pass a single argument string instead of a list of argument strings to the do_* methods
        set_use_arg_list(False)
示例#45
0
文件: scatshell.py 项目: Frky/scat
    def __init__(self, config_path="config/config.yaml"):
        self.config_path = config_path
        conf = Confiture("config/templates/general.yaml")
        # Parse configuration file and get result
        self.config = conf.check_and_get(config_path)
        # Before we checked the config, it is considered KO
        self.config_ok = False
        # Set the log directory
        self.log_dir = self.config["log"]["path"]

        # Available pintools
        self.__pintools = dict()
        for pintool in self.config["pintool"]:
            # Check the needed two arguments
            req = ["src", "obj"]
            for r in req:
                if r not in self.config["pintool"][pintool].keys():
                    #TODO
                    raise Exception
            src = self.config["pintool"][pintool]["src"]
            obj = self.config["pintool"][pintool]["obj"]
            # Check potential extra argument
            if "prev_step" in self.config["pintool"][pintool].keys():
                prev_step = self.config["pintool"][pintool]["prev_step"]
            else:
                prev_step = None
            # Create pintool object
            pintool_obj = Pintool(
                                    name=pintool,
                                    src_path=src,
                                    obj_path=obj,
                                    pinconf=self.config["pin"],
                                    stdout=self.out,
                                    stderr=self.out,
                                    log_dir=self.log_dir,
                                    prev_step=prev_step,
                                )
            self.__pintools[pintool] = pintool_obj

        # Create a test object
        # Testing options
        kwargs = dict()
        kwargs["log"] = self.out
        if "test" in self.config.keys() and "proto" in self.config["test"]:
            kwargs["proto"] = self.config["test"]["proto"]
        self.test = ScatTest(**kwargs)

        # Init shell
        Cmd.__init__(self, completekey='tab')
示例#46
0
    def __init__(self, *args, **kwargs):        
        Cmd.__init__(self, *args, **kwargs)
        self.intro = '''\
        \n ----\n Welcome to the NXOS type shell for tac-pac. \
        \n ----\n'''

        self.file = '/tmp/nxos_shell'
        # build time lists
        self.all_module_cmds = [[] for i in xrange(20)]
        self.offset_tuple_list = [[] for i in xrange(20)]
        self.module_s_list = []
        self.module_e_list = []
        #run time locals
        self.local_mod = []
        self.s=[]
        self.cmd_dict = {}
        self.attach_mod_dict = {}
示例#47
0
 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
示例#48
0
文件: scatshell.py 项目: jamella/scat
    def __init__(self, config_path="config/config.yaml"):
        self.config_path = config_path
        conf = Confiture("config/templates/general.yaml")
        # Parse configuration file and get result
        self.config = conf.check_and_get(config_path)
        # Before we checked the config, it is considered KO
        self.config_ok = False
        # Set the log directory
        self.log_dir = self.config["log"]["path"]
        # Create a result object
        self.res = Result(self.log_dir)
        # Create a pin object with pin executable path
        # Get CLI options for pin
        if "cli-options" in self.config["pin"].keys():
            cli_options = self.config["pin"]["cli-options"]
        else:
            cli_options = ""
        # Get function identification method
        if "function-mode" in self.config.keys():
            fn_mode = self.config["function-mode"]
        else:
            # For now, default is identifying functions by name
            fn_mode = "name"
        # Get information from config file for all needed pintools
        kwargs = dict()
        for inf_code, inf_name in INF_ALL:
            if inf_code == INF_BASE:
                continue
            kwargs["{0}_src".format(inf_name)] = self.config["pin"]["pintool-src"][inf_name]
            kwargs["{0}_obj".format(inf_name)] = self.config["pin"]["pintool-obj"][inf_name]
        # Other Pin configuration options
        kwargs["pinpath"] = self.config["pin"]["path"]
        kwargs["options"] = cli_options
        kwargs["log"] = self.out
        kwargs["fn_mode"] = fn_mode
        kwargs["pinbin"] = self.config["pin"]["bin"]
        kwargs["respath"] = self.config["res"]["path"]

        # Init Pin
        self.__pin = Pin(**kwargs)

        # Init shell
        Cmd.__init__(self, completekey='tab')
示例#49
0
 def __init__(self):
     #super(App, self).__init__()
     Cmd.__init__(self) # old overlode! super not working.
     if 'arguments'in vars():
         self.mode=     arguments['--mode']
         self.boud=     int(arguments['--boud'])
         self.com=      arguments['--com']
         self.interval= int(arguments['--interval'])
         self.answer=   arguments['--answer']
         self.question= arguments['--question']
     else:
         self.mode=     "poll"
         self.boud=     9600
         self.com=      "/dev/ttyUSB0"
         self.interval= 1
         self.answer=   "\x02A,275,000.17,M,60,\x030E\r\n"
         self.question= "?A"
     self.sensor=None
     self.do_init()
示例#50
0
    def __init__(self, config, server, quiet=False):
        Cmd.__init__(self)
        self.config = config
        self.server = server

        # Prevents running of commands by abbreviation
        self.abbrev = False
        self.debug = True
        self.help_path = os.path.join(os.path.dirname(__file__), "shell_help/")
        self.psiturk_header = 'psiTurk command help:'
        self.super_header = 'basic CMD command help:'
        
        if not self.quiet:
            self.color_prompt()
            self.intro = self.get_intro_prompt()
        else:
            self.intro = ''

        self.already_prelooped = False
示例#51
0
文件: elseql.py 项目: raff/elseql
    def __init__(self, port, debug):
        Cmd.__init__(self)

        self.settable.update({
            "prompt": "Set command prompt",
            "port": "Set service [host:]port",
            "creds": "Set credentials (user:password)",
            "debug": "Set debug mode",
            "query": "Display query before results"
        })

        if readline:
            path = os.path.join(os.environ.get('HOME', ''), HISTORY_FILE)
            self.history_file = os.path.abspath(path)
        else:
            self.history_file = None

        self.debug = debug
        self.port = port
        self.init_search()
示例#52
0
文件: dynash.py 项目: shazam/dynash
    def __init__(self):
        Cmd.__init__(self)

        self.pp = pprint.PrettyPrinter(indent=4)
        
        self.conn = self.connect_to_dynamo()

        # by default readline thinks - and other characters are word delimiters :(
        if readline:
            readline.set_completer_delims(re.sub('[-~]', '', readline.get_completer_delims()))

            path = os.path.join(os.environ.get('HOME', ''), HISTORY_FILE)
            self.history_file = os.path.abspath(path)
        else:
            self.history_file = None

        self.tables = []
        self.table = None
        self.consistent = False
        self.print_consumed = False
        self.verbose = False
示例#53
0
 def __init__(self):
     Cmd.__init__(self)
     global pubnub
     self.intro = "For Help type ? or help . " + \
         "To quit/exit type exit" + "\n" + \
         "Commands can also be provided on command line while starting console (in quotes) ex. " + \
         "pubnub-console 'init -p demo -s demo'"
     self.default_channel = None
     self.async = False
     pubnub = Pubnub("demo", "demo")
     self.channel_truncation = 3
     self.prompt = self.get_prompt()
     self.publish_key = "demo"
     self.subscribe_key = "demo"
     self.origin = "pubsub.pubnub.com"
     self.auth_key = None
     self.cipher_key = None
     self.secret_key = "demo"
     self.ssl = False
     self.uuid = None
     self.disable_pretty = False
示例#54
0
 def __init__(self):
     Cmd.__init__(self)
     self.prompt = "hephaestus> "
     self.intro = (
         "\n"
         + ruler("*")
         + "WELCOME to hephaestus\n"
         + ruler("*")
         + "hephaestus is the stateless firewall configuration parser for JunOS.\nGet help with 'help (<cmd>)' or '?', or issue 'userguide' to get started.\n"
         + ruler("*")
         + "\n"
     )
     self.myconfig = Baseconfig()
     self.configinterpreter = Interpreter_config()
     self.configinterpreter.myconfig = self.myconfig
     self.scaninterpreter = Interpreter_scan()
     self.scaninterpreter.myconfig = self.myconfig
     self.updateinterpreter = Interpreter_update()
     self.updateinterpreter.myconfig = self.myconfig
     self.queryinterpreter = Interpreter_query()
     self.queryinterpreter.myconfig = self.myconfig
     self.resultsinterpreter = Interpreter_results()
     self.resultsinterpreter.myconfig = self.myconfig
示例#55
0
	def __init__(self):
		Cmd.__init__(self)
示例#56
0
 def __int__(self):
     DroidFuzzer.__init__(self)