pysap.SAPSNC module

class pysap.SAPSNC.SAPSNCFrame(_pkt='', post_transform=None, _internal=0, _underlayer=None, **fields)[source]

Bases: pysap.utils.fields.PacketNoPadded

SAP 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 = [<Field (SAPSNCFrame).eye_catcher>, <Field (SAPSNCFrame).frame_type>, <Field (SAPSNCFrame).protocol_version>, <Field (SAPSNCFrame).header_length>, <Field (SAPSNCFrame).token_length>, <Field (SAPSNCFrame).data_length>, <Field (SAPSNCFrame).mech_id>, <Field (SAPSNCFrame).flags>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPSNCFrame).token>, <Field (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