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: We identify the regions in the DOS header which we can perturb adversarially.
  
  There are a series of "magic numbers" in this method which relate to the structure of the PE file.
  1) mz_offset = 2: the first two bytes of a PE are fixed as MZ.
  2) 0x3C: offset to the pointer to the PE header. The pointer is 4 bytes long.
  3) 0x40: end of the pointer to the PE header.
  
  :return batch_of_starts: A list of start locations we can perturb.
                           This will always have the same value of 2 and 64.
  :return batch_of_sizes: Size of the perturbations we can carry out.
  :return batch_of_starts: Start locations which we can perturb.
docstr_tok: ["We","identify","the","regions","in","the","DOS","header","which","we","can","perturb","adversarially",".","There","are","a","series","of","``","magic","numbers","''","in","this","method","which","relate","to","the","structure","of","the","PE","file",".","1",")","mz_offset","=","2",":","the","first","two","bytes","of","a","PE","are","fixed","as","MZ",".","2",")","0x3C",":","offset","to","the","pointer","to","the","PE","header",".","The","pointer","is","4","bytes","long",".","3",")","0x40",":","end","of","the","pointer","to","the","PE","header",".",":","return","batch_of_starts",":","A","list","of","start","locations","we","can","perturb",".","This","will","always","have","the","same","value","of","2","and","64.",":","return","batch_of_sizes",":","Size","of","the","perturbations","we","can","carry","out",".",":","return","batch_of_starts",":","Start","locations","which","we","can","perturb","."]
code: def get_dos_locations(
      x: np.ndarray,
  ) -> Tuple[List[List[int]], List[List[int]]]:
      """
      We identify the regions in the DOS header which we can perturb adversarially.
  
      There are a series of "magic numbers" in this method which relate to the structure of the PE file.
      1) mz_offset = 2: the first two bytes of a PE are fixed as MZ.
      2) 0x3C: offset to the pointer to the PE header. The pointer is 4 bytes long.
      3) 0x40: end of the pointer to the PE header.
  
      :return batch_of_starts: A list of start locations we can perturb.
                               This will always have the same value of 2 and 64.
      :return batch_of_sizes: Size of the perturbations we can carry out.
      :return batch_of_starts: Start locations which we can perturb.
      """
      batch_of_starts = []
      batch_of_sizes = []
      mz_offset = 2
  
      for i in range(len(x)):
          size = []
          start = []
  
          pointer_to_pe_header = x[i, int(0x3C) : int(0x40)].astype(
              np.uint8
          )
  
          # combine 4 unint8 bytes into unit32
          pointer_to_pe_header = (
              pointer_to_pe_header[3] << 24
              | pointer_to_pe_header[2] << 16
              | pointer_to_pe_header[1] << 8
              | pointer_to_pe_header[0]
          )
  
          size.append(int(0x3C) - mz_offset)
          start.append(mz_offset)
  
          size.append(int(pointer_to_pe_header) - int(0x40) - 1)
          start.append(int(0x40))
  
          batch_of_starts.append(start)
          batch_of_sizes.append(size)
  
      return batch_of_starts, batch_of_sizes
  
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 15 for calling the MalwareGDTensorFlow obj's underlying member method code with example usage: obj.get_dos_locations(x) and returns: batch_of_starts,  batch_of_sizes