class_docstr: Implementation of the following white-box attacks related to PE malware crafting:
      1) Append based attacks (example paper link: https://arxiv.org/abs/1810.08280)
      2) Section insertion attacks (example paper link: https://arxiv.org/abs/2008.07125)
      3) Slack manipulation attacks (example paper link: https://arxiv.org/abs/1810.08280)
      4) DOS Header Attacks (example paper link: https://arxiv.org/abs/1901.03583)
class_docstr_tok: ["Implementation","of","the","following","white-box","attacks","related","to","PE","malware","crafting",":","1",")","Append","based","attacks","(","example","paper","link",":","https",":","\/\/arxiv.org\/abs\/1810.08280",")","2",")","Section","insertion","attacks","(","example","paper","link",":","https",":","\/\/arxiv.org\/abs\/2008.07125",")","3",")","Slack","manipulation","attacks","(","example","paper","link",":","https",":","\/\/arxiv.org\/abs\/1810.08280",")","4",")","DOS","Header","Attacks","(","example","paper","link",":","https",":","\/\/arxiv.org\/abs\/1901.03583",")"]
docstr: Given a PE file we extract out the section information to determine the slack regions in the file.
  We return two lists 1) with the start location of the slack regions and 2) with the size of the slack region.
  We are using the lief library (https://github.com/lief-project/LIEF) to manipulate the PE file.
  
  :param filepath: Path to file we want to analyse with pedump and get the section information.
  :param save_to_json_path: (Optional) if we want to save the results of pedump to a json file, provide the path.
  :return start_of_slack: A list with the slack starts
  :return size_of_slack: A list with the slack start positions
docstr_tok: ["Given","a","PE","file","we","extract","out","the","section","information","to","determine","the","slack","regions","in","the","file",".","We","return","two","lists","1",")","with","the","start","location","of","the","slack","regions","and","2",")","with","the","size","of","the","slack","region",".","We","are","using","the","lief","library","(","https",":","\/\/github.com\/lief-project\/LIEF",")","to","manipulate","the","PE","file",".",":","param","filepath",":","Path","to","file","we","want","to","analyse","with","pedump","and","get","the","section","information",".",":","param","save_to_json_path",":","(","Optional",")","if","we","want","to","save","the","results","of","pedump","to","a","json","file",",","provide","the","path",".",":","return","start_of_slack",":","A","list","with","the","slack","starts",":","return","size_of_slack",":","A","list","with","the","slack","start","positions"]
code: def get_peinfo(
      filepath: str, save_to_json_path: Optional[str] = None
  ) -> Tuple[List[int], List[int]]:  # pragma: no cover
      """
      Given a PE file we extract out the section information to determine the slack regions in the file.
      We return two lists 1) with the start location of the slack regions and 2) with the size of the slack region.
      We are using the lief library (https://github.com/lief-project/LIEF) to manipulate the PE file.
  
      :param filepath: Path to file we want to analyse with pedump and get the section information.
      :param save_to_json_path: (Optional) if we want to save the results of pedump to a json file, provide the path.
      :return start_of_slack: A list with the slack starts
      :return size_of_slack: A list with the slack start positions
      """
      import lief  # pylint: disable=C0415
  
      start_of_slack = []
      size_of_slack = []
  
      cleaned_dump = {}
  
      binary = lief.parse(filepath)  # pylint: disable=I1101
      for section in binary.sections:
          section_info = {}
          slack = section.sizeof_raw_data - section.virtual_size
          section_info["PointerToRawData"] = section.pointerto_raw_data
          section_info["VirtualAddress"] = section.virtual_size
          section_info["SizeOfRawData"] = section.sizeof_raw_data
          cleaned_dump[section.name] = section_info
          if slack > 0:
              size_of_slack.append(slack)
              start_of_slack.append(
                  section.pointerto_raw_data + section.virtual_size
              )
  
      if save_to_json_path is not None:
          with open(save_to_json_path, "w", encoding="utf8") as outfile:
              json.dump(cleaned_dump, outfile, indent=4, sort_keys=True)
  
      return start_of_slack, size_of_slack
  
imports: import json
  import random
  import logging
  from typing import Optional, Union, Tuple, List, Dict, TYPE_CHECKING
  from tqdm.auto import trange
  import numpy
  from art.estimators.estimator import BaseEstimator, NeuralNetworkMixin
  from art.estimators.classification.classifier import ClassifierMixin
  from art.attacks.attack import EvasionAttack
label_desc: Use image node_id 13 for calling the MalwareGDTensorFlow obj's underlying member method code with example usage: obj.get_peinfo(filepath, save_to_json_path) and returns: start_of_slack,  size_of_slack