Package envi :: Module cli :: Class EnviCli
[hide private]
[frames] | no frames]

Class EnviCli

source code


Instance Methods [hide private]
 
__init__(self, memobj, config=None, symobj=None)
Instantiate a line-oriented interpreter framework.
source code
 
addCmdAlias(self, alias, cmd, persist=False)
Add a command alias and optionally save it.
source code
 
addScriptPathEnvVar(self, pathenv)
Reads a script environment variable in, parses it, and stores the paths
source code
 
setCanvas(self, canvas)
Set a new canvas for the CLI and add all the current renderers to the new one.
source code
 
write(self, data) source code
 
get_names(self) source code
 
getExpressionLocals(self)
Over-ride this to have things like the eval command and the python command use more locals than the sybolic defaults.
source code
 
registerCmdExtension(self, func, subsys='extended') source code
 
vprint(self, msg, addnl=True)
Print output to the CLI's output handler.
source code
 
__getattr__(self, name) source code
 
aliascmd(self, line) source code
 
cmdloop(self, intro=None)
Repeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument.
source code
 
onecmd(self, line)
Interpret the argument as though it had been typed in response to the prompt.
source code
 
do_help(self, line)
List available commands with "help" or detailed help with "help cmd".
source code
 
do_clear(self, line)
Clears the CLI output.
source code
 
do_EOF(self, line) source code
 
do_quit(self, line)
Quit
source code
 
do_config(self, line)
Show, edit, or save config options from the command line.
source code
 
do_alias(self, line)
Add an alias to the command line interpreter's aliases dictionary Usage: alias <alias_word> rest of the alias command
source code
 
do_python(self, line)
Start an interactive python interpreter.
source code
 
parseExpression(self, expr) source code
 
do_binstr(self, line)
Display a binary representation of the given value expression (padded to optional width in bits)
source code
 
do_eval(self, line)
Evaluate an expression on the CLI to show it's value.
source code
 
do_script(self, line)
Execute a python file.
source code
 
do_maps(self, line)
Display either a list of all the memory maps or the memory map details for the given address expression.
source code
 
do_saveout(self, line)
saves output to file for any command.
source code
 
do_search(self, line)
search memory for patterns.
source code
 
reprPointer(self, va)
Do your best to create a humon readable name for the value of this pointer.
source code
 
do_memdump(self, line)
Dump memory to a file.
source code
 
do_memcmp(self, line)
Compare memory at the given locations.
source code
 
do_mem(self, line)
Show some memory (with optional formatting and size)
source code

Inherited from cmd.Cmd: columnize, complete, complete_help, completedefault, completenames, default, emptyline, parseline, postcmd, postloop, precmd, preloop, print_topics

Class Variables [hide private]

Inherited from cmd.Cmd: doc_header, doc_leader, identchars, intro, lastcmd, misc_header, nohelp, prompt, ruler, undoc_header, use_rawinput

Method Details [hide private]

__init__(self, memobj, config=None, symobj=None)
(Constructor)

source code 

Instantiate a line-oriented interpreter framework.

The optional argument 'completekey' is the readline name of a completion key; it defaults to the Tab key. If completekey is not None and the readline module is available, command completion is done automatically. The optional arguments stdin and stdout specify alternate input and output file objects; if not specified, sys.stdin and sys.stdout are used.

Overrides: cmd.Cmd.__init__
(inherited documentation)

addCmdAlias(self, alias, cmd, persist=False)

source code 

Add a command alias and optionally save it.

Specify persist=True to save the alias.

Example:
    cli.addRuntimeAlias('woot', 'woot -F -T')

get_names(self)

source code 
Overrides: cmd.Cmd.get_names

vprint(self, msg, addnl=True)

source code 

Print output to the CLI's output handler.  This allows routines to
print to the terminal or the GUI depending on which mode we're in.

Example:
    vprint('hi mom!')

cmdloop(self, intro=None)

source code 

Repeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument.

Overrides: cmd.Cmd.cmdloop
(inherited documentation)

onecmd(self, line)

source code 

Interpret the argument as though it had been typed in response to the prompt.

This may be overridden, but should not normally need to be; see the precmd() and postcmd() methods for useful execution hooks. The return value is a flag indicating whether interpretation of commands by the interpreter should stop.

Overrides: cmd.Cmd.onecmd
(inherited documentation)

do_help(self, line)

source code 

List available commands with "help" or detailed help with "help cmd".

Overrides: cmd.Cmd.do_help
(inherited documentation)

do_clear(self, line)

source code 

Clears the CLI output. (GUI only)

do_quit(self, line)

source code 

Quit

Usage: quit

do_config(self, line)

source code 

Show, edit, or save config options from the command line.

Usage: config [-s] [config option[=value]]

no options display config -s save config to default location AFTER setting any options.

do_alias(self, line)

source code 

Add an alias to the command line interpreter's aliases dictionary Usage: alias <alias_word> rest of the alias command

To delete an alias: Usage: alias <alias_word>

do_python(self, line)

source code 

Start an interactive python interpreter. The namespace of the interpreter is updated with expression nicities. You may also specify a line of python code as an argument to be exec'd without beginning an interactive python interpreter on the controlling terminal.

Usage: python [pycode]

do_binstr(self, line)

source code 

Display a binary representation of the given value expression (padded to optional width in bits)

Usage: binstr <val_expr> [<bitwidth_expr>]

do_eval(self, line)

source code 

Evaluate an expression on the CLI to show it's value.

Usage: eval (ecx+edx)/2

do_script(self, line)

source code 

Execute a python file.

The script file is arbitrary python code which is run with the
full complement of expression extensions mapped in as locals.

The script command sources the env var ENVI_SCRIPT_PATH.

NOTE: additional command line arguments may be passed in and will
      appear as the list "argv" in the script namespace!  (They will
      all be strings)

Usage: script <scriptfile> [<argv[0]>, ...]

do_maps(self, line)

source code 

Display either a list of all the memory maps or the memory map details for the given address expression.

Usage: maps [addr_expression]

do_saveout(self, line)

source code 

saves output to file for any command. still outputs to whatever canvas the command normally outputs to.

saveout <output file> <cli command>

Example: saveout out.txt search -c MZ

do_search(self, line)

source code 

search memory for patterns.

search [options] <pattern>

-e <codec> encode the pattern with a codec (hex, utf-16le, etc) -X pattern is in hex (ie. 41414242 is AABB) -E pattern is an envi memory expression (numeric search) -r pattern is a regular expression -R <baseexpr:sizeexpr> search a range of memory (base + size) -c show context (32 bytes) after each hit

do_memdump(self, line)

source code 

Dump memory to a file. If no size is given, the entire memory map that contains the given va is dumped to disk.

Usage: memdump <va_expression> <filename> [size_expression]

do_memcmp(self, line)

source code 

Compare memory at the given locations. Outputs a set of differences showing bytes at their given offsets....

Usage: memcmp <addr_expr1> <addr_expr2> <size_expr>

do_mem(self, line)

source code 

Show some memory (with optional formatting and size)

Usage: mem [-F <format>] <addr expression> [size]

NOTE: use -F ? for a list of the formats