ScEpTIC.emulator package

Subpackages

Submodules

ScEpTIC.emulator.custom_metrics_manager module

class ScEpTIC.emulator.custom_metrics_manager.CustomMetricsManager(vmstate)

Bases: object

exists(metric_id)

Returns if metric exists :param metric_id: metric_id :return: bool

get_name(metric_id)

Returns metric name from metric_id :param metric_id: metric_id :return: metric name

get_result(result_format)

Returns custom metrics values :param result_format: the result format

increment(metric_id, val=1)

Increment custom metric by val :param metric_id: metric_id :param val: value to increment

reset()

Resets all custom metrics

save_metrics(save_dir, result_format)

Saves custom metrics :param save_dir: the path where to save the metrics :param result_format: the metrics format

ScEpTIC.emulator.state_retention_manager module

class ScEpTIC.emulator.state_retention_manager.StateRetentionManager(vmstate, config)

Bases: object

Manages checkpoint and restore operations

execute_state_restore()

Restores the previously saved state.

execute_state_save()

Saves the state.

get_vm_state_diff()

Compares the vm state with the vm dump taken during the checkpoint. It returns a list containing the memory section names that differs.

get_vm_state_diff_elements()

Returns a dictionary containing the differences for each memory component between the current state and the saved dump.

process_state_save_routines(functions, declarations)

If dynamic checkpoint mechanisms: removes all references to the checkpoint and restore routines (if any). If static checkpoint mechanisms: removes all references to restore routine and removes target from checkpoint routine calls.

NB: Checkpoint routine is considered just as a marker to verify when interrupt and test the execution.

reset()

Resets the saved dump and state

restore_dump()

Restores the previously taken dump, to make memory consistent again.

save_dump()

Performs a dump of the vm state

ScEpTIC.emulator.stats module

class ScEpTIC.emulator.stats.ScEpTICStats

Bases: object

Stats of ScEpTIC simulation

anomaly_found(count=1)
checkpoint_executed()
checkpoint_restored()
dump_restored()
instruction_executed()
reset()
stop_at(pc, clock, is_anomaly=False)

ScEpTIC.emulator.vm module

class ScEpTIC.emulator.vm.VM(config)

Bases: object

ScEpTIC VM

execute_analysis()

Run all the analysis

get_found_anomalies(outfile=None)

Prints out the found anomalies. If an outfile is specified, such information is written inside it.

get_observation_info(outfile=None)

Prints out the gethered profiling information. If an outfile is specified, such information is written inside it.

get_output_profiling_info(outfile=None)
get_profiling_info(outfile=None, module_name='')

Prints out the gethered profiling information. If an outfile is specified, such information is written inside it.

get_visual_dump()

Returns a visual dump of the current state of the simulator.

reset()

Resets the whole status of the simulator.

reset_anomalies()

Resets the found anomalies.

reset_profiling()

Resets the gathered profiling information.

run_single_analysis(analysis_name)

Executes an analysis and saves its results :param analysis_name: analysis name

run_test(module_name, class_name)

DEPRECATED Runs completely a test, given the test module (interruption manager)

run_tests()

DEPRECATED Runs the tests configured in the config file.

set_termination_reason(event, event_info=None)

Sets the analysis termination reason

stop_current_test()

Stops the current test

ScEpTIC.emulator.vmstate module

class ScEpTIC.emulator.vmstate.VMState(vm, config)

Bases: object

State of the ScEpTIC execution environment

property current_instruction

Returns the current instruction.

get_instruction_from_pc(pc)

Returns an instruction corresponding to a given program counter

handle_stop_request(anomaly)

Stops the analysis if stop_on_first_anomaly is set to True, accordingly to the user input.

init_code(functions, declarations)

Stores the function’s code information to be run and performs register allocation if required.

init_gst(global_vars)

Initializes the global symbol table.

on_branch(label, basic_block_id, tick_count)

Callback that executes the operations needed to perform the branch operation, which updates program counter and last_basic_block.

on_function_call(function_name)

Callback that executes the operations needed before executing a function call.

on_function_return(return_value, input_lookup_data, tick_count, update_program_counter=True)

Callback that executes the operations needed after returning from a function call.

on_run(tick_count, update_program_counter=True)

Callback that is executed when an instruction is run. It increments the program counter and the global_clock.

property program_end_reached

Returns if the end of the program has been reached.

reset()

Performs the CPU reset operations.

run_step()

Runs the current instruction.

Module contents