secml_malware.visualization package

Subpackages

Submodules

secml_malware.visualization.exe module

secml_malware.visualization.exe.plot_bins(itgs: numpy.ndarray, n_bins: int = 256, cut_index: Optional[int] = None, force_plot: bool = True)

Plot contribution in histogram

Parameters
  • itgs (numpy array) – The array containing the results of Integrated Gradients.

  • n_bins (int, optional, default 256) – How many bins fot the histogram, default 256

  • cut_index (int, optional, default None) – limit how many location should be used, default None

  • force_plot (bool, optional, default True) – Should show plot on screen? Default True

secml_malware.visualization.exe.plot_code_segment(pe_file: list, start: int, stop: int, itgs: numpy.ndarray, title: str, show_positives: bool = True, show_negatives: bool = False, force_plot: bool = True, width: int = 16, percentage: bool = True)

Plot contribution of chunks of bytes.

Parameters
  • pe_file (list) – list of bytes

  • start (int) – starting index for segment to plot

  • stop (int) – stop index for segment to plot

  • itgs (numpy array) – array containing result of integrated gradients

  • title (str) – plot title

  • show_positives (bool) – show positives contributes (default:True)

  • show_negatives (bool) – show negative contributes (default:False}

  • force_plot (bool) – show plot (default:True)

  • width (int) – how many byte per row of the heatmap (default:16)

  • percentage (bool) – display percentage instead of absolute values (default: True)

secml_malware.visualization.exe.plot_header_contribution_histogram(bytestring_program: bytearray, itgs: numpy.ndarray, percentage: bool = True, force_plot: bool = True)

Plot integrated gradient results, divided by sections

Parameters
  • bytestring_program (bytearray) – the program as bytearray

  • itgs (numpy array) – array containing the result of Integrated gradient

  • percentage (bool) – display percentage instead of absolute values (default: True)

  • force_plot (bool) – Should show the results? (default:True)

secml_malware.visualization.exe.plot_range_histogram(itgs: numpy.ndarray, start_idx: int = 0, how_many: Optional[int] = None, force_plot: bool = True)

Plot chunk of bytes with their relevance, according to the integrated gradient technique

Parameters
  • itgs (numpy array) – array containing the result of Integrated gradient

  • start_idx (int) – starting index for visualizing the results, default 0

  • how_many (int) – how many bytes represent inside the plot (default : None, means use all)

  • force_plot (bool, optional, default True) – Should show plot on screen? Default True

Module contents