Package winappdbg :: Module textio :: Class HexInput
[hide private]
[frames] | no frames]

Class HexInput

source code


Static functions for user input parsing. The counterparts for each method are in the HexOutput class.

Instance Methods [hide private]

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
list( int )
integer_list_file(cls, filename)
Read a list of integers from a file.
source code
list
string_list_file(cls, filename)
Read a list of string values from a file.
source code
list
mixed_list_file(cls, filename)
Read a list of mixed values from a file.
source code
Static Methods [hide private]
int
integer(token)
Convert numeric strings into integers.
source code
int
address(token)
Convert numeric strings into memory addresses.
source code
str
hexadecimal(token)
Convert a strip of hexadecimal numbers into binary data.
source code
str
pattern(token)
Convert an hexadecimal search pattern into a POSIX regular expression.
source code
bool
is_pattern(token)
Determine if the given argument is a valid hexadecimal pattern to be used with pattern.
source code
a new object with type S, a subtype of T
__new__(cls, *argv, **argd)
Don't try to instance this class, just use the static methods. (Inherited from winappdbg.util.StaticClass)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

integer(token)
Static Method

source code 

Convert numeric strings into integers.

Parameters:
  • token (str) - String to parse.
Returns: int
Parsed integer value.

address(token)
Static Method

source code 

Convert numeric strings into memory addresses.

Parameters:
  • token (str) - String to parse.
Returns: int
Parsed integer value.

hexadecimal(token)
Static Method

source code 

Convert a strip of hexadecimal numbers into binary data.

Parameters:
  • token (str) - String to parse.
Returns: str
Parsed string value.

pattern(token)
Static Method

source code 

Convert an hexadecimal search pattern into a POSIX regular expression.

For example, the following pattern:

   "B8 0? ?0 ?? ??"

Would match the following data:

   "B8 0D F0 AD BA"    # mov eax, 0xBAADF00D
Parameters:
  • token (str) - String to parse.
Returns: str
Parsed string value.

is_pattern(token)
Static Method

source code 

Determine if the given argument is a valid hexadecimal pattern to be used with pattern.

Parameters:
  • token (str) - String to parse.
Returns: bool
True if it's a valid hexadecimal pattern, False otherwise.

integer_list_file(cls, filename)
Class Method

source code 

Read a list of integers from a file.

The file format is:

  • # anywhere in the line begins a comment
  • leading and trailing spaces are ignored
  • empty lines are ignored
  • integers can be specified as:
    • decimal numbers ("100" is 100)
    • hexadecimal numbers ("0x100" is 256)
    • binary numbers ("0b100" is 4)
    • octal numbers ("0100" is 64)
Parameters:
  • filename (str) - Name of the file to read.
Returns: list( int )
List of integers read from the file.

string_list_file(cls, filename)
Class Method

source code 

Read a list of string values from a file.

The file format is:

  • # anywhere in the line begins a comment
  • leading and trailing spaces are ignored
  • empty lines are ignored
  • strings cannot span over a single line
Parameters:
  • filename (str) - Name of the file to read.
Returns: list
List of integers and strings read from the file.

mixed_list_file(cls, filename)
Class Method

source code 

Read a list of mixed values from a file.

The file format is:

  • # anywhere in the line begins a comment
  • leading and trailing spaces are ignored
  • empty lines are ignored
  • strings cannot span over a single line
  • integers can be specified as:
    • decimal numbers ("100" is 100)
    • hexadecimal numbers ("0x100" is 256)
    • binary numbers ("0b100" is 4)
    • octal numbers ("0100" is 64)
Parameters:
  • filename (str) - Name of the file to read.
Returns: list
List of integers and strings read from the file.