#16 After loading a label's file, the application crashes

已關閉
carlos.garcia8 年之前創建 · 2 條評論

The crash message is:

Input file: test_me_short_20161102-164436.pcap
Label file found. Loading labels...
Traceback (most recent call last):
  File "./CLI.py", line 113, in <module>
    main(sys.argv[1:])
  File "./CLI.py", line 108, in main
    cli.parse_arguments(args)
  File "./CLI.py", line 97, in parse_arguments
    self.process_arguments()
  File "./CLI.py", line 32, in process_arguments
    controller = Controller(self.args.input)
  File "/home/boy/Documents/CASED/Repos/id2t/code/ID2TLib/Controller.py", line 23, in __init__
    self.label_manager = LabelManager(self.pcap_src_path)
  File "/home/boy/Documents/CASED/Repos/id2t/code/ID2TLib/LabelManager.py", line 34, in __init__
    self._load_labels()
  File "/home/boy/Documents/CASED/Repos/id2t/code/ID2TLib/LabelManager.py", line 136, in _load_labels
    attack_note = a.childNodes[3].firstChild.data
AttributeError: 'NoneType' object has no attribute 'data'

There are no notes in the XML file, is this what is not correctly parsed?

The crash message is: Input file: test_me_short_20161102-164436.pcap Label file found. Loading labels... Traceback (most recent call last): File "./CLI.py", line 113, in <module> main(sys.argv[1:]) File "./CLI.py", line 108, in main cli.parse_arguments(args) File "./CLI.py", line 97, in parse_arguments self.process_arguments() File "./CLI.py", line 32, in process_arguments controller = Controller(self.args.input) File "/home/boy/Documents/CASED/Repos/id2t/code/ID2TLib/Controller.py", line 23, in __init__ self.label_manager = LabelManager(self.pcap_src_path) File "/home/boy/Documents/CASED/Repos/id2t/code/ID2TLib/LabelManager.py", line 34, in __init__ self._load_labels() File "/home/boy/Documents/CASED/Repos/id2t/code/ID2TLib/LabelManager.py", line 136, in _load_labels attack_note = a.childNodes[3].firstChild.data AttributeError: 'NoneType' object has no attribute 'data' There are no notes in the XML file, is this what is not correctly parsed?
Carlos Garcia commented 8 年之前
所有者

Having an empty "notes" field is indeed the problem. The XML is not being parsed correctly. On that same note, the program should be resilient against loading corrupted "label's files". That is, if it cannot parse it correctly, it should just drop it as if no label's file was found.

Having an empty "notes" field is indeed the problem. The XML is not being parsed correctly. On that same note, the program should be resilient against loading corrupted "label's files". That is, if it cannot parse it correctly, it should just drop it as if no label's file was found.

Parsing is now fixed - it uses the tags name defined as constants in the class (and also used for XML file generation) instead of a hard coded values. Further, if the XML parsing failed, the application just ignores the file.

Parsing is now fixed - it uses the tags name defined as constants in the class (and also used for XML file generation) instead of a hard coded values. Further, if the XML parsing failed, the application just ignores the file.
Sign in to join this conversation.
未選擇標籤
Bug
未選擇里程碑
未指派成員
2 參與者
正在加載...
取消
保存
尚未有任何內容