有没有其他方法可以使用 Scapy 配置具有多个标志属性的数据包?
我正在尝试设置具有可选属性和传递属性的 BGP 层。我正在使用这个 github 文件:https ://github.com/levigross/Scapy/blob/master/scapy/contrib/bgp.py 。在第 107 行,是我要添加的标志。
过去失败的尝试包括:
>>>a=BGPPathAttribute(flags=["Optional","Transitive"])
>>>send(a)
TypeError: unsupported operand type(s) for &: 'str' and 'int'
>>>a=BGPPathAttribute(flags=("Optional","Transitive"))
>>>send(a)
TypeError: unsupported operand type(s) for &: 'tuple' and 'int'
>>>a=BGPPathAttribute(flags="Optional")/BGPPathAttribute(flags="Transitive")
Creates 2 separate path attributes: One which is Optional and Non-Transitive and the other which is Well Known and Transitive.
>>>a=BGPPathAttribute(flags="Optional", flags="Transitive")
SyntaxError: keyword argument repeated
>>>a=BGPPathAttribute(flags="OT")
ValueError: ['OT'] is not in list