The following subsections show a representation of the file format portions and how to generate them.
First we need to perform some setup to import the packet classes:
In [1]:
    
from pysap.SAPCredv2 import *
from IPython.display import display
    
We'll read the files used in the test case suite and use them as example:
In [2]:
    
with open("../../tests/data/cred_v2_lps_off_3des", "rb") as fd:
    cred_v2_lps_off_3des_string = fd.read()
cred_v2_lps_off_3des = SAPCredv2(cred_v2_lps_off_3des_string)          
with open("../../tests/data/cred_v2_lps_off_aes256", "rb") as fd:
    cred_v2_lps_off_aes256_string = fd.read()
cred_v2_lps_off_aes256 = SAPCredv2(cred_v2_lps_off_aes256_string)
with open("../../tests/data/cred_v2_lps_off_dp_3des", "rb") as fd:
    cred_v2_lps_off_dp_3des_string = fd.read()
cred_v2_lps_off_dp_3des = SAPCredv2(cred_v2_lps_off_dp_3des_string)
    
The Cred files are comprised of the following main structures:
In [3]:
    
cred_v2_lps_off_3des.show()
    
    
In [4]:
    
cred_v2_lps_off_aes256.show()
    
    
In [5]:
    
cipher_header = SAPCredv2_Cred_Cipher(str(cred_v2_lps_off_aes256.creds[0].cred.cipher))
cipher_header.canvas_dump()
    
    Out[5]:
In [6]:
    
cred_v2_lps_off_aes256_plain = cred_v2_lps_off_aes256.creds[0].cred.decrypt("username")
cred_v2_lps_off_aes256_plain.show()
    
    
In [7]:
    
cred_v2_lps_off_dp_3des_plain = cred_v2_lps_off_dp_3des.creds[0].cred.decrypt("username")
cred_v2_lps_off_dp_3des_plain.show()
    
    
We'll read the files used in the test case suite and use them as example:
In [8]:
    
with open("../../tests/data/cred_v2_lps_on_dp_aes256", "rb") as fd:
    cred_v2_lps_on_dp_aes256_string = fd.read()
cred_v2_lps_on_dp_aes256 = SAPCredv2(cred_v2_lps_on_dp_aes256_string)          
with open("../../tests/data/cred_v2_lps_on_int_aes256", "rb") as fd:
    cred_v2_lps_on_int_aes256_string = fd.read()
cred_v2_lps_on_int_aes256 = SAPCredv2(cred_v2_lps_on_int_aes256_string)
    
The Cred files are comprised of the following main structures:
In [9]:
    
cred_v2_lps_on_dp_aes256.show()
    
    
In [10]:
    
cred_v2_lps_on_int_aes256.show()
    
    
In [11]:
    
cred_v2_lps_on_int_aes256_plain = cred_v2_lps_on_int_aes256.creds[0].cred.decrypt("username")
cred_v2_lps_on_int_aes256_plain.show()
    
    
In [12]:
    
lps_cipher_header = SAP_LPS_Cipher(str(cred_v2_lps_on_int_aes256.creds[0].cred.cipher))
lps_cipher_header.canvas_dump()
    
    Out[12]: