pysap.SAPSNC module¶
- class pysap.SAPSNC.SAPSNCFrame(_pkt, /, *, eye_catcher=b'SNCFRAME', frame_type=2, protocol_version=5, header_length=24, token_length=0, data_length=0, mech_id=3, flags=0, ext_flags=0, ext_field_length=0, ext_fields=b'', token=b'', data=b'')[source]¶
Bases:
PacketNoPaddedSAP SNC Frame packet
This packet is used to contain and wrap SNC Frames.
- aliastypes = [<class 'pysap.SAPSNC.SAPSNCFrame'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]¶
- fields_desc: List[AnyField] = [<StrFixedLenField (SAPSNCFrame).eye_catcher>, <ByteEnumKeysField (SAPSNCFrame).frame_type>, <ByteField (SAPSNCFrame).protocol_version>, <ShortField (SAPSNCFrame).header_length>, <FieldLenField (SAPSNCFrame).token_length>, <FieldLenField (SAPSNCFrame).data_length>, <ShortEnumKeysField (SAPSNCFrame).mech_id>, <ShortField (SAPSNCFrame).flags>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <StrLenField (SAPSNCFrame).token>, <StrLenField (SAPSNCFrame).data>]¶
- pysap.SAPSNC.unwrap_snc(s, offset)[source]¶
Unwraps an SNC frame if it’s possible. This is, if the frame type is data open or signed but not encrypted. Appends the unwrapped data to the end of the string being dissected and adjust the offset properly to skip the SNC frame.
- Parameters:
s (C{string}) – string to dissect
offset (int) – offset where the SNC frame starts
- Returns:
tuple of string with the SNC frame wrapped, adjusted offset
- Return type:
tuple of C{string}, int
- pysap.SAPSNC.wrap_snc(s, offset, data)[source]¶
Wraps an SNC frame if it’s possible. This is, if the frame type is data open. Adds the data to the frame and properly updates the length field on the SNC frame.
- Parameters:
s (string) – string to dissect
offset (int) – offset where the SNC frame starts
data (string) – data to wrap
- Returns:
string with the SNC frame wrapped
- Return type:
string