Package winappdbg :: Module crash :: Class CrashTable
[hide private]
[frames] | no frames]

Class CrashTable

source code

   object --+    
            |    
ContainerBase --+
                |
               CrashTable
Known Subclasses:

Manages a database of persistent Crash objects, trying to avoid duplicates only when requested.

Uses an SQLite database file for persistency.


See Also: Crash.key

Instance Methods [hide private]
 
_get_row_values(self, crash)
Private method, do not use.
source code
 
_memory_get_row_values(self, CrashID, mbi)
Private method, do not use.
source code
 
__init__(self, location=None, allowRepeatedKeys=True)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
tuple( str, str, database, cursor )
_connect(self, location)
Open the given SQLite file.
source code
 
add(self, crash)
Adds a new crash to the container.
source code
iterator
__iter__(self)
Returns: Iterator of the contained Crash objects.
source code
int
__len__(self)
Returns: Count of Crash elements in the container.
source code
bool
__bool__(self)
Returns: False if there are no known keys. (Inherited from winappdbg.crash.ContainerBase)
source code
bool
__contains__(self, crash)
Returns: True if a Crash object with the same key is in the container. (Inherited from winappdbg.crash.ContainerBase)
source code
bool
has_key(self, key)
Returns: True if the key is present in the set of known keys. (Inherited from winappdbg.crash.ContainerBase)
source code
iterator
iterkeys(self)
Returns: Iterator of known Crash keys. (Inherited from winappdbg.crash.ContainerBase)
source code
str or buffer
marshall_key(self, key)
Marshalls a Crash key to be used in the database. (Inherited from winappdbg.crash.ContainerBase)
source code
str
marshall_value(self, value, storeMemoryMap=False)
Marshalls a Crash object to be used in the database. (Inherited from winappdbg.crash.ContainerBase)
source code
 
remove_key(self, key)
Removes the given key from the set of known keys. (Inherited from winappdbg.crash.ContainerBase)
source code
Crash key.
unmarshall_key(self, key)
Unmarshalls a Crash key read from the database. (Inherited from winappdbg.crash.ContainerBase)
source code
Crash
unmarshall_value(self, value)
Unmarshalls a Crash object read from the database. (Inherited from winappdbg.crash.ContainerBase)
source code

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

Class Variables [hide private]
bool optimizeKeys = True
True to optimize the marshalling of keys, False otherwise.
bool optimizeValues = True
True to optimize the marshalling of keys, False otherwise.
bool compressKeys = True
True to compress keys when marshalling, False to leave them uncompressed.
bool compressValues = True
True to compress values when marshalling, False to leave them uncompressed.
bool escapeKeys = False
True to escape keys when marshalling, False to leave them uncompressed.
bool escapeValues = False
True to escape values when marshalling, False to leave them uncompressed.
bool binaryKeys = True
True to marshall keys to binary format (the Python buffer type), False to use text marshalled keys (str type).
bool binaryValues = True
True to marshall values to binary format (the Python buffer type), False to use text marshalled values (str type).
  _table_definition = 'CREATE TABLE Crashes (id INTEGER PRIMARY ...
  _insert_row = 'INSERT INTO Crashes VALUES (null, ?,?,?,?,?,?,?...
  _select_pickle = 'SELECT pickle FROM Crashes'
  _select_key = 'SELECT key FROM Crashes'
  _select_count = 'SELECT COUNT(*) FROM Crashes'
  _memory_table_definition = 'CREATE TABLE Memory (id INTEGER PR...
  _memory_insert_row = 'INSERT INTO Memory VALUES (null, ?,?,?,?...
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, location=None, allowRepeatedKeys=True)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • location (str) - (Optional) Location of the crash database. If the location is a filename, it's an SQLite database file.

    If no location is specified, the container is volatile. Volatile containers are stored only in memory and destroyed when they go out of scope.

  • allowRepeatedKeys (bool) - If True all Crash objects are stored.

    If False any Crash object with the same key as a previously existing object will be ignored.

Overrides: object.__init__

_connect(self, location)

source code 

Open the given SQLite file.

Parameters:
  • location (str) - (Optional) Location of the crash database. If the location is a filename, it's an SQLite database file.

    If no location is specified, the container is volatile. Volatile containers are stored only in memory and destroyed when they go out of scope.

Returns: tuple( str, str, database, cursor )
Tuple of location, database type, database object, cursor object.

Note: This is a private method and you shouldn't need to call it.

add(self, crash)

source code 

Adds a new crash to the container.

Parameters:
  • crash (Crash) - Crash object to add.

Note: When the allowRepeatedKeys parameter of the constructor is set to False, duplicated crashes are ignored.

See Also: Crash.key

__iter__(self)

source code 
Returns: iterator
Iterator of the contained Crash objects.

__len__(self)
(Length operator)

source code 
Returns: int
Count of Crash elements in the container.
Overrides: ContainerBase.__len__

Class Variable Details [hide private]

_table_definition

Value:
'CREATE TABLE Crashes (id INTEGER PRIMARY KEY,timeStamp TEXT,key BLOB,\
pickle BLOB,isExploitable TEXT,isExploitableRule TEXT,eventCode INTEGE\
R,pid INTEGER,tid INTEGER,pc INTEGER,sp INTEGER,fp INTEGER,labelPC TEX\
T,exceptionCode INTEGER,exceptionAddress INTEGER,exceptionLabel TEXT,f\
irstChance INTEGER,faultType INTEGER,faultAddress INTEGER,faultLabel T\
EXT,faultDisasm TEXT,stackTrace TEXT,commandLine TEXT,environment TEXT\
,notes TEXT)'

_insert_row

Value:
'INSERT INTO Crashes VALUES (null, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?\
,?,?,?,?,?,?)'

_memory_table_definition

Value:
'CREATE TABLE Memory (id INTEGER PRIMARY KEY,Crash INTEGER,Address INT\
EGER,Size INTEGER,State TEXT,Access TEXT,Type TEXT,File TEXT,Data BLOB\
)'

_memory_insert_row

Value:
'INSERT INTO Memory VALUES (null, ?,?,?,?,?,?,?,?)'