diff --git a/doc/scapy/conf.py b/doc/scapy/conf.py index be9480fb2f0..04d54f9aef4 100644 --- a/doc/scapy/conf.py +++ b/doc/scapy/conf.py @@ -193,3 +193,5 @@ '', 'Miscellaneous'), ] + +suppress_warnings = ["app.add_directive"] \ No newline at end of file diff --git a/scapy/layers/ms_nrtp.py b/scapy/layers/ms_nrtp.py index 34c672f87be..9cf7fdd5dec 100644 --- a/scapy/layers/ms_nrtp.py +++ b/scapy/layers/ms_nrtp.py @@ -602,7 +602,7 @@ def _members_cb(pkt, lst, cur, remain): ].Value return functools.partial( NRBFMemberPrimitiveUnTyped, - type=PrimitiveTypeEnum(primitiveType), + nrbf_type=PrimitiveTypeEnum(primitiveType), ) return NRBFRecord @@ -639,14 +639,14 @@ class NRBFClassInfo(Packet): class NRBFAdditionalInfo(Packet): - __slots__ = ["type"] + __slots__ = ["nrbf_type"] fields_desc = [ MultipleTypeField( [ ( ByteEnumField("Value", 0, PrimitiveTypeEnum), - lambda pkt: pkt.type + lambda pkt: pkt.nrbf_type in [ BinaryTypeEnum.Primitive, BinaryTypeEnum.PrimitiveArray, @@ -656,11 +656,11 @@ class NRBFAdditionalInfo(Packet): PacketField( "Value", NRBFLengthPrefixedString(), NRBFLengthPrefixedString ), - lambda pkt: pkt.type == BinaryTypeEnum.SystemClass, + lambda pkt: pkt.nrbf_type == BinaryTypeEnum.SystemClass, ), ( PacketField("Value", NRBFClassTypeInfo(), NRBFClassTypeInfo), - lambda pkt: pkt.type == BinaryTypeEnum.Class, + lambda pkt: pkt.nrbf_type == BinaryTypeEnum.Class, ), ], StrFixedLenField("Value", b"", length=0), @@ -668,18 +668,18 @@ class NRBFAdditionalInfo(Packet): ] def __init__(self, _pkt=None, **kwargs): - self.type = kwargs.pop("type", BinaryTypeEnum.Primitive) - assert isinstance(self.type, BinaryTypeEnum) + self.nrbf_type = kwargs.pop("nrbf_type", BinaryTypeEnum.Primitive) + assert isinstance(self.nrbf_type, BinaryTypeEnum) super(NRBFAdditionalInfo, self).__init__(_pkt, **kwargs) def clone_with(self, *args, **kwargs): pkt = super(NRBFAdditionalInfo, self).clone_with(*args, **kwargs) - pkt.type = self.type + pkt.nrbf_type = self.nrbf_type return pkt def copy(self): pkt = super(NRBFAdditionalInfo, self).copy() - pkt.type = self.type + pkt.nrbf_type = self.nrbf_type return pkt def default_payload_class(self, payload): @@ -715,7 +715,7 @@ def _member_type_infos_cb(pkt, lst, cur, remain): # Return BinaryTypeEnum tainted with a pre-selected type. return functools.partial( NRBFAdditionalInfo, - type=typeEnum, + nrbf_type=typeEnum, ) @@ -752,30 +752,30 @@ class NRBFClassWithId(NRBFRecord): class NRBFMemberPrimitiveUnTyped(Packet): - __slots__ = ["type"] + __slots__ = ["nrbf_type"] fields_desc = [ NRBFValueWithCode.fields_desc[1], ] def __init__(self, _pkt=None, **kwargs): - self.type = kwargs.pop("type", PrimitiveTypeEnum.Byte) - assert isinstance(self.type, PrimitiveTypeEnum) + self.nrbf_type = kwargs.pop("nrbf_type", PrimitiveTypeEnum.Byte) + assert isinstance(self.nrbf_type, PrimitiveTypeEnum) super(NRBFMemberPrimitiveUnTyped, self).__init__(_pkt, **kwargs) def clone_with(self, *args, **kwargs): pkt = super(NRBFMemberPrimitiveUnTyped, self).clone_with(*args, **kwargs) - pkt.type = self.type + pkt.nrbf_type = self.nrbf_type return pkt def copy(self): pkt = super(NRBFMemberPrimitiveUnTyped, self).copy() - pkt.type = self.type + pkt.nrbf_type = self.nrbf_type return pkt @property def PrimitiveType(self): - return self.type + return self.nrbf_type def default_payload_class(self, payload): return conf.padding_layer @@ -848,7 +848,7 @@ def _values_singleprim_cb(pkt, lst, cur, remain): return None return functools.partial( NRBFMemberPrimitiveUnTyped, - type=PrimitiveTypeEnum(pkt.PrimitiveTypeEnum), + nrbf_type=PrimitiveTypeEnum(pkt.PrimitiveTypeEnum), ) diff --git a/test/scapy/layers/msnrtp.uts b/test/scapy/layers/msnrtp.uts index 0add8591ac3..bd67c1270ce 100644 --- a/test/scapy/layers/msnrtp.uts +++ b/test/scapy/layers/msnrtp.uts @@ -80,7 +80,7 @@ pkt = NRBF( ], AdditionalInfos=[ NRBFAdditionalInfo( - type=BinaryTypeEnum.SystemClass, + nrbf_type=BinaryTypeEnum.SystemClass, Value=NRBFClassTypeInfo( TypeName=NRBFLengthPrefixedString( String=b"System.Data.SerializationFormat" @@ -89,23 +89,23 @@ pkt = NRBF( ) ), NRBFAdditionalInfo( - type=BinaryTypeEnum.Primitive, + nrbf_type=BinaryTypeEnum.Primitive, Value=PrimitiveTypeEnum.Boolean, ), NRBFAdditionalInfo( - type=BinaryTypeEnum.Primitive, + nrbf_type=BinaryTypeEnum.Primitive, Value=PrimitiveTypeEnum.Int32, ), NRBFAdditionalInfo( - type=BinaryTypeEnum.Primitive, + nrbf_type=BinaryTypeEnum.Primitive, Value=PrimitiveTypeEnum.Boolean, ), NRBFAdditionalInfo( - type=BinaryTypeEnum.Primitive, + nrbf_type=BinaryTypeEnum.Primitive, Value=PrimitiveTypeEnum.Int32, ), NRBFAdditionalInfo( - type=BinaryTypeEnum.PrimitiveArray, + nrbf_type=BinaryTypeEnum.PrimitiveArray, Value=PrimitiveTypeEnum.Byte, ), ], @@ -121,12 +121,12 @@ pkt = NRBF( ], BinaryTypeEnums=[BinaryTypeEnum.Primitive], AdditionalInfos=[ - NRBFAdditionalInfo(type=BinaryTypeEnum.Primitive, + NRBFAdditionalInfo(nrbf_type=BinaryTypeEnum.Primitive, Value=PrimitiveTypeEnum.Int32), ], LibraryId=2, Members=[ - NRBFMemberPrimitiveUnTyped(type=PrimitiveTypeEnum.Int32, Value=1) + NRBFMemberPrimitiveUnTyped(nrbf_type=PrimitiveTypeEnum.Int32, Value=1) ], ), NRBFBinaryObjectString( @@ -135,11 +135,11 @@ pkt = NRBF( ), NRBFMemberReference(IdRef=4), NRBFMemberReference(IdRef=4), - NRBFMemberPrimitiveUnTyped(type=PrimitiveTypeEnum.Boolean, Value=0), - NRBFMemberPrimitiveUnTyped(type=PrimitiveTypeEnum.Int32, Value=1033), - NRBFMemberPrimitiveUnTyped(type=PrimitiveTypeEnum.Boolean, Value=0), + NRBFMemberPrimitiveUnTyped(nrbf_type=PrimitiveTypeEnum.Boolean, Value=0), + NRBFMemberPrimitiveUnTyped(nrbf_type=PrimitiveTypeEnum.Int32, Value=1033), + NRBFMemberPrimitiveUnTyped(nrbf_type=PrimitiveTypeEnum.Boolean, Value=0), NRBFObjectNull(), - NRBFMemberPrimitiveUnTyped(type=PrimitiveTypeEnum.Int32, Value=1), + NRBFMemberPrimitiveUnTyped(nrbf_type=PrimitiveTypeEnum.Int32, Value=1), NRBFMemberReference(IdRef=5), ], ),