0
是否有任何其他方式可以使用Scapy配置具有多个标志属性的数据包?Scapy BGP标志属性
我正在尝试设置一个带有可选属性和传递属性的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
谢谢,我发现另一种方式,以防万一你好奇,flags = 192将它设置为Optional和Transitive。 –
我忽略提及它,因为我没有觉得它是优雅的,但我已经为了完整而将它包括在内;谢谢! – Yoel