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