attack-detections-collector icon indicating copy to clipboard operation
attack-detections-collector copied to clipboard

list index out of range in 'load_detections'

Open andrewaalin opened this issue 3 years ago • 0 comments

Error example

>python adc.py -t T1133 -o results.html
Traceback (most recent call last):
  File "adc.py", line 279, in <module>
    args.detections, navigator_template="attack-navigator-template.json"
  File "adc.py", line 112, in __init__
    self.load_detections()
  File "adc.py", line 128, in load_detections
    uri_path = f"{subdir}{str(path).split(subdir)[1]}"
IndexError: list index out of range

Potential fix to load_detections() function?

Change

uri_path = f"{subdir}{str(path).split(subdir)[1]}"
self.detections.append((uri_path, yaml.safe_load(f)))

to

if len(str(path).split(subdir))>1:
  uri_path = f"{subdir}{str(path).split(subdir)[1]}"
  self.detections.append((uri_path, yaml.safe_load(f)))

andrewaalin avatar Jan 12 '22 17:01 andrewaalin