bugfinder.features.extraction

Base classes for feature extraction

class bugfinder.features.extraction.FlowGraphFeatureExtractor(dataset, deprecation_warning=None)

Bases: GraphFeatureExtractor

Base extractor to retrieve control or data flow features from a Joern database.

extract_features()

Extract features

extract_features_worker(args)

Feature extraction worker for a single entrypoint

static finalize_features(features, labels)

Finalize features.

abstract get_flowgraph_count(flowgraph)

Retrieve the number of a given flowgraph. Must be implemented by the subclasses.

abstract get_flowgraph_list_for_entrypoint(entrypoint)

Retrieve the list of flowgraph for a given entrypoint. Must be implemented by the subclasses.

abstract get_label_from_flowgraph(flowgraph)

Create label for a given flowgraph. Must be implemented by the subclasses.

initialize_features(entrypoint, label_list)

Initialize the features to 0 and returns the expected array

Parameters
  • dict (entrypoint -) –

  • list (label_list -) –

Returns

List of labels initialized to 0

Return type

list

map_features()

Map features

map_features_worker(entrypoint)

Worker to map features

class bugfinder.features.extraction.GraphFeatureExtractor(dataset, deprecation_warning=None)

Bases: Neo4J3Processing

Feature extractor for Joern databases

check_extraction_inputs()

Verify and version feature file

configure_container()

Setup main container variables.

execute(command_args=None, feature_map_filepath=None, need_map_features=False)

Execute the feature extraction

abstract extract_features()

Extract features. Abstract method.

feature_map_filepath = None
get_labels_from_feature_map()

Retrieve labels stored in feature map

abstract map_features()

Map features. Abstract method.

need_map_features = False
save_labels_to_feature_map(labels)

Save all labels to feature map

send_commands()

Send commands to the container

write_extraction_outputs(features)

Write features to CSV file