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

Class CrashTable

source code


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

Uses a SQLite database file for persistency.


See Also: Crash.key

Instance Methods [hide private]
 
__get_row_values(self, crash) source code
 
__memory_get_row_values(self, CrashID, mbi) source code
 
__init__(self, location=None, allowRepeatedKeys=True)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
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
bool
__contains__(self, crash)
Returns: True if the Crash object is in the container.
source code
int
__len__(self)
Returns: Count of Crash elements in the container.
source code
bool
__bool__(self)
Returns: False if the container is empty.
source code
BLOB
__marshall_key(self, key)
Marshalls a Crash key to be used in the database.
source code
(opaque object)
__unmarshall_key(self, key)
Unmarshalls a Crash key read from the database.
source code
BLOB
__marshall_value(self, value)
Marshalls a Crash object to be used in the database.
source code
Crash
__unmarshall_value(self, value)
Unmarshalls a Crash object read from the database.
source code

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

Class Variables [hide private]
  __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 P...
  __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 no location is specified, the container is volatile.

    If the location is a filename, it's an SQLite database file.

    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__

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.

__contains__(self, crash)
(In operator)

source code 
Parameters:
  • crash (Crash) - Crash object.
Returns: bool
True if the Crash object is in the container.

__len__(self)
(Length operator)

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

__bool__(self)

source code 
Returns: bool
False if the container is empty.

__marshall_key(self, key)

source code 

Marshalls a Crash key to be used in the database.

Parameters:
  • key ((opaque object)) - Key to convert.
Returns: BLOB
Converted key.

__unmarshall_key(self, key)

source code 

Unmarshalls a Crash key read from the database.

Parameters:
  • key (str) - Key to convert.
Returns: (opaque object)
Converted key.

__marshall_value(self, value)

source code 

Marshalls a Crash object to be used in the database. The memoryMap member is NOT stored here.

Parameters:
  • value (Crash) - Object to convert.
Returns: BLOB
Converted object.

__unmarshall_value(self, value)

source code 

Unmarshalls a Crash object read from the database.

Parameters:
  • value (str) - Object to convert.
Returns: Crash
Converted object.

Class Variable Details [hide private]

__table_definition

Value:
'CREATE TABLE Crashes (id INTEGER PRIMARY KEY,timeStamp TIMESTAMP,key \
BLOB,pickle BLOB,isExploitable TEXT,isExploitableRule TEXT,eventCode I\
NTEGER,pid INTEGER,tid INTEGER,pc INTEGER,sp INTEGER,fp INTEGER,labelP\
C TEXT,exceptionCode INTEGER,exceptionAddress INTEGER,exceptionLabel T\
EXT,firstChance INTEGER,faultType INTEGER,faultAddress INTEGER,faultLa\
bel TEXT,faultDisasm TEXT,stackTrace 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, ?, ?, ?, ?, ?, ?, ?, ?)'