Gibt es eine andere Möglichkeit, Scapy zu verwenden, um ein Paket mit mehreren Flag-Attributen zu konfigurieren?Scapy BGP Flags Attribut
Ich versuche, eine BGP-Schicht mit optionalen und transitiven Attributen einzurichten. Ich verwende diese Github-Datei: https://github.com/levigross/Scapy/blob/master/scapy/contrib/bgp.py. In Zeile 107 sind die Flags, die ich hinzufügen möchte.
Vergangenheit gescheiterten Versuche umfassen:
>>>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
Danke, ich fand einen anderen Weg, falls Sie neugierig sind, flags = 192 setzt es auf Optional und Transitiv. –
Ich habe es versäumt, es zu erwähnen, da ich es nicht als elegant empfinde, aber ich habe es jetzt der Vollständigkeit halber aufgenommen; Vielen Dank! – Yoel