kitty.data.data_manager module

This module is usde to store the fuzzing session related data. It provides both means of communications between the fuzzer and the user interface, and persistent storage of the fuzzing session results.

class kitty.data.data_manager.DataManager(dbname)[source]

Bases: threading.Thread

Manages data on a dedicated thread. All calls to it should be done by submitting DataManagerTask

Example:
dataman = DataManager('fuzz_session.sqlite`)
dataman.start()
def get_session_info(manager):
    return manager.get_session_info_manager().get_session_info()
get_info_task = DataManagerTask(get_session_info)
dataman.submit_task(get_info_task)
session_info = get_info_task.get_results()
__init__(dbname)[source]
Parameters:dbname – database name for storing the data
close()[source]

close the database connection

get(*args, **kwargs)[source]

Actual wrapper for the synchronous function

get_report_by_id(*args, **kwargs)[source]

Actual wrapper for the synchronous function

get_report_list(*args, **kwargs)[source]

Actual wrapper for the synchronous function

get_report_test_ids(*args, **kwargs)[source]

Actual wrapper for the synchronous function

get_reports_manager(*args, **kwargs)[source]

Actual wrapper for the synchronous function

get_session_info(*args, **kwargs)[source]

Actual wrapper for the synchronous function

get_session_info_manager(*args, **kwargs)[source]

Actual wrapper for the synchronous function

open()[source]

open the database

run()[source]

thread function

set(*args, **kwargs)[source]

Actual wrapper for the synchronous function

set_session_info(*args, **kwargs)[source]

Actual wrapper for the synchronous function

stop()[source]

Stop the data manager

store_report(*args, **kwargs)[source]

Actual wrapper for the synchronous function

submit_task(task)[source]

submit a task to the data manager, to be proccessed in the DataManager context

Parameters:task (DataManagerTask) – task to perform
class kitty.data.data_manager.DataManagerTask(task, *args)[source]

Bases: object

Task to be performed in the DataManager context

__init__(task, *args)[source]
Parameters:task (function(DataManager) -> object) – task to be performed
execute(dataman)[source]

run the task

Parameters:dataman (DataManager) – the executing data manager
get_results()[source]
Returns:result from running the task
class kitty.data.data_manager.ReportsTable(connection, cursor)[source]

Bases: kitty.data.data_manager.Table

Table for storing the reports

__init__(connection, cursor)[source]
Parameters:
  • connection – the database connection
  • cursor – the cursor for the database
get(test_id)[source]

get report by the test id

Parameters:test_id – test id
Returns:Report object
get_report_list()[source]
Returns:ids of test reports
get_report_test_ids()[source]
Returns:ids of test reports
store(report, test_id)[source]
Parameters:
  • report – the report to store
  • test_id – the id of the test reported
Returns:

report id

class kitty.data.data_manager.SessionInfo(orig=None)[source]

Bases: object

session information manager

__init__(orig=None)[source]
Parameters:orig – SessionInfo object to copy (default: None)
as_dict()[source]
Returns:dictionary with the object fields
copy(orig)[source]
Parameters:orig – SessionInfo object to copy
Returns:True if changed, false otherwise
fields = ['start_time', 'start_index', 'end_index', 'current_index', 'failure_count', 'kitty_version', 'data_model_hash', 'test_list_str']
classmethod from_dict(info_d)[source]
Parameters:info_d – the info dictionary
Return type:SessionInfo
Returns:object that corresponds to the info dictionary
i = ('test_list_str', 'BLOB')
class kitty.data.data_manager.SessionInfoTable(connection, cursor)[source]

Bases: kitty.data.data_manager.Table

Table for storing the session info

__init__(connection, cursor)[source]
Parameters:
  • connection – the database connection
  • cursor – the cursor for the database
get_session_info()[source]
Return type:SessionInfo
Returns:current session info
read_info()[source]
Return type:SessionInfo
Returns:current session info
set_session_info(info)[source]
Parameters:info (SessionInfo) – info to set
class kitty.data.data_manager.Table(connection, cursor)[source]

Bases: object

Base class for data manager tables

__init__(connection, cursor)[source]
Parameters:
  • connection – the database connection
  • cursor – the cursor for the database
insert(fields, values)[source]

insert new db entry

Parameters:
  • fields – list of fields to insert
  • values – list of values to insert
Returns:

row id of the new row

row_to_dict(row)[source]

translate a row of the current table to dictionary

Parameters:row – a row of the current table (selected with *)
Returns:dictionary of all fields
select(to_select, where=None, sql_params=None)[source]

select db entries

Parameters:
  • to_select – string of fields to select
  • where – where clause (default: None)
  • sql_params – params for the where clause
update(field_dict, where_clause=None)[source]

update db entry

Parameters:
  • field_dict – dictionary of fields and values
  • where_clause – where clause for the update
kitty.data.data_manager.synced(func)[source]

Decorator for functions that should be called synchronously from another thread

Parameters:func – function to call