release 0.1.17.dev0 martin gallo, secureauth corporation · pysap documentation, release...

191
pysap Documentation Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation Aug 07, 2019

Upload: votu

Post on 29-Aug-2019

306 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap DocumentationRelease 0.1.17.dev0

Martin Gallo, SecureAuth Corporation

Aug 07, 2019

Page 2: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following
Page 3: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

Contents

1 Overview 3

2 Features 5

3 User guide 73.1 User guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3.1.1 Projects using pysap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73.1.2 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73.1.3 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3.2 Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.2.1 SAP Diag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.2.2 SAP Enqueue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.2.3 SAP Internet Graphic Server (IGS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283.2.4 SAP Message Server (MS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293.2.5 SAP NI (Network Interface) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603.2.6 SAP RFC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603.2.7 SAP Router . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 883.2.8 SAP SNC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

3.3 File formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 943.3.1 SAP CAR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 943.3.2 SAP Credv2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 973.3.3 SAP PSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

3.4 Example scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1043.4.1 Diag Example scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1043.4.2 Download Manager scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1053.4.3 Enqueue Example scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1063.4.4 Gateway Example scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1063.4.5 Internet Graphic Service Example scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . 1063.4.6 Message Server Example scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1073.4.7 Router Example scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111

4 Development guide 1174.1 Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

4.1.1 Release and version history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1174.1.2 Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1244.1.3 Notebooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1244.1.4 Code contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

i

Page 4: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

4.1.5 Bug reporting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1254.2 Developer Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

4.2.1 pysap package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1254.2.2 pysapcompress library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170

5 Indices and tables 173

Python Module Index 175

Index 177

ii

Page 5: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Version v0.1.17.dev0 (Installation)

Contents 1

Page 6: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

2 Contents

Page 7: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

CHAPTER 1

Overview

SAP Netweaver and SAP HANA are technology platforms for building and integrating SAP business applications.Communication between components uses different network protocols and some services and tools make use of customfile formats as well. While some of them are standard and well-known protocols, others are proprietaries and publicinformation is not available.

pysap is an open source Python library that provides modules for crafting and sending packets using SAP’s NI,Diag, Enqueue, Router, MS, SNC, IGS and RFC protocols. In addition, support for creating and parsing differentproprietary file formats is included. The modules are built on top of Scapy and are based on information acquired atresearching the different protocols, file formats and services.

3

Page 8: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

4 Chapter 1. Overview

Page 9: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

CHAPTER 2

Features

• Dissection and crafting of the following network protocols:

– SAP Network Interface (NI)

– SAP Diag

– SAP Enqueue

– SAP Router

– SAP Message Server (MS)

– SAP Secure Network Connection (SNC)

– SAP Internet Graphic Server (IGS)

– SAP Remote Function Call (RFC)

• Client interfaces for handling the following file formats:

– SAP SAR archive files

– SAP Personal Security Environment (PSE) files

– SAP SSO Credential (Credv2) files

• Library implementing SAP’s LZH and LZC compression algorithms.

• Automatic compression/decompression of payloads with SAP’s algorithms.

• Client, proxy and server classes implemented for some of the protocols.

• Example scripts to illustrate the use of the different modules and protocols.

5

Page 10: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

6 Chapter 2. Features

Page 11: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

CHAPTER 3

User guide

3.1 User guide

The following parts of the documentation contains some background information about pysap, as well as some step-by-step instructions for installing, configuring and using pysap.

3.1.1 Projects using pysap

The following projects, tools and repositories are known to be using pysap:

• HoneySAP: HoneySAP is a low-interaction research-focused honeypot specific for SAP services. HoneySAPuses pysap as a library in order to craft and parse different protocol network packets.

• SAP dissection plug-in for Wireshark: This Wireshark plugin provides dissection of SAP’s NI, Message Server,Router, Diag, Enqueue, IGS and SNC protocols. The Wireshark plug-in makes use of pysap in order tocraft packets used during unit tests.

• SAP Message Server research: Exploit proof of concept code for two attacks against the Message Server service:

– Logon Group (transparent) Hijacking

– BeTrusted

• SAP Gateway RCE exploit PoCs: Exploit proof of concept code for ACL misconfigurations in the SAP Gatewaythat leads to a Remote Command Execution (RCE).

• John the Ripper’s pse2john script: Script to export PSE’s encryption PIN into a format that can be cracked withJohn the Ripper.

3.1.2 Installation

This section of the documentation covers the installation process of pysap.

7

Page 12: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Installation with pip

Installing pysap is simple with pip, just run the following command on a terminal:

$ pip install pysap

Some example scripts has additional required libraries:

• tabulate

• netaddr

• cryptography

• requests

• wxPython

• fau_timer

Some of those extra libraries can be installed with pip running the following command:

$ pip install pysap[examples]

Manual installation

The tool relays on the Scapy library for crafting packets. To install the required libraries use:

$ pip install -r requirements.txt

Once you have downloaded pysap’s sources, you can install it easily using the Python’s setuptools script provided:

1. python setup.py test

2. python setup.py install

Scapy installation

• For installing Scapy on Mac OSX, see some guidance here.

• For installing Scapy on Windows, see some guidance here.

3.1.3 References

Additional information about the protocols and the research can be found at different publications:

• Uncovering SAP vulnerabilities: reversing and breaking the Diag protocol

• SAP’s Network Protocols Revisited

• HoneySAP: Who really wants your money

• Deep-dive into SAP archive file formats

• Intercepting SAP SNC-protected traffic

• SAPCAR Heap Buffer Overflow: From crash to exploit

• Hunting crypto secrets in SAP systems

And advisories:

8 Chapter 3. User guide

Page 13: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

• SAP Netweaver Dispatcher Multiple Vulnerabilities

• SAP Netweaver Message Server Multiple Vulnerabilities

• SAP Router Password Timing Attack

• SAP Netweaver Enqueue Server Trace Pattern Denial of Service Vulnerability

• SAP LZC LZH Compression Multiple Vulnerabilities

• SAP Download Manager Password Weak Encryption

• SAP CAR Multiple Vulnerabilities

• SAP SAPCAR Heap Based Buffer Overflow Vulnerability

• SAP Note Assistant Insecure Handling of SAP Notes Signature Vulnerability

Initial research about the SAP CAR file format was performed by Martin Gallo and published in Deep-dive into SAParchive file formats at the Troopers 2016 Security Conference. Additional research was performed by Hans-ChristianEsperer and published in the Hascar tool.

Documentation on the SAP SAR archive file protocol is available in SAP’s Virus Scan Interface (NW-VSI) specifica-tion document. An example implementation can be also found in the Virus Scan Adapter SDK.

Initial research about the IGS protocol was performed by Yvan Genuer and published in SAP IGS : The ‘vulnerable’forgotten component.

Additional research about the Message Server (MS) and Remote Function Call (RFC) protocols was performed byDmitry Chastuhin and Mathieu Geli and published in (SAP) Gateway to Heaven.

3.2 Protocols

This part of the documentation covers the different network protocols implemented in pysap and their packets.

3.2.1 SAP Diag

The following subsections show a graphical representation of the main protocol packets and how to generate them.

First we need to perform some setup to import the packet classes:

[1]: from pysap.SAPDiag import *from pysap.SAPDiagItems import *from IPython.display import display

SAP Diag DP Header packet

[2]: p = SAPDiagDP()p.canvas_dump()

3.2. Protocols 9

Page 14: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

[2]:

SAP Diag packet

[3]: p = SAPDiag()p.canvas_dump()

[3]:

SAP Diag Items

10 Chapter 3. User guide

Page 15: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

[4]: for item_type in diag_item_types:p = SAPDiagItem(item_type=item_type)p.item_value = ""print(diag_item_types[item_type])display(p.canvas_dump())

SES

ICO

TIT

DiagMessage

OKC

CHL

SFE

SBA

EOM

3.2. Protocols 11

Page 16: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

APPL

DIAG_XMLBLOB

APPL4

SLC

SBA2

SAP Diag APPL/APPL4 Items

[5]: for appl_id in diag_appl_ids:for appl_sid in diag_appl_sids[appl_id]:

p = SAPDiagItem(item_type="APPL", item_id=appl_id, item_sid=appl_sid)cls = diag_item_get_class(p, "APPL", appl_id, appl_sid)print("SAP Diag APPL Item ID={}, SID={}".format(diag_appl_ids[appl_id], diag_

→˓appl_sids[appl_id][appl_sid]))if cls:

p.item_value = cls()display(p.canvas_dump())display(p.item_value.canvas_dump())

SAP Diag APPL Item ID=SCRIPT, SID=SCRIPT_OTFSAP Diag APPL Item ID=SCRIPT, SID=SCRIPT_SCREENSAP Diag APPL Item ID=SCRIPT, SID=SCRIPT_POSTSCRIPTSAP Diag APPL Item ID=SCRIPT, SID=SCRIPT_ITFSAP Diag APPL Item ID=GRAPH, SID=GRAPH RELEASE 3SAP Diag APPL Item ID=GRAPH, SID=GRAPH RELEASE 5

(continues on next page)

12 Chapter 3. User guide

Page 17: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

(continued from previous page)

SAP Diag APPL Item ID=IXOS, SID=ABLAGESAP Diag APPL Item ID=IXOS, SID=ANZEIGESAP Diag APPL Item ID=IXOS, SID=IXOS_COMMANDSAP Diag APPL Item ID=ST_USER, SID=V1SAP Diag APPL Item ID=ST_USER, SID=CONNECT

SAP Diag APPL Item ID=ST_USER, SID=SELECTEDRECTSAP Diag APPL Item ID=ST_USER, SID=FONTMETRICSAP Diag APPL Item ID=ST_USER, SID=TABLEMETRICSAP Diag APPL Item ID=ST_USER, SID=GUITIMESAP Diag APPL Item ID=ST_USER, SID=GUITIMEZONESAP Diag APPL Item ID=ST_USER, SID=TURNTIMESAP Diag APPL Item ID=ST_USER, SID=GUIVERSIONSAP Diag APPL Item ID=ST_USER, SID=SUPPORTDATA

3.2. Protocols 13

Page 18: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

14 Chapter 3. User guide

Page 19: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

SAP Diag APPL Item ID=ST_USER, SID=RFC_CONNECTSAP Diag APPL Item ID=ST_USER, SID=WSIZE

SAP Diag APPL Item ID=ST_USER, SID=V2SAP Diag APPL Item ID=ST_USER, SID=TURNTIME2SAP Diag APPL Item ID=ST_USER, SID=RFC_PARENT_UUIDSAP Diag APPL Item ID=ST_USER, SID=RFC_NEW_UUIDSAP Diag APPL Item ID=ST_USER, SID=RFC_UUIDSSAP Diag APPL Item ID=ST_USER, SID=RFC_UUIDS2SAP Diag APPL Item ID=ST_USER, SID=XML_LOGINSAP Diag APPL Item ID=ST_USER, SID=XML_TRANSACTIONSAP Diag APPL Item ID=ST_USER, SID=SCROLLBAR_WIDTHSAP Diag APPL Item ID=ST_USER, SID=TOOLBAR_HEIGHTSAP Diag APPL Item ID=ST_USER, SID=PASSPORT_DATASAP Diag APPL Item ID=ST_USER, SID=GUI_STATESAP Diag APPL Item ID=ST_USER, SID=DECIMALPOINTSAP Diag APPL Item ID=ST_USER, SID=LANGUAGESAP Diag APPL Item ID=ST_USER, SID=USERNAMESAP Diag APPL Item ID=ST_USER, SID=GUIPATCHLEVELSAP Diag APPL Item ID=ST_USER, SID=WSIZE_PIXELSAP Diag APPL Item ID=ST_USER, SID=GUI_OS_VERSIONSAP Diag APPL Item ID=ST_USER, SID=BROWSER_VERSIONSAP Diag APPL Item ID=ST_USER, SID=OFFICE_VERSIONSAP Diag APPL Item ID=ST_USER, SID=JDK_VERSIONSAP Diag APPL Item ID=ST_USER, SID=GUIXT_VERSIONSAP Diag APPL Item ID=ST_USER, SID=DISPLAY_SIZESAP Diag APPL Item ID=ST_USER, SID=GUI_TYPESAP Diag APPL Item ID=ST_USER, SID=DIALOG_STEP_NUMBER

SAP Diag APPL Item ID=DYNN, SID=CHLSAP Diag APPL Item ID=DYNN, SID=XMLPROP DYNPRO

(continues on next page)

3.2. Protocols 15

Page 20: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

(continued from previous page)

SAP Diag APPL Item ID=ST_R3INFO, SID=MODENUMBERSAP Diag APPL Item ID=ST_R3INFO, SID=DBNAMESAP Diag APPL Item ID=ST_R3INFO, SID=CPUNAMESAP Diag APPL Item ID=ST_R3INFO, SID=RFC_TRIGGERSAP Diag APPL Item ID=ST_R3INFO, SID=GUI_LABELSAP Diag APPL Item ID=ST_R3INFO, SID=DIAGVERSIONSAP Diag APPL Item ID=ST_R3INFO, SID=TCODESAP Diag APPL Item ID=ST_R3INFO, SID=RFC_WAITINGSAP Diag APPL Item ID=ST_R3INFO, SID=RFC_REFRESHSAP Diag APPL Item ID=ST_R3INFO, SID=IMODENUMBERSAP Diag APPL Item ID=ST_R3INFO, SID=MESSAGESAP Diag APPL Item ID=ST_R3INFO, SID=CLIENTSAP Diag APPL Item ID=ST_R3INFO, SID=DYNPRONAMESAP Diag APPL Item ID=ST_R3INFO, SID=DYNPRONUMBERSAP Diag APPL Item ID=ST_R3INFO, SID=CUANAMESAP Diag APPL Item ID=ST_R3INFO, SID=CUASTATUSSAP Diag APPL Item ID=ST_R3INFO, SID=SUPPORTDATA

16 Chapter 3. User guide

Page 21: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

3.2. Protocols 17

Page 22: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

SAP Diag APPL Item ID=ST_R3INFO, SID=RFC_CONNECT_OKSAP Diag APPL Item ID=ST_R3INFO, SID=GUI_FKEYSAP Diag APPL Item ID=ST_R3INFO, SID=GUI_FKEYTSAP Diag APPL Item ID=ST_R3INFO, SID=STOP_TRANSSAP Diag APPL Item ID=ST_R3INFO, SID=RFC_DIAG_BLOCK_SIZESAP Diag APPL Item ID=ST_R3INFO, SID=USER_CHECKEDSAP Diag APPL Item ID=ST_R3INFO, SID=FLAGSSAP Diag APPL Item ID=ST_R3INFO, SID=USERIDSAP Diag APPL Item ID=ST_R3INFO, SID=ROLLCOUNTSAP Diag APPL Item ID=ST_R3INFO, SID=GUI_XT_VARSAP Diag APPL Item ID=ST_R3INFO, SID=IMODEUUIDSAP Diag APPL Item ID=ST_R3INFO, SID=IMODEUUID_INVALIDATESAP Diag APPL Item ID=ST_R3INFO, SID=IMODEUUIDSSAP Diag APPL Item ID=ST_R3INFO, SID=IMODEUUIDS2SAP Diag APPL Item ID=ST_R3INFO, SID=CODEPAGESAP Diag APPL Item ID=ST_R3INFO, SID=CONTEXTIDSAP Diag APPL Item ID=ST_R3INFO, SID=AUTOLOGOUT_TIMESAP Diag APPL Item ID=ST_R3INFO, SID=CODEPAGE_DIAG_GUISAP Diag APPL Item ID=ST_R3INFO, SID=CODEPAGE_APP_SERVERSAP Diag APPL Item ID=ST_R3INFO, SID=GUI_THEMESAP Diag APPL Item ID=ST_R3INFO, SID=GUI_USER_SCRIPTINGSAP Diag APPL Item ID=ST_R3INFO, SID=CODEPAGE_APP_SERVER_1SAP Diag APPL Item ID=ST_R3INFO, SID=TICKET4GUISAP Diag APPL Item ID=ST_R3INFO, SID=KERNEL_VERSIONSAP Diag APPL Item ID=ST_R3INFO, SID=STD_TOOLBAR_ITEMSSAP Diag APPL Item ID=POPU, SID=DESTSAP Diag APPL Item ID=RFC_TR, SID=RFC_TR_REQSAP Diag APPL Item ID=RFC_TR, SID=RFC_TR_RETSAP Diag APPL Item ID=RFC_TR, SID=RFC_TR_ERRSAP Diag APPL Item ID=RFC_TR, SID=RFC_TR_RQTSAP Diag APPL Item ID=RFC_TR, SID=RFC_TR_MORSAP Diag APPL Item ID=RFC_TR, SID=RFC_TR_MOBSAP Diag APPL Item ID=RFC_TR, SID=RFC_TR_RNBSAP Diag APPL Item ID=RFC_TR, SID=RFC_TR_RNTSAP Diag APPL Item ID=RFC_TR, SID=RFC_TR_DISSAP Diag APPL Item ID=RFC_TR, SID=RFC_TR_CALLSAP Diag APPL Item ID=RFC_TR, SID=RFC_TR_CALL_ENDSAP Diag APPL Item ID=RFC_TR, SID=RFC_TR_RESSAP Diag APPL Item ID=DYNT, SID=DYNT_FOCUSSAP Diag APPL Item ID=DYNT, SID=DYNT_ATOM

SAP Diag APPL Item ID=DYNT, SID=DYNT_EVENT_UNUSEDSAP Diag APPL Item ID=DYNT, SID=TABLE_ROW_REFERENCESAP Diag APPL Item ID=DYNT, SID=TABLE_ROW_DAT_INPUT_DUMMYSAP Diag APPL Item ID=DYNT, SID=TABLE_INPUT_HEADERSAP Diag APPL Item ID=DYNT, SID=TABLE_OUTPUT_HEADERSAP Diag APPL Item ID=DYNT, SID=TABLE_ROW_DATA_INPUT

(continues on next page)

18 Chapter 3. User guide

Page 23: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

(continued from previous page)

SAP Diag APPL Item ID=DYNT, SID=TABLE_ROW_DATA_OUTPUTSAP Diag APPL Item ID=DYNT, SID=DYNT_NOFOCUSSAP Diag APPL Item ID=DYNT, SID=DYNT_FOCUS_1SAP Diag APPL Item ID=DYNT, SID=TABLE_ROW_REFERENCE_1SAP Diag APPL Item ID=DYNT, SID=TABLE_FIELD_NAMESSAP Diag APPL Item ID=DYNT, SID=TABLE_HEADERSAP Diag APPL Item ID=DYNT, SID=DYNT_TABSTRIP_HEADERSAP Diag APPL Item ID=DYNT, SID=DYNT_TABSTRIP_BUTTONS

SAP Diag APPL Item ID=DYNT, SID=TABLE_ROW_REFERENCE_2SAP Diag APPL Item ID=DYNT, SID=DYNT_CONTROL_FOCUSSAP Diag APPL Item ID=DYNT, SID=DYNT_TC_COLUMN_TITLE_XMLPSAP Diag APPL Item ID=DYNT, SID=DYNT_TC_ROW_SELECTOR_NAMESAP Diag APPL Item ID=DYNT, SID=DYNT_FOCUS_FRAMESAP Diag APPL Item ID=CONTAINER, SID=RESETSAP Diag APPL Item ID=CONTAINER, SID=DEFAULTSAP Diag APPL Item ID=CONTAINER, SID=SUBSCREENSAP Diag APPL Item ID=CONTAINER, SID=LOOPSAP Diag APPL Item ID=CONTAINER, SID=TABLESAP Diag APPL Item ID=CONTAINER, SID=NAMESAP Diag APPL Item ID=CONTAINER, SID=TABSTRIPSAP Diag APPL Item ID=CONTAINER, SID=TABSTRIP_PAGESAP Diag APPL Item ID=CONTAINER, SID=CONTROLSAP Diag APPL Item ID=CONTAINER, SID=XMLPROPSAP Diag APPL Item ID=CONTAINER, SID=SPLITTERSAP Diag APPL Item ID=CONTAINER, SID=SPLITTER_CELLSAP Diag APPL Item ID=MNUENTRY, SID=MENU_ACT

SAP Diag APPL Item ID=MNUENTRY, SID=MENU_MNU

3.2. Protocols 19

Page 24: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

SAP Diag APPL Item ID=MNUENTRY, SID=MENU_PFK

SAP Diag APPL Item ID=MNUENTRY, SID=MENU_KYB

SAP Diag APPL Item ID=VARINFO, SID=MESTYPESAP Diag APPL Item ID=VARINFO, SID=SCROLL_INFOSSAP Diag APPL Item ID=VARINFO, SID=MESTYPE2SAP Diag APPL Item ID=VARINFO, SID=OKCODESAP Diag APPL Item ID=VARINFO, SID=CONTAINERSAP Diag APPL Item ID=VARINFO, SID=SCROLL_INFOS2SAP Diag APPL Item ID=VARINFO, SID=AREASIZE

SAP Diag APPL Item ID=VARINFO, SID=AREA_PIXELSIZESAP Diag APPL Item ID=VARINFO, SID=SESSION_TITLESAP Diag APPL Item ID=VARINFO, SID=SESSION_ICONSAP Diag APPL Item ID=VARINFO, SID=LIST_CELL_TEXTSAP Diag APPL Item ID=VARINFO, SID=CONTAINER_LOOPSAP Diag APPL Item ID=VARINFO, SID=LIST_FOCUSSAP Diag APPL Item ID=VARINFO, SID=MAINAREA_PIXELSIZE

(continues on next page)

20 Chapter 3. User guide

Page 25: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

(continued from previous page)

SAP Diag APPL Item ID=VARINFO, SID=SERVICE_REQUESTSAP Diag APPL Item ID=CONTROL, SID=CONTROL_PROPERTIESSAP Diag APPL Item ID=UI_EVENT, SID=UI_EVENT_SOURCE

SAP Diag APPL Item ID=ACC_LIST, SID=ACC_LIST_INFO4FIELDSAP Diag APPL Item ID=ACC_LIST, SID=ACC_LIST_CONTAINERSAP Diag APPL Item ID=RCUI, SID=RCUI_STREAMSAP Diag APPL Item ID=RCUI, SID=RCUI_SYSTEM_ERRORSAP Diag APPL Item ID=RCUI, SID=RCUI_SPAGPASAP Diag APPL Item ID=RCUI, SID=RCUI_MEMORYIDSAP Diag APPL Item ID=RCUI, SID=RCUI_TXOPTIONSAP Diag APPL Item ID=RCUI, SID=RCUI_VALUESAP Diag APPL Item ID=RCUI, SID=RCUI_COMMANDSAP Diag APPL Item ID=RCUI, SID=RCUI_BDCMSGSAP Diag APPL Item ID=RCUI, SID=RCUI_CONNECT_DATASAP Diag APPL Item ID=GUI_PACKET, SID=GUI_PACKET_STATESAP Diag APPL Item ID=GUI_PACKET, SID=GUI_PACKET_DATA

SAP Diag Error packet

[6]: p = SAPDiagError()p.canvas_dump()

[6]:

3.2.2 SAP Enqueue

The following subsections show a graphical representation of the main protocol packets and how to generate them.

First we need to perform some setup to import the packet classes:

3.2. Protocols 21

Page 26: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

[1]: from pysap.SAPEnqueue import *from IPython.display import display

SAP Enqueue packet

[2]: for dest in enqueue_dest_values:p = SAPEnqueue(dest=dest)print(enqueue_dest_values[dest])display(p.canvas_dump())

SYNC_ENQUEUE

ASYNC_ENQUEUE

SERVER_ADMIN

22 Chapter 3. User guide

Page 27: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

STAT_QUERY

CONECTION_ADMIN

ENQ_TO_REP

REP_TO_ENQ

SAP Enqueue Server Admin opcodes

[3]: for opcode in enqueue_server_admin_opcode_values:p = SAPEnqueue(dest=3, opcode=opcode)print(enqueue_server_admin_opcode_values[opcode])display(p.canvas_dump())

EnAdmDummyRequest

3.2. Protocols 23

Page 28: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

EnAdmShutdownRequest

EnAdmGetReplInfoRequest

24 Chapter 3. User guide

Page 29: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

EnAdmTraceRequest

SAP Enqueue Connection Admin opcodes

[4]: for opcode in enqueue_conn_admin_opcode_values:p = SAPEnqueue(dest=6, opcode=opcode)print(enqueue_conn_admin_opcode_values[opcode])display(p.canvas_dump())

Loopback packet

3.2. Protocols 25

Page 30: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Parameter Request

Parameter Response

Shutdown Read

Shutdown Write

26 Chapter 3. User guide

Page 31: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Shutdown Both

Keepalive

SAP Enqueue Connection Admin parameters

[5]: for param in enqueue_param_values:p = SAPEnqueueParam(param=param)print(enqueue_param_values[param])display(p.canvas_dump())

ENCPARAM_RECV_LEN

ENCPARAM_SEND_LEN

ENCPARAM_MSG_TYPE

ENCPARAM_SET_NAME

3.2. Protocols 27

Page 32: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

ENCPARAM_SET_NOSUPP

ENCPARAM_SET_VERSION

ENCPARAM_SET_UCSUPPORT

3.2.3 SAP Internet Graphic Server (IGS)

The following subsections show a graphical representation of the main protocol packets and how to generate them.

First we need to perform some setup to import the packet classes:

[1]: from pysap.SAPIGS import *from IPython.display import display

SAP IGS packet

[2]: p = SAPIGS()p.canvas_dump()

28 Chapter 3. User guide

Page 33: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

[2]:

SAP IGS Table packet

[3]: p = SAPIGSTable()p.canvas_dump()

[3]:

3.2.4 SAP Message Server (MS)

The following subsections show a graphical representation of the main protocol packets and how to generate them.

First we need to perform some setup to import the packet classes:

[1]: from pysap.SAPMS import *from IPython.display import display

3.2. Protocols 29

Page 34: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

SAP Message Server packet

[2]: for iflag in ms_iflag_values:p = SAPMS(iflag=iflag)print("IFlag: {}".format(ms_iflag_values[iflag]))display(p.canvas_dump())

IFlag: MS_UNKNOWN

IFlag: MS_SEND_NAME

IFlag: MS_SEND_TYPE

30 Chapter 3. User guide

Page 35: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

IFlag: MS_LOGIN

IFlag: MS_LOGOUT

3.2. Protocols 31

Page 36: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

IFlag: MS_ADM_OPCODES

IFlag: MS_MOD_MSGTYPES

IFlag: MS_SEND_TYPE_ONCE

32 Chapter 3. User guide

Page 37: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

IFlag: MS_LOGIN_2

IFlag: MS_MOD_STATE

3.2. Protocols 33

Page 38: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

IFlag: MS_J2EE_LOGIN

IFlag: MS_J2EE_SEND_TO_CLUSTERID

IFlag: MS_J2EE_SEND_BROADCAST

IFlag: MS_SEND_TYPE_ACK

34 Chapter 3. User guide

Page 39: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

IFlag: MS_J2EE_LOGIN_2

IFlag: MS_SEND_SERVICE

IFlag: MS_J2EE_LOGIN_3

3.2. Protocols 35

Page 40: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

IFlag: MS_J2EE_LOGIN_4

SAP Message Server packet opcodes

[3]: for opcode in ms_opcode_values:print("Opcode: {}".format(ms_opcode_values[opcode]))if opcode in [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,

→˓0x11, 0x1c, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,→˓0x2f, 0x43, 0x44, 0x45, 0x46, 0x47, 0x4a]:

p = SAPMS(iflag=1, opcode=opcode)display(p.canvas_dump())

Opcode: MS_DP_ADM

36 Chapter 3. User guide

Page 41: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Opcode: MS_SERVER_CHG

Opcode: MS_SERVER_ADD

3.2. Protocols 37

Page 42: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Opcode: MS_SERVER_SUB

Opcode: MS_SERVER_MOD

38 Chapter 3. User guide

Page 43: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Opcode: MS_SERVER_LST

Opcode: MS_CHANGE_IP

3.2. Protocols 39

Page 44: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Opcode: MS_SET_SECURITY_KEY

Opcode: MS_GET_SECURITY_KEY

40 Chapter 3. User guide

Page 45: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Opcode: MS_GET_SECURITY_KEY2

Opcode: MS_GET_HWID

3.2. Protocols 41

Page 46: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Opcode: MS_INCRE_TRACEOpcode: MS_DECRE_TRACEOpcode: MS_RESET_TRACEOpcode: MS_ACT_STATISTICOpcode: MS_DEACT_STATISTICOpcode: MS_RESET_STATISTICOpcode: MS_GET_STATISTIC

Opcode: MS_DUMP_NIBUFFEROpcode: MS_RESET_NIBUFFEROpcode: MS_OPEN_REQ_LSTOpcode: MS_SERVER_INFOOpcode: MS_SERVER_LISTOpcode: MS_SERVER_ENTRYOpcode: MS_DOMAIN_INFOOpcode: MS_DOMAIN_LISTOpcode: MS_DOMAIN_ENTRYOpcode: MS_MAP_URL_TO_ADDROpcode: MS_GET_CODEPAGE

42 Chapter 3. User guide

Page 47: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Opcode: MS_SOFT_SHUTDOWNOpcode: MS_DUMP_INFOOpcode: MS_FILE_RELOADOpcode: MS_RESET_DOMAIN_CONNOpcode: MS_NOOPOpcode: MS_SET_TXT

Opcode: MS_GET_TXT

3.2. Protocols 43

Page 48: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Opcode: MS_COUNTER_CREATE

Opcode: MS_COUNTER_DELETE

44 Chapter 3. User guide

Page 49: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Opcode: MS_COUNTER_INCREMENT

Opcode: MS_COUNTER_DECREMENT

3.2. Protocols 45

Page 50: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Opcode: MS_COUNTER_REGISTER

Opcode: MS_COUNTER_GET

46 Chapter 3. User guide

Page 51: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Opcode: MS_COUNTER_LST

Opcode: MS_SET_LOGON

3.2. Protocols 47

Page 52: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Opcode: MS_GET_LOGON

Opcode: MS_DEL_LOGON

48 Chapter 3. User guide

Page 53: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Opcode: MS_SERVER_DISCOpcode: MS_SERVER_SHUTDOWN

Opcode: MS_SERVER_SOFT_SHUTDOWNOpcode: MS_J2EE_CLUSTERNODE_CHGOpcode: MS_J2EE_CLUSTERNODE_ADDOpcode: MS_J2EE_CLUSTERNODE_SUBOpcode: MS_J2EE_CLUSTERNODE_MODOpcode: MS_J2EE_CLUSTERNODE_LSTOpcode: MS_J2EE_SERVICE_REGOpcode: MS_J2EE_SERVICE_UNREGOpcode: MS_J2EE_SERVICE_LSTOpcode: MS_J2EE_SERVICE_ADDOpcode: MS_J2EE_SERVICE_SUBOpcode: MS_J2EE_SERVICE_MODOpcode: MS_J2EE_MOD_STATEOpcode: MS_J2EE_SERVICE_GETOpcode: MS_J2EE_SERVICE_REG2

(continues on next page)

3.2. Protocols 49

Page 54: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

(continued from previous page)

Opcode: MS_NITRACE_SETGETOpcode: MS_SERVER_LONG_LISTOpcode: MS_J2EE_DEBUG_ENABLEOpcode: MS_J2EE_DEBUG_DISABLEOpcode: MS_SET_PROPERTY

Opcode: MS_GET_PROPERTY

Opcode: MS_DEL_PROPERTY

50 Chapter 3. User guide

Page 55: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Opcode: MS_IP_PORT_TO_NAME

Opcode: MS_CHECK_ACL

3.2. Protocols 51

Page 56: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Opcode: MS_LICENSE_SRVOpcode: MS_SERVER_TEST_SOFT_SHUTDOWN

Opcode: MS_J2EE_RECONNECT_P1Opcode: MS_J2EE_RECONNECT_P2

SAP Message Server Client packets

[4]: for client_cls in [SAPMSClient1, SAPMSClient2, SAPMSClient3, SAPMSClient4]:p = client_cls()display(p.canvas_dump())

52 Chapter 3. User guide

Page 57: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

SAP Message Server stats packets

[5]: for stats_cls in [SAPMSStat3]:p = stats_cls()display(p.canvas_dump())

3.2. Protocols 53

Page 58: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

54 Chapter 3. User guide

Page 59: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

SAP Message Server Logon packet

[6]: p = SAPMSLogon()p.canvas_dump()

[6]:

SAP Message Server Counter packet

[7]: p = SAPMSCounter()p.canvas_dump()

[7]:

SAP Message Server Adm Record opcodes

[8]: for adm_opcode in [0x01, 0x15, 0x2e]:p = SAPMSAdmRecord(opcode=adm_opcode)print("Adm opcode: {}".format(ms_adm_opcode_values[adm_opcode]))display(p.canvas_dump())

Adm opcode: AD_PROFILE

Adm opcode: AD_RZL_STRG

3.2. Protocols 55

Page 60: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Adm opcode: AD_SHARED_PARAMETER

SAP Message Server Dispatcher Info packets

[9]: for dp_info_cls in [SAPDPInfo1, SAPDPInfo2, SAPDPInfo3]:p = dp_info_cls()display(p.canvas_dump())

56 Chapter 3. User guide

Page 61: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

3.2. Protocols 57

Page 62: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

58 Chapter 3. User guide

Page 63: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

3.2. Protocols 59

Page 64: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

3.2.5 SAP NI (Network Interface)

The following subsections show a graphical representation of the main protocol packets and how to generate them.

First we need to perform some setup to import the packet classes:

[1]: from pysap.SAPNI import *from IPython.display import display

SAP NI packet

[2]: p = SAPNI() / "Some content"p.canvas_dump()

[2]:

3.2.6 SAP RFC

The following subsections show a graphical representation of the main protocol packets and how to generate them.

First we need to perform some setup to import the packet classes:

[1]: from pysap.SAPRFC import *from IPython.display import display

SAP RFC External packets

[2]: for version in [2, 3]:for req_type in rfc_req_type_values:

p = SAPRFC(version=version, req_type=req_type)print("Packet type: {} Version: {}".format(rfc_req_type_values[req_type],

→˓version))display(p.canvas_dump())

Packet type: GW_UNDEF_TYPE Version: 2

Packet type: CHECK_GATEWAY Version: 2

60 Chapter 3. User guide

Page 65: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Packet type: GW_CONNECT_GWWP Version: 2

Packet type: GW_NORMAL_CLIENT Version: 2

Packet type: GW_REMOTE_GATEWAY Version: 2

Packet type: STOP_GATEWAY Version: 2

Packet type: GW_LOCAL_R3 Version: 2

3.2. Protocols 61

Page 66: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Packet type: GW_SEND_INTERNAL_ERROR Version: 2

Packet type: GW_SEND_INFO Version: 2

Packet type: GW_SEND_CMD Version: 2

Packet type: GW_WORKPROCESS_DIED Version: 2

Packet type: GW_REGISTER_TP Version: 2

62 Chapter 3. User guide

Page 67: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Packet type: GW_UNREGISTER_TP Version: 2

Packet type: GW_CONNECT_DISP Version: 2

Packet type: GW_GET_NO_REGISTER_TP Version: 2

Packet type: GW_SAP_WP_CLIENT Version: 2

Packet type: GW_CANCEL_REGISTER_TP Version: 2

Packet type: GW_FROM_REMOTE_GATEWAY Version: 2

3.2. Protocols 63

Page 68: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Packet type: GW_CONTAINER_RECEIVED Version: 2

Packet type: GW_UNDEF_TYPE Version: 3

Packet type: CHECK_GATEWAY Version: 3

Packet type: GW_CONNECT_GWWP Version: 3

Packet type: GW_NORMAL_CLIENT Version: 3

64 Chapter 3. User guide

Page 69: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Packet type: GW_REMOTE_GATEWAY Version: 3

Packet type: STOP_GATEWAY Version: 3

Packet type: GW_LOCAL_R3 Version: 3

Packet type: GW_SEND_INTERNAL_ERROR Version: 3

3.2. Protocols 65

Page 70: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Packet type: GW_SEND_INFO Version: 3

Packet type: GW_SEND_CMD Version: 3

Packet type: GW_WORKPROCESS_DIED Version: 3

Packet type: GW_REGISTER_TP Version: 3

66 Chapter 3. User guide

Page 71: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Packet type: GW_UNREGISTER_TP Version: 3

Packet type: GW_CONNECT_DISP Version: 3

Packet type: GW_GET_NO_REGISTER_TP Version: 3

Packet type: GW_SAP_WP_CLIENT Version: 3

3.2. Protocols 67

Page 72: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Packet type: GW_CANCEL_REGISTER_TP Version: 3

Packet type: GW_FROM_REMOTE_GATEWAY Version: 3

Packet type: GW_CONTAINER_RECEIVED Version: 3

SAP RFC Gateway Monitor packets

[3]: for command in rfc_monitor_cmd_values:p = SAPRFC(req_type=9, cmd=command)print(rfc_monitor_cmd_values[command])display(p.canvas_dump())

68 Chapter 3. User guide

Page 73: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

NOOP

DELETE_CONN

CANCEL_CONN

RST_SINGLE_ERR_CNT

RST_ALL_ERR_CNT

3.2. Protocols 69

Page 74: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

INCREASE_TRACE

DECREASE_TRACE

READ_SEC_INFO

REFRESH_SEC_INFO

70 Chapter 3. User guide

Page 75: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

READ_GWSYS_TBL

READ_CONN_TBL

READ_PROC_TBL

READ_CONN_ATTR

3.2. Protocols 71

Page 76: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

READ_MEMORY

READ_REQ_BLK

ACT_STATISTIC

DEACT_STATISTIC

72 Chapter 3. User guide

Page 77: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

READ_STATISTIC

RESET_STATISTIC

READ_PARAMETER

DUMP_NIBUFFER

3.2. Protocols 73

Page 78: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

RESET_NIBUFFER

ACT_EXTPGM_TRACE

DEACT_EXTPGM_TRACE

ACT_CONN_TRACE

74 Chapter 3. User guide

Page 79: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

DEACT_CONN_TRACE

RESET_TRACE

SUICIDE

READ_SEC_INFO2

3.2. Protocols 75

Page 80: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

CANCEL_REG_TP

DUMP

READ_GWSYS_TBL2

CHANGE_PARAMETER

76 Chapter 3. User guide

Page 81: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

GET_CONN_PARTNER

DELETE_CLIENT

DELETE_REMGW

DISCONNECT

3.2. Protocols 77

Page 82: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

ENABLE_RESTART

DISABLE_RESTART

NI_TRACE

CLI_INFO

78 Chapter 3. User guide

Page 83: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

GW_INFO

CONVID_INFO

GET_NO_REG_TP

CV_INFO

3.2. Protocols 79

Page 84: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

SO_KEEPALIVE

READ_CONN_TBL2

READ_GWSYS_TBL3

RELOAD_ACL

80 Chapter 3. User guide

Page 85: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

RFC Extend Info packet

[4]: p = SAPRFCEXTEND()display(p.canvas_dump())

RFC DT structure

[5]: p = SAPRFCDTStruct()display(p.canvas_dump())

3.2. Protocols 81

Page 86: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

CPIC Suffix structure

[6]: p = SAPCPICSUFFIX()display(p.canvas_dump())

82 Chapter 3. User guide

Page 87: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

[7]: p.suff_unk9 = "\x00\x01"display(p.canvas_dump())

3.2. Protocols 83

Page 88: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

CPIC PARAM structures

[8]: for cls in [SAPCPICPARAM, SAPCPICPARAM2]:p = cls()p.ip = p.mask = "0.0.0.0"display(p.canvas_dump())

84 Chapter 3. User guide

Page 89: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

SAP RFC TH structure

[9]: p = SAPRFCTHStruct()display(p.canvas_dump())

SAP RFC XPG structure

[10]: p = SAPRFXPG()display(p.canvas_dump())

3.2. Protocols 85

Page 90: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

86 Chapter 3. User guide

Page 91: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

SAP Started RFCPING packets

[11]: p = SAPRFCPING()display(p.canvas_dump())

SAP CPIC Packet

[12]: for cls in [SAPCPIC, SAPCPIC2]:p = cls()display(p.canvas_dump())

3.2. Protocols 87

Page 92: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

3.2.7 SAP Router

The following subsections show a graphical representation of the main protocol packets and how to generate them.

First we need to perform some setup to import the packet classes:

[1]: from pysap.SAPRouter import *from IPython.display import display

SAP Router Admin packets

[2]: for command in router_adm_commands:p = SAPRouter(type=SAPRouter.SAPROUTER_ADMIN, adm_command=command)print(router_adm_commands[command])display(p.canvas_dump())

Information Request

New Route Table Request

Toggle Trace Request

88 Chapter 3. User guide

Page 93: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Stop Request

Cancel Route Request

Dump Buffers Request

Flush Buffers Request

Soft Shutdown Request

3.2. Protocols 89

Page 94: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Set Trace Peer

Clear Trace Peer

Trace Connection

Trace Connection

Hide Error Information Request

SAP Router Error Information / Control packets

[3]: for opcode in router_control_opcodes:p = SAPRouter(type=SAPRouter.SAPROUTER_CONTROL, opcode=opcode)if opcode in [70, 71]:

p.snc_frame = ""print(router_control_opcodes[opcode])display(p.canvas_dump())

Error information

90 Chapter 3. User guide

Page 95: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Version request

Version response

Send Handle (5)

Send Handle (6)

SNC handshake complete

3.2. Protocols 91

Page 96: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Send Handle (8)

SNC request

SAP Router Route packet

[4]: router_string = [SAPRouterRouteHop(hostname="8.8.8.8", port=3299),SAPRouterRouteHop(hostname="10.0.0.1", port=3200, password="S3cr3t")]

router_string_lens = map(len, map(str, router_string))p = SAPRouter(type=SAPRouter.SAPROUTER_ROUTE,

route_entries=len(router_string),route_talk_mode=1,route_rest_nodes=1,route_length=sum(router_string_lens),route_offset=router_string_lens[0],route_string=router_string)

display(p.canvas_dump())for x in router_string:

display(x.canvas_dump())

92 Chapter 3. User guide

Page 97: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

SAP Router Pong packet

[5]: p = SAPRouter(type=SAPRouter.SAPROUTER_PONG)p.canvas_dump()

[5]:

3.2.8 SAP SNC

The following subsections show a graphical representation of the main protocol packets and how to generate them.

First we need to perform some setup to import the packet classes:

[1]: from pysap.SAPSNC import *from IPython.display import display

SAP SNC Frame packet

[2]: p = SAPSNCFrame() / "Some content"p.canvas_dump()

3.2. Protocols 93

Page 98: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

[2]:

3.3 File formats

This part of the documentation covers the different file formats implemented in pysap and their structures.

3.3.1 SAP CAR

The following subsections show a graphical representation of the file format portions and how to generate them.

First we need to perform some setup to import the packet classes:

[1]: from pysap.SAPCAR import *from IPython.display import display

SAPCAR Archive version 2.00

We first create a temporary file and compress it inside an archive file:

[2]: with open("some_file", "w") as fd:fd.write("Some string to compress")

f0 = SAPCARArchive("archive_file.car", mode="wb", version=SAPCAR_VERSION_200)f0.add_file("some_file")

The file is comprised of the following main structures:

SAPCAR Archive Header

[3]: f0._sapcar.canvas_dump()

[3]:

94 Chapter 3. User guide

Page 99: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

SAPCAR Entry Header

[4]: f0._sapcar.files0[0].canvas_dump()

[4]:

SAPCAR Data Block

[5]: f0._sapcar.files0[0].blocks[0].canvas_dump()

[5]:

SAPCAR Compressed Data

[6]: f0._sapcar.files0[0].blocks[0].compressed.canvas_dump()

[6]:

SAPCAR Archive version 2.01

We first create a temporary file and compress it inside an archive file:

[7]: f1 = SAPCARArchive("archive_file.car", mode="wb", version=SAPCAR_VERSION_201)f1.add_file("some_file")

The file is comprised of the following main structures:

3.3. File formats 95

Page 100: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

SAPCAR Archive Header

[8]: f1._sapcar.canvas_dump()

[8]:

SAPCAR Entry Header

[9]: f1._sapcar.files1[0].canvas_dump()

[9]:

SAPCAR Data Block

[10]: f1._sapcar.files1[0].blocks[0].canvas_dump()

[10]:

SAPCAR Compressed data

[11]: f1._sapcar.files1[0].blocks[0].compressed.canvas_dump()

96 Chapter 3. User guide

Page 101: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

[11]:

[12]: from os import removeremove("some_file")remove("archive_file.car")

3.3.2 SAP Credv2

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:

[1]: from pysap.SAPCredv2 import *from IPython.display import display

Credv2 without LPS

We’ll read the files used in the test case suite and use them as example:

[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:

Credv2 without LPS and 3DES encryption

[3]: cred_v2_lps_off_3des.show()

###[ SAPCredv2 ]###\creds \|###[ SAPCredv2Cred ]###| \cred \| |###[ SAPCredv2_Cred ]###| | cert_name = <ASN1_IA5_STRING[’CN=PSEOwner’]>| | unknown1 = <ASN1_IA5_STRING[”]>| | pse_path = <ASN1_IA5_STRING[’/secudir/pse-v2-noreq-DSA-1024-SHA1.pse’]>| | unknown2 = <ASN1_IA5_STRING[”]>

(continues on next page)

3.3. File formats 97

Page 102: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

(continued from previous page)

| | cipher = <ASN1_BIT_STRING[1011100011...0100100001]=Mˆ4y! (0 unused bit)>

Credv2 without LPS and AES256 encryption

[4]: cred_v2_lps_off_aes256.show()

###[ SAPCredv2 ]###\creds \|###[ SAPCredv2Cred ]###| \cred \| |###[ SAPCredv2_Cred ]###| | cert_name = <ASN1_IA5_STRING[’CN=PSEOwner’]>| | unknown1 = <ASN1_IA5_STRING[”]>| | pse_path = <ASN1_IA5_STRING[’/secudir/pse-v2-noreq-DSA-1024-SHA1.pse’]>| | unknown2 = <ASN1_IA5_STRING[”]>| | cipher = <ASN1_BIT_STRING[0000000100...0011010100]=c8<...@ s (0

→˓unused bit)>

Credv2 without LPS Cipher Header

[5]: cipher_header = SAPCredv2_Cred_Cipher(str(cred_v2_lps_off_aes256.creds[0].cred.→˓cipher))cipher_header.canvas_dump()

[5]:

Credv2 Plain Credential

After decrypting the credential using the username provided, the plaintext contains the following structure:

[6]: cred_v2_lps_off_aes256_plain = cred_v2_lps_off_aes256.creds[0].cred.decrypt("username→˓")cred_v2_lps_off_aes256_plain.show()

###[ SAPCredv2_Cred_Plain ]###pin = <ASN1_IA5_STRING[’1234567890’]>option1 = Noneoption2 = Noneoption3 = None

###[ Raw ]###load = ’\xeb<’

98 Chapter 3. User guide

Page 103: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Credv2 Plain Credential with DP API

When using SSO Credentials in Windows, the CommonCryptoLib encrypts the PIN using DP API.

[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()

###[ SAPCredv2_Cred_Plain ]###pin =

→˓<ASN1_IA5_STRING[’01000000D08C9DDF0115D1118C7A00C04FC297EB010000006B3FF795A63D2D44B7604E350C2A4ED6040000002A000000430072006500640065006E007400690061006C0045006E006300720079007000740069006F006E000000106600000001000020000000BA59F09CE09554B0728C0B3137DBAA19F2DDF1891E55B8BCBC0944E25111BFF1000000000E800000000200002000000035FCC9DF90BD839D4C346B2A141380496D03CD31CBA9723A286651FAE88323EE10000000E080324A3237B73118103135CB3D305A40000000DC036DA55EDB9ED7670A602C5EDD4B8DE8CDC890D70094117DAA8EF1B3AFBA46D817044F3FDA6EF53694D6CF13CA5AB330025855AEAB657C47F6B2B8972581F2’]>option1 = <ASN1_IA5_STRING[’MSCryptProtect’]>option2 = Noneoption3 = None

###[ Raw ]###load = ’\x04\x04\x04\x04’

Credv2 with LPS

We’ll read the files used in the test case suite and use them as example:

[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:

Credv2 with LPS in DP API Mode (Windows)

[9]: cred_v2_lps_on_dp_aes256.show()

###[ SAPCredv2 ]###\creds \|###[ SAPCredv2Cred ]###| \cred \| |###[ SAPCredv2_Cred_LPS ]###| | version = 0x2 <ASN1_INTEGER[2]>| | oid = <ASN1_OID[’commonName’]>| | value = <ASN1_PRINTABLE_STRING[’PSEOwner’]>| | pse_path = <ASN1_UTF8_STRING[’C:\\secudir\\pse-v2-noreq-DSA-1024-SHA1.

→˓pse’]>| | cipher = <ASN1_BIT_STRING[0000001000...1101001111]=CredEn...UtO (0

→˓unused bit)>

Credv2 with LPS in INT/Fallback mode (Linux without TPM)

3.3. File formats 99

Page 104: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

[10]: cred_v2_lps_on_int_aes256.show()

###[ SAPCredv2 ]###\creds \|###[ SAPCredv2Cred ]###| \cred \| |###[ SAPCredv2_Cred_LPS ]###| | version = 0x2 <ASN1_INTEGER[2]>| | oid = <ASN1_OID[’commonName’]>| | value = <ASN1_PRINTABLE_STRING[’PSEOwner’]>| | pse_path = <ASN1_UTF8_STRING[’/secudir/pse-v2-noreq-DSA-1024-SHA1.pse’]>| | cipher = <ASN1_BIT_STRING[0000001000...0110100010]=CredEn...Z3y9 (0

→˓unused bit)>

[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()

###[ SAPCredv2_Cred_Plain ]###pin = <ASN1_IA5_STRING[’1234567890’]>option1 = Noneoption2 = Noneoption3 = None

SAP LPS Cipher header

[12]: lps_cipher_header = SAP_LPS_Cipher(str(cred_v2_lps_on_int_aes256.creds[0].cred.→˓cipher))lps_cipher_header.canvas_dump()

[12]:

3.3.3 SAP PSE

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:

100 Chapter 3. User guide

Page 105: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

[1]: from pysap.SAPPSE import *from IPython.display import display

PSE file

We’ll read the files used in the test case suite and use them as example:

[2]: with open("../../tests/data/pse_v2_lps_off_pbes1_3des_sha1.pse", "rb") as fd:pse_v2_string = fd.read()

pse_v2 = SAPPSEFile(pse_v2_string)

with open("../../tests/data/pse_v4_lps_off_pbes1_3des_sha1.pse", "rb") as fd:pse_v4_string = fd.read()

pse_v4 = SAPPSEFile(pse_v4_string)

The PSE file is comprised of the following main structures:

PSE version 2 Encrypted content

[3]: pse_v2.show()

###[ SAPPSEFile ]###version = 0x2 <ASN1_INTEGER[2]>\enc_cont \|###[ SAPPSEv2_Enc_Cont ]###| encrypted_pin= <ASN1_STRING[’$\xeebt\tv\xad\xa0\xe7\xa4\x1a\xde5R\xeeB’]>| \algorithm_identifier\| |###[ PKCS5_Algorithm_Identifier ]###| | alg_id = <ASN1_OID[’.1.2.840.113549.1.12.1.3’]>| | \parameters\| | |###[ PKCS12_PBE1_Parameters ]###| | | salt = <ASN1_STRING[’w\xcbi\x08\xbe\x86\x08e’]>| | | iterations= 0x2710 <ASN1_INTEGER[10000]>| cipher_text=

→˓<ASN1_STRING[’\xb7h\xaf\x10\xc0\xb2\xe8"\xc2\xe4\xf5\xf7\xb8\t\x95\xc8\xbaq,→˓\xeei\xc5\xe9\x13→˓\x85(\x0cH\xa7Y\xb6C\x06\x82\x8b\xdaU\x1d\x84"]\x9bdd\xc8*\xea\xbbn\xf2\xeb\xaf\x14ˆ\xc0\x9b\x9fWk\xc9;→˓\x1e\x81\xb0\x83\xbc\xe0\x1c\xc2\x8c\xda\xa0y1Rnf@\x82\xb9I\r\xa5\x84\x84\xc1\xaf\x0f\x80QH5\xea\x9d\x1c\x9c\xd0\x87Q\x19\’MmI\xd6\xddy\x98D/→˓\xbfl\xf9\xc5\xbaR\xf9\xdb\xfa\xd4\xdf\x16\xf4\xb7\xf9\xa2$\xd0\xaa\xcc]\x0f\x1f=K7\x87\xb1\x0bd→˓\x98\xb2\x8a\xe5\x81\xc9{\x0b\xd0\x08l\x94<@\xf2\x93-\x8b*\xc1)_M\xbb\xc7w\x81\xf0\xe0VP\xdeG@~\x14\xcf\xdb/→˓\x1e\x8f\x8a\x02\xf3"2\x12`~!=:g\x1b\xf3;→˓\x15R\x15\x08\x17\xd09\xa6\x9d\xec\x97\x12\xd1Z(\xb3S<7"f!\xfc;→˓\x12\x13\x89\xa7g\x94\xd4\xcf\x04f\xc3E\xda\x14\x18x\xbf6~Qˆ\xcf\xad\x82\xea\x13U\xa9\\\xf6\xc6\x82\x7f"\xb4D=\xd1\xf31\xb4_\xbdH\xf5Z\xf9ˆ3ra\xa3\xec\xca\xf4&~N\x8b\xcc\xa4\xef\x1b\x17L\xcb/→˓(\x05,→˓\x9bk\x8ci\x9dO\xc9U\x90\xb9\x15r\xd3\xef\x083\xdfiˆ\xb1]Z\x9c\xe3@»\x05\xef\xd3A\x95k\xb3\x93\xbc\xfb\x96Unj\x9a\xd4C\x96\x10\xe0V\xb9\x91x\xd4\x81\x91\xdc\x12\x1a\xafu\x89\\y\xec\xde-TE\x88Xh\x83H\xa1\xb7*_n\xc0At\xee\xc2\xdf\x87gL\xdf\x152\xe7\x17\x8f\xc2\x9f*G»→˓\x92/\x88\xa4\xc2/h\x94L|\xdb.→˓\xc0P\x1eU>\x15TJ\x0f]0}\x89`\x92\x0f\x8b\x9f5\xda\xee\xb8N\xdd\xc5\x11\xc8\x05\x95K\xea7\x15\xcbV8\x00\xe5K(\x98W\n\xf2>,→˓\x9c\xc8\xb8S\xf2\xe8{\x9a\xc9%\x17\x12\x8f\x00\xa3\x88\x04zq\xd4\xbf\xa9\xec\xf8\x8e\x8f\x02\xab\xd4\xbd\xa9\xee\x88\xb97R\xcc\xbc\xda\xf3\x9e\xbc\xfb\xff\xd7\xe7\xa1\xbd\xc6.→˓\xb9\xcds\xa2~Sa3\x85\x13\xd3\xa8\x89E)c\xf8\xe0\xed\xcb"=\x80\x19\xf3K\xfd4vGE\xf8\x9d\x0b\’g\xea\t\xf1\xae\xa6O\xc5\xc3u\xd7[\xb9b\x1e\x1c\xf6\n\xd7\xe2\x03\x92\x89\x8a\xab\xc7#}WYJ.→˓\n@\x93\xd0\’\xcc\xed9nf\xb9\xcb@\x10Z0\x9eR\xc9\x9a\xee\xcaj\x92f\xb7\xe6\x11\xdd\x84\np\x7f\x9d\xbb\xe6\x1e\xa1mN\xe5\xc7\xa3\xad\xf6\x8cQV`\xb6\x8cO\xce\xaaNM\xf2\x97I\x1d\xb5y\xa8?→˓=\x1c\x89h\xdd*n9\x94Q\xf0\xb3A,\xb4\xc3\xae\x05i-\xd7E\x99\xa6\x16q!→˓\xfb\x89M\xcf\x92\xcd\xf9\x05\x05D\xc4\xef\xdb\x83\x90\xecTy\xa0\x02\xdd\xe8\xc5\xb3,→˓\x98\xa5H\xd4\x80\xd4m\xd8_\x00\xe6>\xd5\x9b\x0e\x04\xf2\x854\x14\xc0\xe0\xf3\xe7Y\xf6\xebk\x7f\xe5h\x06\xf5,→˓/\xea\xeb\x8d{\x14\xb3\xbf.\x10\xd7\xe5\xba\x05\x96\x9ezWA\xb1wz7\xbe\xe7t\x9d\xf7/→˓\xb7\xd2\’;\x1e\x9f\xe9\xdc.→˓*2\x94P\xfe\xfc\xb4(\xc8\x11K\xf0N\xf3I\x88\xba\xfd\xb8\\9\x95\xfaMI*\x9b\x12aU\xc9"@!→˓7\xd9Uc\xfc9\x1a\xb4\xbc<Qt\xb1\x1c\xbc\x88\x94\x8c\x040\x9f\x07\xd2O\xcf\xe0wV_\x0b\xcb\xa2\xe6_mX\xa0\xad\xd4\x14TbD\xb0\x9e\xbba\xe4A\x9d\xf6|\x99\x82\xa8\xde\x1a\xef\x13e!→˓\xf7\xb1\xd3\x19=C\xcc\xdb\xab\xcb}\x1cuB8\xfa\xf9d\xa7\xe4O\xc2O\x85\x81\xf4,\x80.→˓\xa3b\x8dw\xd3\x0b(bM\xe6+\x19\n\x91\xf1\x83h;→˓AP6\x83K\xcaP\xd2R\x01O\xf4S\xd8\x112\xeb\xe86\x9b\xf5\\\xd2AI\x02\xe6\xf9\xcc\x0c#\x98yp\xaa(/→˓\x0bu\xf1\xab\x89r\x15/→˓|n\x97\xdf~\x9a1\xa3\xf6\xecC\x16\xf5\x16\xed\x1c\n\xc7\r]w]\xbf\xf6g\xc7\xff\x86p@\x93Z\x88\x82\xe2\xa9\xa4l9&\xa8_Ju\x1ai\xb8\xec\xdd\x9aU\xe9\x0fO\x14j\x9f\xca~/→˓\xf2\xae\x90\x1cLa\xf2>_}"c\xe6a\xee-\xef\x19MF\xf6sU\x15\x8c\xb7\x18*\xca`\x14\xd6t\xdbˆ\xdc\xf6\xb3\x89f\x027d\x86\xcd\xf3\xed\x9a\xc0\x0b\xab\xca\x9a\xaccw\x1au\xd6\xec\xa7\xe3\xf5U\xb8\x0fr\xbe\x88\xe2\x17\xb7\x86\x05w\xf2\x06\x0b>\xe7h\xbdw\x80\n\xcbh\x9a\x8e\xb8o4\xaa\xb5\x07\x8b\x11IR\x93t\xfec\x91\x06}\xef|x\x19\xda\xba\x88\xb5hmC\xa4+\x8f\x94So\x06\xa2N\xbf.→˓"\xff\x0f\xbe\xdf\xd8f\x87\xfb9\xb8\xeaY-\x7f\x1e-.→˓P\x14\x8aD\xbf\x8d\x13\xe1\x1a\x02\xb9\x81k\x84\xb4\xab\xd6S0\xa1b\xc5E\xdc\xf1\xe2\xf3\xab}\x83\x92\xb6\xd6\x82\xfc\xbf@\x9b\xd8\x1c3mQ\xff\xe7\xc4\xa1\x9c=\t\xcey\x1f\xf4\x9a\xd4\xda\ng9k\xab\xe4>\t\x83\x06%\xff\xd3\xdcm\x7f\x89\x0c\xf9\t\xb8\x1f\r\x8d!→˓7\x83\xc3\xf24w\xce\x10\x82\xdd.→˓\xf9L\x88b1\xac\x84\x0cX\x8fH\xed\xb7l\xcd\xfa\xf6Ji\xbc\xa6\xa4XUA\x87\x1b\xf9\xceP\xb0v\x15"P\xdcs{W{\xc7\xccG\xb2\x9f\x94\x97\xeeg)1\xa3\x16\xfa\x16h\x98\xd3\x17\xc0S\’\x8f4\xa1\xec\x19\xd31\xa7\xf2L\xa0\x16B\x88\xcc7#\x04\xa2\xeb?→˓J→˓\xf6q\x88~\xc4C\x9d\xae\xc1\xb6~\x00\x8e*\xd0K\x1dB\x9e\x14\xa0\xde\xc8\xa80D\xd7-\x05\x85v\xafp\\\xdbo\xcb\x1fK\xa3\xe5D`\xe5\xb5nj\xb4\x81\rL`~a_\x1eL\x94\x0b\xb0\xd8\xf7-\x15L\xe9\xbd!→˓\x17a\xa4\xf83y\xa7\xef\x8cY@\xebo\xa03T\x91\xe1\xe5\xdb\xa6\xac\xa7\xd4a\x80\’\xfd\x9b1\xbe1\xe9\xea\xdc_r\x85\xee→˓K\x7f+7Ru1\xbe\xf7+Z\x0b<\xce_\x97\x12u\xd2\xf7Z"$ \xdb\x1bB\xb1#\x84!→˓\x9cB[\xc6\x9cR\x05\xacK\xe0\xaf\xc1\x17x\xb0,→˓nj6\xfa\x0b\x03\x85\xb4\x89\xa4\xf5g\xd9\xf0\xcc\xc6Y\xb5%\x8a\xf2|P\xa3$Bn\x8b\xa0\x0f\x8f\xa9\xde\xa30\x90"9\xcd\xde\x97\x8e;→˓\xb1\xb3\xfe[\xad5<\x1a\x909\xd0\x80\xb5\x15\xdc\xd4\xcb\x13r?→˓\xb2\xc5\xcd\x90\xb1z\t`;\x16\x95,→˓\xc0T\x03\xc3\xd7k\x9bRF\xec`\x8b\xbe{8\x05\xb2*(\xedG\xfal\xd1\xba\x8b\xd6\xb3\xfaY\x7f\xa9]\x8bzw\xea]\r\xdc$F\xfa_=\x02T\xf8\x07\x8c~\t\xe01\xb92<\x8a\xcb\x05\x90\xed,→˓\xa7}\x87\x12d!\xb0\xd1\x16c\xd9Ma\xe6\x1c\x84\’\x0f\x8b\xedT\xbc,→˓\xbe\r\x03\x84\xde\xed→˓3\xcd\t\x8c\xe6n\xef\xebjQx\xfb\xed\xab\xbc\xd1\xc0\x86~\x8dG"\xf7\x07\xd0\xb3\xfe\x07\xd7\\WaD\xa5\x99\xfdVl-\xac\xb7\xcd\x80\xd1\xa6\xdf\x83\xdfel\x12\xa4\’2\xffg\xa8!→˓\xd9\xe5\xf1\x7f\xef\x12i\x03\x97d\xbf\xb9W\xfd\x0f\xc6\x86\xb2o\xb5S\xe1\xea\x8b\x1c4X\xa4\x18G$\x15\xae\xdee\xea]\xce[\x98\xc4\xc3F\xda\x04\xeb\xae~\xac+9;→˓h8Xj\x7f\x1c\n(\xc3):l}\xc9\xf8q\xa7\xab\xa1(\xaa\xaa\xbf\x92?→˓6v\xaf\xfb:\xc9n\x9a\x86\xdf\xcf\x13\xff\xe9\xe0wK\xbfWGe\x11y\xb7\x11\xf5\x93r2,→˓\xcb@\x1d\x19%\xf4\x98`\x99\xa7/→˓c\xed\xd4\n%\xc5\xff\xecS$g\x00\xb7>\xd9\xb3ht\xf4U"\\C\x80\xd0\xf3\xa5\xa6\xd9\xa4C\x8bO\x90}\x91\xa5\x0f%\x8f\x95\xa5\xf0K\x17H\xcf\xb7\x7fd\x0b\x84\xde\x9b2?→˓\x08~Lq@de\xbf\x1b\xc55sˆ\x88\’0\xcbn\x0b\xb3@m\xe8\x0fJ\xf5D)V%LG\xae!→˓\x18\xa3ˆ\xb5\xa3\xa4\xf0\xfa=\xb7R*k\x98\xa1t\x03Z\x12\xdfv:\xcf\xb8\xdd"\xf5\xdf\x82\x0bn\xc0T\xe0/→˓\x93\xc8~\x9dJn\xeb\x80<cR\x96\xa9\xa3\x96\x8d\xfd\xc4\xe9\xd32\xefYe.→˓N&\xed\xaby\x0cy\xee\x9c\xa9\xe8O\xd8n\x04a\x8cM\xf7\xde\x12\xe2\xd6\xbcb\xe8bl\xcfa\xb1\x86\xbf_\xa0i\x9ah%\x10\xe1\xc9\xe5\xde\xb3\x8d\xd0\x13-r\n\xb2\xf7\n\xfbr\x9a17O\x1e\x8b\xca\x99\xc9l[\x02\x84`\x12\xde\x12\xccA\xff\xd8a\xa5g\xd8k7\x18\x93\xb6\x1d\x9aA\xd8\xc4\x82\xdd\x89\x92H\xeeO\xbb\xc7|\xcc"\x7f%3KbZH\xc8\xe9\xe0\x15_o?→˓y\xc4\x97\x0e\xc5aˆ\x8d\x1d\x02\x16E\xdd7\xceEf:`\xeb\xca\xdd\xff\xc7q\xc7\\v\x13S\xf1b]\x0f\x17\xea\xc8\xd0&\xaak\xa3qWjy\xd8.→˓\x195\x85\xfd%&\x89\xd0t\xc8:\xca\x1e\xc0\x18\x9b)"\x90*\xd0!→˓\xe1\xcf*\x97j\x9aF\\\xd0\xf3XKQ\xa6)\xf6mx\xe5\x9d\xde\xf0#\x18\xdc3R\xc2\xa4a\xbd\xccGc\xe9\xbe\xe3\x08\xec\x87\xa5\xb8\xb6\xec\x04\xe5Tv[\x80\xd6\xeb\xed\xf9H\xb4\x85\xd6\xe2\x801\x03\xa7\xdf\x03\xfc\xd2L|\x83\xfc(\xb7\x99\xe3\xd2\x8f\x88\x85<\xd3\xc2L6\xae\x1f\xd9\xb2!→˓\xec\xa3A\xcd\xa2\xed\xab\xdc\x97Sv\x00wz\xbb\x08\xec\xc1\xdbD\xfa\xf4\xf8\x97\t\xcff\xbf\xfa\xb7\xc0\x1b\xbc~\x0c\xa2Q\x9bh\xb3|\xe788\x90\xd7\n\x9d\\\xb7na\xbe.→˓\xc2\xa9X\xf0\xd6\x1cP\xc8\xc4-\xbb?→˓#e\xdf\r}\xcd\xfc\x8b\xbb\x00\xe8\xa3\xe9\xf9iG\xfa\xe9|\xdc\xfb\xa0\x12W\xa6R\xf45\x92u\x80\x7f+\xcb\xe8\x00\xe3~M\xde\xcf\xe5\xae\x04\xc1O\xcc\xb1\xef\x9f\x143\r&\x0b\x91\xe5z\xbb\x06\x82I\xa6\xc8\x85H\xa0\xe5\xf8\xd5\x88\x17\x0e\xa8\xf5\xaa\xb4\x94\xdb\x98$\xce6o\xa7+y1\\\x04\xb2\xe1\\\xb7\xfdYB→˓\x8e*\x8a{\xf2\x864j\xcc\nA+9\x92j8!x\x17JT\xf7\t\xc54\x17\x95.→˓\x94\xaf\xc4z\xec]K\x15a\xd9\’\xaa\xc3\x8a{\xa3\xfc\xc1\xc8+\x88\x9f!→˓D3\x90\xfbW\x84\x91\x00Z<\x0b\xfd]>\x0e\x07\x12\x06gA\x89\xbd\xac\x07t\xb6\x07W\x15\x98]\xd4@x\x86\x8e\xa8\xdd\x8e\x97\x1f\x86{\x94\x7f\xb9y\x93[\xe4\x81P\xb5ol\x11\x1f%Df+W\x06\x89\x10\xadx\x1d\x1d\x0bR\x0c\xc3\x98K\xee\xc7\xbfJ\x80v{U\xda\xc0\xf9\x9c}\xae\xabc*\x82\xa4\xde\xc7n\xe6Z\xf1\x17\x7f\xdfv\rc\x95\x80\x16\x80\x97\x8c\x08\x9d\x17y\xe5B\xd8\x83\x91\xdc\x0fB\xb1\xa6\xbdt\x07\xd6\xb5L\x8b$\xfc\xf3\x8a`\xb1Sˆ:\xbe\x80Hli\x18\xbe\xa0e\xc5n|\xa5`eX\x89q\x13s\x0b\xfdm<\x88@\x1f"\xa0\xbe\xe0\x8eWqE\xe3l5\xd4<\x90\xe9\xe6\x99\xd3\xf8\x08\xd4\xb5$7S\xba\x99_\x8b\xdd\xbc80$\xc1\xd7e\x0c>\xab\xfd\x11e\xff\xd9h\xfe5v\x03\xfcCG0\xd7g{;→˓\xd9\xf7\xb6w\x82R\x89\xb7=q\xab\xfc5\x166\x95\x9e\xe77\x17H\xb5#\x13A\xbeF\xc7\xaf\xd7\x80X\xccv\x7f\xec\x13\xb49y8\x8d\xf7\xdd\x93\x16~\x87\xb9\xab\xa7\xdd\x1f\xd3\xbdr$#\x80\xbb2J\x9f\x9f/→˓\x8a\xe9\x17’]>

(continues on next page)

3.3. File formats 101

Page 106: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

(continued from previous page)

PSE version 4 Encrypted content

[4]: pse_v4.show()

###[ SAPPSEFile ]###version = 0x4 <ASN1_INTEGER[4]>\enc_cont \|###[ SAPPSEv4_Enc_Cont ]###| unknown = 0x1 <ASN1_INTEGER[1]>| \algorithm_identifier\| |###[ PKCS5_Algorithm_Identifier ]###| | alg_id = <ASN1_OID[’.1.2.840.113549.1.12.1.3’]>| | \parameters\| | |###[ PKCS12_PBE1_Parameters ]###| | | salt = <ASN1_STRING[’\xa4\xe5\xd9L\x81\xae\xa2\xfa’]>| | | iterations= 0x2710 <ASN1_INTEGER[10000]>| cipher_text= <ASN1_STRING[’q\x19m\xfb\x8d\x8d\xca6.\xaa\xe4>E\n\xc9:\x9f?\xe6

→˓\xbd\xee\xff\x10\xe7\x08~\xc4?!→˓P\xd8\xac\xca7\xba\xd3\x8e\xb6\xadk\xc6YM-\xcd\x86|\x8bW\xa3H\x02K\xf9\x9c\xcb\x9c\xac\xa2%\x0c\x9f\xad\xbfJ\x85M\x0c\xe4\xd8K\xe6\xca\x1c\x80\xe2\x1fKq\xedJ\xf6\xedB\xa7a\x89:\xfa\xb8J\xf61\xb0DX\xd7}\xc9Zh\xaa\xbbˆ\xfb\xe0`\xd3O\x96\xe3\x08\xad\xb8\’"\x8e\xb5\x90S\xc0\xd6r\x8ag\xee\xce\xf5\xa2\xce\x99\xc2\xcc\xcf\xd4$\x12\xeb\xbc\x95\xca`,→˓\xf8\x9e\x17ˆ\xb2\x00\x94V\x1b\xa0d\xf3\x0c\xa8\xcd\xfd?→˓m5F48O\x01\xcd4c\xb0\xd8\xb1o\xfb\x1f\xb8q\xb2\xd9\x81\xd6IZ[\xb2\xae\xe8~\x9f\xaf~\xb4a\xa5\x89\xf7\x04\nC\xa7\xa9\xcf\x02#R]\xeb&\xb75\x90\xb3\xb0\xad\xd9\\P!→˓TLz\xf0WL\xfb\xf6\xdb\x1a\xdd\xf7J\xb0\x8b\xc0@$\xd0\x9ce\xe4\x85\x00G\xe2y\x05\xca\x92ˆ\x93D[\x1b\x9d.→˓\xe2\xf19xm\x8bq\xf6J+Ur\xb0p\xac\xad\xe4&\xbc\xb7\xde\x1c\xfd\x17YE\xb36\xb3\x8cC\xf6\xc8f0G\xd6\x83o\xa1:Z%"Nv)\xa7\x88<\’\xb2\x02\xdd\x0b\xc5\xd5O,→˓\x93\xcd\xb5iY\x9f\xbbJ\x85\xdc→˓O\xeb\xe0\xb1\xcea\xd4\x94\xce\xfcx\x19\xbe\xd8\x11\xa4 \xf9\’B\xb8?→˓\x0fwC\xe9\xc3\xd07|\x9c\xd9F\xe2.→˓\x92\xc3\xb3x\xefW"\x93\x07\x80C\xe8ˆVoXD\xf9\xdd-\x8a\xb1k\xbc\xf6>=\x88K\x91H\x99o\xa2uDiux\xd4|P\x1dk+3\x96\xab\x87\x05\x10\x1d\xe9)]\xbe\xa6.→˓\x881\x19\xa0\x93\xb4\xe0,n$\xfa\x1e1M\xe7\x11\xff\xaa\x15{\x02\xb9}\x9b\x1c-)\x99P→˓xN\xaa\r\xb4\x9d\x10\x98\x90\xd7\x1b\xaa\xcb\x1f\xc9\xaba\xf7\xa0\xa4\xc1\x0e\xc3\xadqIL\xa6$%\x85\xf6\xdfj\xb8\x04Ga\xfd\xd2\xca\x18\x14\xa5a;→˓\\\x88\xae\x170aQ8R\x9fR\x03v\xab\xc3,→˓#u\xc8\xf0\x1e2\xa3v\x91\xf8en\x97\xb5\xca\xe9\xa6\xa4\x1e\x1b\xde\x9e\xd4\xd7\x7f\xc8\xa1\xb9}$\x93\x01tS\xe6\xe2\x85\xdc\x91\xd5\xc7y\x97\xb5!→˓g\x8d\xd0N\x87\xd28\xd6\x9e\xd0\xc7\t\t\xf1\xd0w\xb9t+\x87\xa7\xa3\xf7\xefZ\xb1\xdb\xdf\xbe\\Y\xb9A\x7fl\x82\xe5K\xf5\x02\x05(Q\xab\x87\xa4x\xd7*\xf1\xb2"K\xafu\x0e;→˓\xf9\x829z%\x17E\xa8$+\xb7o\x9c\x0e\x8b\x7f6I\xfd\xe4\xda\xd6\x96\xea\x89!?→˓\x90\x83\x0e\xfb\xc6<G\x1e\xd3\x84\xb3K|Il#\x9b\xfeNJ\x16\x08\xd10\xd1OP\x07\xa8\xd6h\x00\x9d\xcaIa\xf0D.→˓\xd6\xdd\xcc6\xd8ceg\xb5R\xd74\x03\x9c\xf4s\x95\xff\xb9\xcb&X\xe1\\\xb9)v\x05\x03\x9c\x1c\xb7n\x88\x1cdB(\xd6h\x11`\xd1:\xc0\xef\x04\xa0\xd4\xea|\x19u\x9a\xc30\x03\xf4\x06l\x97\x8c)j\x07\x82\xc2\xe7\xea\x07\x9c\xceˆ\xc2\x01\xb3.→˓\xa0\x1c\xb2]s\xc6\xdds\x9b\xb3\xde\xbc\xe9\x18\xa2r\x9b\xadl\x18\xcd\x8cR5wg\x88\xe5\xab{s\xed\xb7\x05\x15\xcb\x9dO\xee\xca\xd3A\x1e\xd6\xa0=\xdf\xcdX\x10Gz\x12\x9f\xa1\xcdS\xa7\x917\xf4\xb9j\x7f\x19\xf2L\x7fMe\xafw/→˓x\xe0}\xf8\xcd\xf8`\x97\xf6\x99\xdfD\xc4)|\x8e@gJ\x98\tE\xb0\xac\xf7\x11#t\xe7\xaf\xbd\xd1\x11a\x00U\x93\xe1A\x93y\x84\xab\x19f)51\x95\x89\x91\xfc\xead#\x1aRI\xcc`NE\xb3.→˓!→˓o\x8a\xb0\xcf%\xab\xf6\xc9\t\x12_\x87\tl\xb9e\xe4\x16\xfaHK}\xfe\xa3X\x1c\xfa\x1dD&\xa5\t\xd07y\xcc\xb7L\xae\x95\x86\xbc\xd0\xea\x9b\x10[\x87P\x7f\xe6.→˓\xab_\xa2k\xe0\xf2B\x9e\xd1\n\xee\xd6\x03\xd3\x83h8B|\x9e\xb3\xda\xdc\xfe1.→˓\xb8\xf8\xdd\x9eM\x16\xb3\xf9\xa9>\x8e\xbf\xf4a \xf4?→˓\xb9g\x13\xa5\xec\xa6\x987x\xfeP\x11\x8e\xb1H\x0b\xca\xd5\xeb:\xb2\x9e\xd6\\W\xa7\x10\xa1\xf98ve\xe8\xf3%\xba\xe9]Z7\x85\xa5\xed\x1e\xb6\x8e=\x18z\xaa\xf9\x91\xd7~\xfa69\xd5\x08\xd4U\xacV\x14\nˆ{\xffpG$\xae\xdbOvs\xf9\x82\xf6\x19\xe2NA\xab)|\xd9\x9e\xc3\x18\xe66S\xe1\xad\xaa\xd9\xb0c\x9d\xdfh\x0e\x97K\xab\xfc\xb4)\xef\xaf\x95\\\xfd\xafN\x03w(\’#XX\x01W\xc8m\x83\xe3\xc7G\xccf\x9d\xfc\xa3\x95q,→˓\xe6\xc4Usm\xadh\xdc\xb8\xbbK5H\xb9\nu(r!→˓\x1e\x98\xd3C\xe4\x06+\xcf\x0b\xbfY\x94\x13>\x0c\x80:\x91\xe3\xa8~\x89\x04Y\x9d\x04\x9e\x8e\\\xbd\xd54f\x99\x0f\x0fS\xfd0\xa2\xaa\x9cS\x95\x8e=\x02\xf9\xca\x12\xe1\xdcH\\\x82d\xefq\xe0K,→˓:!\xaaJ\x1c\xd6%\x8c\xebnn\xa5\x9b\xee\xfb\xd82{\x94\xf0\xff\x90\xd2W$Q\x1e\x8bZ.→˓)\xbeo\xda\xebA;→˓\x18\x9a\xa2r]\xa7\xc2\xb7\xa5\x0f=\xc3\xb8\x00\xc5So)j\xc4L\xf9G\xeb\x96\x83\x9d\xdb\x8b\xa7{\xed\xb4)\xc1\xe0\xe2X[\x9a\xeb\xcf\xa6\xfd\xb8\xe2A\xcd,→˓\x1d]\xce\xab\xd9\xb9\xae\xbe\xd9g\x9bB\x90\xb5p%_\xac\xd0\x9d\xa3A\xfa\xa5\x8bOB\x0b\x90\x04\xa69\xaa"\xfc8\x0b\x91\xb0\xb9~\xbe\xb6q\xf0\x01\xbeWOZ\xf9=6Q\xc6\xe5\xef\n\xd5oP\xcc\x156\x0es\xc3\x14#\x850\x92\xba\x0e\xd0\x1epey\xc7\xe9\t\xa8\x95\xa1k\x87&k\x15x\xf5x3r"\xb7K\x15yo\x0e\x0c\xd81\xa1#\x94&4\xfd\xa3\x9dO\x12o\x9e1f\x03G\xc5\xcf\x9b\x06\x1c\x8b7\xa9\x078C&\xa3\xd6\xfe\xc9\xef\xf3\xbdn8\x9bvb\xd4\xe3:\xcf\xe6\xc2\xc3\xa3\xacb\xe0a\xec\x80\xef\x80\r4\xdd,→˓\xf7\x97?\xe8\xefj\x11\xf1N,→˓\xb3\xb6\x01\xd7\r\xfcia\x94b\x94\xa8\xebA\xaf\xfa1\x98]|$27_\x81&\xb4\x12\x07mZ\x9f\xa8\xcd\x08\xffC$\xcf\x92|\x7f\xb5\x9d7\xc2[→˓\xec\xa1\xc2wu\x84e\x03\xd0\x8c:\xf0CK\xc3\xef\xbc\xa2\x1e\xbd=3t!→˓-\xdel9\xab\x8fU\xa5\xa9`|\x1d\xe3\xc9\xe8\xff\x93\xfb\xe7\x94\xcd{\\I\xf9A\x1b\x8c\xf7\xca\xc55\x13F{\x83k\x9d:v\x90\xe6\xce\x088rx8\x0eaF\xb64\x8e\x0b\xa1\x19\x97c\x81\xd4\xe9\x87%\xc8Q\x85\x0e\xd4t\xc3t{LhPa\xc5v3k\xaf\x13q\x1f\x13\xfc\xaa\xa6L\xd8\xb9\x1bT\xdb\xb1\xdf\x9cK>AE\xdcd\xaa\xcf-\xb2)\x06+b\x1aX\x88B\xf1S\x8c\x818"\x80\x12!→˓\xc3\x98\xa5\xb4\x04r\xb1v\xfc\x97\xf6\xbf\xf7\x15[AU\x0e\xc3_\xea\xaf\xc7\xfe@\xf8=Y\xf4S]\x11\x10\xe5Q\x0f\xb8\xe5K\xed\xbaP\xc8\xefK\x0e\xdanb\xf5\xd8\xbb-!→˓2\xe4\xa7\xd1?→˓\x02z\x9cG{\x9f\x03\xb2\x7f\xad\x02$J\x00\xf1\xc1\xb8Ie\xac_~\x95\xb5\x95\xcd\x8cU\x0e\x9eIA/→˓\xd4\xd0mk|[\nf7\xcb+\x9b\x99\xd58\xac\xb4\xf6\xc6!→˓(\xd5\x99\x7foj)H\xa2\x93\xe3\xa6\x16\xb6C\r\x15W\xdc\xab\x94$\xbd\x03\x98\xbd\xee\x9b\x9a\xd3\x9e\x17\xfb\xf8\xba\xc8.→˓l\x19\xae\x96\x1f\xac\xa1\xbb\x0b\xc0\xaf\x9aC\xf6\n\\\x05\xd5\x00\x81\xb3;→˓\xf4ot\xae\xda\xd7OhQ\n\x9d\xb6S\xc1\x92\x1a\x92\x87\xf0\x0e\xe8\xeb\xad\xb9\xd6\xb8\x83>\x9e\xdb*\x98\x89G9\xf7C\x02g\xd1\xa0\xcb\x0cSHKvB\xc3\x11\x9f\xf7→˓\xbd\xcc\xea\xfd7\xb7\x9bR\xb5\xfftv\xdb\x07w\xa8O\x97e\x95\xb2~L\xd4\xf5\x19\x7f\x89B\xf0\xd4\x14<\x06\xb5*\x0eC\xf9\xb3\xb9\x06p\xfc\xa7\xf1e!→˓\xee\x175\x1c\x10\xdd\x85\xc4\xa0\x93p\x1b\xceY\xdb\x7fh\xd9\xa6\xfd+1"\xc1\xe8m\xc9\x06\xcdu\xfb\xa3\x93+U\xcf\x00pP\x05r\x8a\x04<\x8c\’\x90o\xc8r>\x99+L\x9a\xf5\x82\\\xa0\xfc\xf7\xfdZ\x94\x9el\x14,→˓\xadR\xf8\xdc\xb2\x8d\xfa\xc8\x16\xca\xe8\x0c\x98\xcf=ˆe\x9f{\x81\xe4Q\x0f\x1e\x8d\xd9\xad\x1e\xb0\xbftrr\x88\x1a\xf1_\’\xc1\xec\x13<\xb4=\xa07\x19\xa3\xbb\xcd\xeb\xe9\xa1\xe0\xa6\x82$!→˓\xb1\x05\xd8"\x98+J\xb8\xffF6\xdc0\xe4\xe81W\xf0hˆ\x15\x9f5{\xbe+\x0fNu\x8f\xf6r\x1c\x1bE\x82\x05\xfe!→˓\xb7\x83\x1e!\xd6\xea\xecRW:\xea\x04\x1bL*\xec\x84\xac\x12\xc6Y\xf8\xb2\xb3O\xae;→˓x$\x84\xad\xff*\xba:\xbd\x08|\xdf\x95w\xff\xed*\xac\xeac{V\x95\xae\xda\xf6\xcf\xfa\xff\r0r\xf6P\xa6x\xae%\x8fk\xd9\xe6\x8d&\x1ar\xc6\x03\xf6\xcaX\xea\xd8E\xa5\xb2\x88\xb4\xb7xU\xb6`h\xdbg\x1f\xb1\xe8\x8coP\x0b\xd3\xfch\x0bX/→˓&(NF\x9b\x1eT\xa0\x07\x8c?\xf8\xef\x12F\xf31\xe3sz\x9e7\xe7(\xa0\xa5\x82eI3\xbe,,→˓\xa3\x95,→˓\x9b\xfc\xa6kJ<\xa2\xe9\x065\x11\x9e\xc3w\xa2s\xeaQ=8\x83z\xf0N\x90\xf11f\xe1I\xba\xed\xfb\x02\x0f5-\x80p\xec\x08@\xf32\xbcTe\xf0\xf3f\xc6\x82\x83xnsJKy>XS\xb4\x85)w~\xf6\xe4\x8c\n}\x12\xc0j\x85\xc9sH\x05Mk\x05h\xff\xa4\x1c:>\x0c\xa5\xbf!→˓s\x86s|\x96\x98B\xbe\xd0r)\xd9\x90\x1c\x13\x07n\x9b\xc8\x19\xfe\x87\xad\xe8\xe2\n\xa5`(%\xb8]92\x87\xb0\x9e\x8f\x07\x8ff\xfc\xb6\x86\xf6}M\x95\xdd/→˓]\x0c\x88\xc5\x1c\xb6\xe9\x8du\xf1\xa2ˆ\t\xe0\xa1\x9d\xf2\xbdPY\xef\xbc1\xb5\xad\xbdi\x96\xfd#\xf9\x02\xfd\xa58\x03\x9fn_\xb7\x93\x99[~\xe3!→˓\x96\x9c\x86\xd5es\xb0\x9c\x1eG\t8\xf9h\xc4$O\x81\xa2&\xdb\xfd\xe2\x8c|\x9d\x14\x15\xadA\xeeD\xdaQ\x19\xfc\x96_/→˓5\x1a",→˓\xff\xc0ZQ\xfd\x9bV6\x16\xb6\xb8\xcf\x87\xac}IN\xfaZ\xfc\xaa\x08b\xc6\x1b\x8a:\xce\xe3\x07\xcd\x03|\x00\xba\xd1\xb5\xee\x1f\xf6\xfd_\xa2\x1a\xba\xbc\x8f\x85\xa6\xd1\x9c\xe1\x9cJ:V\xef\x8d\x9eI\xc2\xf6J\xed-\xda\xb2\x89\xa3\xe6z\xeet\x0e\x94g\xf8→˓~\xe8g\xa5%.→˓\xa0\x1b\\\xf4\xd6c\xe4Jb\x82\x9f7c86\xa9\x87\xa2O\xfd\xee\x9f\x08H\x7f\xea\xb5U70\x0f\x9b\x0e$\xd0C\’\x7fW\xf5\xcf\xcc\xd1\xca\xa8@\xa8\xd6\x8b\x00\tkN\xc9\xa8d\x1a\xa2\x95\xbf\xcdw\x89\xd7\xa8\x02\xdd\xb0\x1d\x96\x8f\x84\xe59L;→˓\x04\x1c\x85\xc2\x07\x0cQ\xe4\x89\xbd\x96\x07\xac\\\xec\xec6\xbe\xed\x03\xc1\xb4\xc2\xd6\x8a\xe8R\xccXJ\xf6\xd9\xe2\x8c\x1e\xa8\x9c\r\xd7\x1c\x0e\xc58\x16\x17\xcaV\x1e\xe1vl\xc8\x1bM\xf5\x00\x0c\x11\x81k2j\xff\xb1\xff\xbe\x0b\x92)"Q\xb6\x10\xf0\xd0cLh\xd3%\r\x15\x82\ng\x07\xbd\x9c,→˓\x06w\xbb\xca\x9e\x8a\xcb\xd3\x9e/\x9cR}\xcd\n\xbdYyC\xfe\xd7→˓VM\xcc\x89Q\xa5\xda\xcd\x9d\xc3’]>

(continues on next page)

102 Chapter 3. User guide

Page 107: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

(continued from previous page)

| encrypted_pin=→˓<ASN1_STRING[’\xc7H\x99p}*\x9e\xbd\xb5\x0fK\xd6X\xc0\xe6Cy\xe3\xc4\xbb’]>

PSE Encrypted content decryption

The content of the PSE file can be decrypted given the proper PIN is provided.

[5]: pse_v2.decrypt("1234567980")

[5]:→˓'0\x82\n\xc30\x1c\x06\n*\x86H\x86\xf7\r\x01\x0c\x01\x030\x0e\x04\x08w\xcbi\x08\xbe\x86\x08e\x02\x02\→˓'\x10\x18\x0f20180218185308Z\x02\x01\x011\x82\n\x8d0\x82\x01C\x13\x05SKnew\x18\x0f20180218185308Z\x06\x05+→˓$\x02\x03\x040\x82\x01→˓0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03\x82\x01\r\x000\x82\x01\x08\x02\x81\x81\x00\xfa*T\xaaG\xf8\x17\x9a\x87→˓{\x11\xf2\x0b\x04\xbe\xf8M\x86\xa8\xb0>\x9f\x16\x12\xb1\xd6\xc4\xf8\x11o P?→˓\xea\xde\xf5\x06n\xed\x1d\xb8\x04\x1b%,→˓\x07\xea\x8d\xa1\x06(\x05X\x08s\xec|\x91\xa4P\xc9\x1c\x0c\x13\x12\xdd\xce\xba;→˓3u\xe7\xfcjE\xad.\x12\xe8\xfdh\x8fv\xe4\xe6\xff\xcbO?→˓\xd2\xe1u\xe7\xe3\x17\xa9\xb7\xba\xef@\xa6\xcd/→˓\xe0Vi\xfd\xdfz\xe5\xd7\x17\x96\xec\xce\xc1\xfe\x9f\xcf\xa7\x9a\xe0tk\xe3\x1a\x18u\x02\x81\x81\x00\xd8VD\xb4\xe7\x8d\x08\xea\xab0\xbc\xe4tX\x13\xba\xf7u\xb0a\x9dcK\xc0\xab\xef\xad\xdf\x89\x84\xeaE\x12O[\xd0Xw\xde1\xfb.→˓\xf3\x8f\xbd\xae\xb7g\xc9n\xeb\x15\r"H\xd9D{\xc1\x95l\x1doZ\x96\x15B?~→˓\xae\x7f\xdb\x06\xc0\xf3\r\xff\xc7\x8f\x1f\x81E\xfbM!T\x138\xb1&\xa2>→˓\xf9\x00\x13*\x829|\xab\x1f\xbb8\xb0\x8a&\x97-7G\xfcL\x11/→˓\xa9\xf8\xa8\xbc@r\xc3\xc6`\xe3\xbbw\x94A0\x82\x02\xfd\x13\x06PKRoot\x18\x0f20180218185308Z\x06\x05+→˓$\x02\x05\x010\x82\x02\xd90\x131\x110\x0f\x06\x03U\x04\x03\x0c\x08PSEOwner0\x82\x02n\xa0\x03\x02\x01\x02\x02\t\x00\x8c:\r\xbegY→˓#T0\x82\x01→˓"0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03\x82\x01\x0f\x000\x82\x01\n\x02\x82\x01\x01\x00\xd3h\x04\xcc→˓$tH\x87\xbeJ\x1d\x0b!Y\x9cI\xaf\xf7→˓{\xe3\x83\xe9\x8b\xc0p\xe0\xbd\x9e\xaf\x9c\xf8\r@\x13P\xfa\xf9\xc5%q\x96\x98m;→˓\x94\x9e0\x1d\x15\xa7A\x82K\xc1\x1d\xe8u\x92\x1b\x18|\x9c\xf5u\xf7H\rn}→˓a:60|1\xdf\x95UKa\xe5\x10→˓<x\xe6\x8a\xa8\x83\x05[\x1c\xf7]\xe0\xd6\xa43\x14\x9a\xf4\xe3a\xf2\xcd\x9d\xd3G\xe9o=\xd4:tw\xbd~→˓E\xdfhv\xd3\xdcq|/\x0f\x8a\xa7H\x9fe\xb1\x01\xc1\x8c\x9c=\xc3\xcb\x96\x89"W}→˓Z\xd9\xae\xf3\xba\xdf\xd7\x94\x00\x1f#\xc0K\xc3\x1f$\xad\x8a\xdf\xef;→˓S\xdc\xe9\x00\xae4\xde\xd1\xf6\x04<3\xe3PRr>K\x04\xc1\xfe\xbfo\xb5\xd3\x01[\xf5.→˓]\xbe9\x83\xa1\x9a\x92Uyz\x19\xce\x8eS\xcc\x19y\xe9\xa5\xd37f\x04→˓\xc8\x1aX\x0eMX\xdb\x0cl\xdb\x80\xad;][\x00\x9d\xc87\xb0i\xcf\xe6>#\xca\x1fq\xee76→˓$\x1fm\x95&\xd9\xb5\x02\x03\x01\x00\x01\xa1→˓0\x1e\x17\r180218184835Z\x17\r190218184835Z\xa2\x0f0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x00\x03\x82\x01\x01\x00\xa0\x86\x1e\xf70P\x86\x02~→˓\x9a \xe7\xa52w=8?\xf0\xf1y\\\x0c\xec}!,\x15di.→˓c\xf3\xdc\xd2\xa9\x9bk\xd3\x19\xf4\xa7?\xf9\xd0\xce\x01IK\x80\xc1\xdb\x9d\x9f.\xffv,→˓}\x85\x18\xb0\xc8\xda\xd55\x80\x05\x936\x0f$fO\xf2\x8a\xe7)G\x7f\x9cN-→˓\x9c\xe9b9\x0f\xec\xe6\xe6\xf6g4!\xe3Tm\n0\xa6}\x19\x95IV\x04\xa3\x80]b\x99;→˓T`\xc7\x94\\\x17\xce\x18\x03\xde2\x8c=u\x9d\xa0\xc4}→˓\x1e\x86X\xcb\xc9\xe8\xca\xe6\x904\x14\xa5\xbc9\xb0\x82Z^\xbc→˓s\xe3v\x95x\xb0\x86\x14\xa8\xb7\x1b\x18b\xe9E\x9ft\x10\x19\x05W\x8e\x03\r\xdc\xe2z\x97\xc1\xad\x99\x89i2+FK\x99\x06\xf1\x18\n>→˓\xb0z\x04\x95g6e\xc8\xa8\x93\x94\xc3\x01\xbc\xbb\xf7\xb7\x9eu\xb5&→˓\xb4\x99\x00\xfc\x9e*_l_(+G\x03T\xaf\x14\x82\xd2n→˓<Z1\tZ\n\xa9d\xc2\xc2M\xbe\xe0c`HG\x958\xc2\xd4\xa5\xa0P0N0\x1d\x06\x03U\x1d\x0e\x04\x16\x04\x14]\x85\x94hf\x82\x14D\xfe\xd9\x11K\x99\x17\x8a\x8a\x97\xe0LD0\x1f\x06\x03U\x1d→˓#\x04\x180\x16\x80\x14]\x85\x94hf\x82\x14D\xfe\xd9\x11K\x99\x17\x8a\x8a\x97\xe0LD0\x0c\x06\x03U\x1d\x13\x04\x050\x03\x01\x01\xff0\x82\x03\x1b\x13\x04Cert\x18\x0f20180218185308Z\x06\x05+→˓$\x02\x01\x030\x82\x02\xf90\x82\x01\xe1\xa0\x03\x02\x01\x02\x02\t\x00\x8c:\r\xbegY→˓#T0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x000\x131\x110\x0f\x06\x03U\x04\x03\x0c\x08PSEOwner0\x1e\x17\r180218184835Z\x17\r190218184835Z0\x131\x110\x0f\x06\x03U\x04\x03\x0c\x08PSEOwner0\x82\x01→˓"0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03\x82\x01\x0f\x000\x82\x01\n\x02\x82\x01\x01\x00\xd3h\x04\xcc→˓$tH\x87\xbeJ\x1d\x0b!Y\x9cI\xaf\xf7→˓{\xe3\x83\xe9\x8b\xc0p\xe0\xbd\x9e\xaf\x9c\xf8\r@\x13P\xfa\xf9\xc5%q\x96\x98m;→˓\x94\x9e0\x1d\x15\xa7A\x82K\xc1\x1d\xe8u\x92\x1b\x18|\x9c\xf5u\xf7H\rn}→˓a:60|1\xdf\x95UKa\xe5\x10→˓<x\xe6\x8a\xa8\x83\x05[\x1c\xf7]\xe0\xd6\xa43\x14\x9a\xf4\xe3a\xf2\xcd\x9d\xd3G\xe9o=\xd4:tw\xbd~→˓E\xdfhv\xd3\xdcq|/\x0f\x8a\xa7H\x9fe\xb1\x01\xc1\x8c\x9c=\xc3\xcb\x96\x89"W}→˓Z\xd9\xae\xf3\xba\xdf\xd7\x94\x00\x1f#\xc0K\xc3\x1f$\xad\x8a\xdf\xef;→˓S\xdc\xe9\x00\xae4\xde\xd1\xf6\x04<3\xe3PRr>K\x04\xc1\xfe\xbfo\xb5\xd3\x01[\xf5.→˓]\xbe9\x83\xa1\x9a\x92Uyz\x19\xce\x8eS\xcc\x19y\xe9\xa5\xd37f\x04→˓\xc8\x1aX\x0eMX\xdb\x0cl\xdb\x80\xad;][\x00\x9d\xc87\xb0i\xcf\xe6>#\xca\x1fq\xee76→˓$\x1fm\x95&→˓\xd9\xb5\x02\x03\x01\x00\x01\xa3P0N0\x1d\x06\x03U\x1d\x0e\x04\x16\x04\x14]\x85\x94hf\x82\x14D\xfe\xd9\x11K\x99\x17\x8a\x8a\x97\xe0LD0\x1f\x06\x03U\x1d→˓#\x04\x180\x16\x80\x14]\x85\x94hf\x82\x14D\xfe\xd9\x11K\x99\x17\x8a\x8a\x97\xe0LD0\x0c\x06\x03U\x1d\x13\x04\x050\x03\x01\x01\xff0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x00\x03\x82\x01\x01\x00\xa0\x86\x1e\xf70P\x86\x02~→˓\x9a \xe7\xa52w=8?\xf0\xf1y\\\x0c\xec}!,\x15di.→˓c\xf3\xdc\xd2\xa9\x9bk\xd3\x19\xf4\xa7?\xf9\xd0\xce\x01IK\x80\xc1\xdb\x9d\x9f.\xffv,→˓}\x85\x18\xb0\xc8\xda\xd55\x80\x05\x936\x0f$fO\xf2\x8a\xe7)G\x7f\x9cN-→˓\x9c\xe9b9\x0f\xec\xe6\xe6\xf6g4!\xe3Tm\n0\xa6}\x19\x95IV\x04\xa3\x80]b\x99;→˓T`\xc7\x94\\\x17\xce\x18\x03\xde2\x8c=u\x9d\xa0\xc4}→˓\x1e\x86X\xcb\xc9\xe8\xca\xe6\x904\x14\xa5\xbc9\xb0\x82Z^\xbc→˓s\xe3v\x95x\xb0\x86\x14\xa8\xb7\x1b\x18b\xe9E\x9ft\x10\x19\x05W\x8e\x03\r\xdc\xe2z\x97\xc1\xad\x99\x89i2+FK\x99\x06\xf1\x18\n>→˓\xb0z\x04\x95g6e\xc8\xa8\x93\x94\xc3\x01\xbc\xbb\xf7\xb7\x9eu\xb5&→˓\xb4\x99\x00\xfc\x9e*_l_(+G\x03T\xaf\x14\x82\xd2n→˓<Z1\tZ\n\xa9d\xc2\xc2M\xbe\xe0c`HG\x958\xc2\xd4\xa50\x82\x03→˓"\x13\x08CertList\x18\x0f20180218185308Z\x06\x04+→˓$\x02\x001\x82\x02\xfd0\x82\x02\xf90\x82\x01\xe1\xa0\x03\x02\x01\x02\x02\t\x00\x8c:\r\xbegY→˓#T0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x000\x131\x110\x0f\x06\x03U\x04\x03\x0c\x08PSEOwner0\x1e\x17\r180218184835Z\x17\r190218184835Z0\x131\x110\x0f\x06\x03U\x04\x03\x0c\x08PSEOwner0\x82\x01→˓"0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03\x82\x01\x0f\x000\x82\x01\n\x02\x82\x01\x01\x00\xd3h\x04\xcc→˓$tH\x87\xbeJ\x1d\x0b!Y\x9cI\xaf\xf7→˓{\xe3\x83\xe9\x8b\xc0p\xe0\xbd\x9e\xaf\x9c\xf8\r@\x13P\xfa\xf9\xc5%q\x96\x98m;→˓\x94\x9e0\x1d\x15\xa7A\x82K\xc1\x1d\xe8u\x92\x1b\x18|\x9c\xf5u\xf7H\rn}→˓a:60|1\xdf\x95UKa\xe5\x10→˓<x\xe6\x8a\xa8\x83\x05[\x1c\xf7]\xe0\xd6\xa43\x14\x9a\xf4\xe3a\xf2\xcd\x9d\xd3G\xe9o=\xd4:tw\xbd~→˓E\xdfhv\xd3\xdcq|/\x0f\x8a\xa7H\x9fe\xb1\x01\xc1\x8c\x9c=\xc3\xcb\x96\x89"W}→˓Z\xd9\xae\xf3\xba\xdf\xd7\x94\x00\x1f#\xc0K\xc3\x1f$\xad\x8a\xdf\xef;→˓S\xdc\xe9\x00\xae4\xde\xd1\xf6\x04<3\xe3PRr>K\x04\xc1\xfe\xbfo\xb5\xd3\x01[\xf5.→˓]\xbe9\x83\xa1\x9a\x92Uyz\x19\xce\x8eS\xcc\x19y\xe9\xa5\xd37f\x04→˓\xc8\x1aX\x0eMX\xdb\x0cl\xdb\x80\xad;][\x00\x9d\xc87\xb0i\xcf\xe6>#\xca\x1fq\xee76→˓$\x1fm\x95&→˓\xd9\xb5\x02\x03\x01\x00\x01\xa3P0N0\x1d\x06\x03U\x1d\x0e\x04\x16\x04\x14]\x85\x94hf\x82\x14D\xfe\xd9\x11K\x99\x17\x8a\x8a\x97\xe0LD0\x1f\x06\x03U\x1d→˓#\x04\x180\x16\x80\x14]\x85\x94hf\x82\x14D\xfe\xd9\x11K\x99\x17\x8a\x8a\x97\xe0LD0\x0c\x06\x03U\x1d\x13\x04\x050\x03\x01\x01\xff0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x00\x03\x82\x01\x01\x00\xa0\x86\x1e\xf70P\x86\x02~→˓\x9a \xe7\xa52w=8?\xf0\xf1y\\\x0c\xec}!,\x15di.→˓c\xf3\xdc\xd2\xa9\x9bk\xd3\x19\xf4\xa7?\xf9\xd0\xce\x01IK\x80\xc1\xdb\x9d\x9f.\xffv,→˓}\x85\x18\xb0\xc8\xda\xd55\x80\x05\x936\x0f$fO\xf2\x8a\xe7)G\x7f\x9cN-→˓\x9c\xe9b9\x0f\xec\xe6\xe6\xf6g4!\xe3Tm\n0\xa6}\x19\x95IV\x04\xa3\x80]b\x99;→˓T`\xc7\x94\\\x17\xce\x18\x03\xde2\x8c=u\x9d\xa0\xc4}→˓\x1e\x86X\xcb\xc9\xe8\xca\xe6\x904\x14\xa5\xbc9\xb0\x82Z^\xbc→˓s\xe3v\x95x\xb0\x86\x14\xa8\xb7\x1b\x18b\xe9E\x9ft\x10\x19\x05W\x8e\x03\r\xdc\xe2z\x97\xc1\xad\x99\x89i2+FK\x99\x06\xf1\x18\n>→˓\xb0z\x04\x95g6e\xc8\xa8\x93\x94\xc3\x01\xbc\xbb\xf7\xb7\x9eu\xb5&→˓\xb4\x99\x00\xfc\x9e*_l_(+G\x03T\xaf\x14\x82\xd2n→˓<Z1\tZ\n\xa9d\xc2\xc2M\xbe\xe0c`HG\x958\xc2\xd4\xa5\x01\xcc-z\x9e\x8f\xeb0\x1e'

(continues on next page)

3.3. File formats 103

Page 108: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

(continued from previous page)

3.4 Example scripts

This part of the documentation covers the example scripts provided with pysap.

3.4.1 Diag Example scripts

diag_capturer

This example script can be used to grab SAP GUI login credentials from a pcap file or by directly sniffing on anetwork interface. The SAP Diag protocol packets are parsed and processed to obtain login credentials from the loginform submissions. Identification of the password field is performed by means of looking at the “invisible” propertyused by SAP to denote password or other sensitive fields that should be masked by the SAP GUI.

diag_dos_exploit

This example script can be used to tests against Denial of Service vulnerabilities affecting the Dispatcher service.Currently 5 different vulnerabilities can be triggered:

• CVE-2012-2612

• CVE-2012-2511

• CVE-2012-2512

• CVE-2012-2513

• CVE-2012-2514

diag_interceptor

This example script is aimed at demonstrating the use of the SAPNIProxy and SAPNIProxyHandler interfaces.It can be used to establish a proxy between a SAP GUI client and a SAP Netweaver Application Server and inspectthe traffic via the filter_client and filter_server functions.

The given example implements a simple function that grabs input fields sent by the client and prints them.

diag_login_brute_force

This example script can be used to perform a brute force attack against a SAP Netweaver application server. Thescripts performs a login through the Diag protocol, by submitting username and passwords to the login screen. It canalso be used to discover available clients.

Usernames, passwords and SAP clients to test can be provided as individual files (using --usernames,--passwords and --clients command line options), in which case the script will calculate and test the combina-tion of those, or provided in a credentials file (via the --credentials parameter). The credential file is expected tohave a format containing username:password:client and blank lines or lines starting with the # are ignored.

Clients discovery can be also performed as a firs step of the brute-force attack, by specifying the --discoveryoption and providing a list of clients to test using the --discovery-range parameter.

104 Chapter 3. User guide

Page 109: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Testing of the credentials can be performed using multiple parallel threads using the --threads parameter as a wayto increase performance.

A list of default credentials and their associated default clients is also provided in the examples/default_sap_credentials file. This credentials file can be used to perform basic checks.

Note that as error responses might vary across versions it might be possible that the script generates false positive.In addition, it should be noted that there’s no mechanism implemented to prevent the lockout of user accounts if theserver is configured with a lockout policy. Use with care and at your own risk.

diag_login_screen_info

This example script can be used to gather information provided by a SAP Netweaver Application Server during thelogin process. This information includes generally hostname, instance, database name, language and other technicalinformation about the application server.

diag_render_login_screen

This example script is a proof of concept of how the library can be used to obtain and interpret the screen componentsand fields provided by an SAP Netweaver Application Server. It takes the login screen presented by the applicationserver and renders it using wxPython widgets and user interface components. Take into account that not all fieldtypes and Diag protocol packets are completely implemented in the library, and that those change from version toversion.

diag_rogue_server

This example script is a proof of concept that implements a rogue server using the SAP Diag protocol. It offers usersa customizable login screen and gathers credentials provided by the clients connecting to it. A basic interaction isimplemented that allows for the user to introduce the credentials and then returns a generic error message.

Tested with SAP Gui for Java 7.20 Patch Level 5 running on Ubuntu.

3.4.2 Download Manager scripts

dlmanager_decrypt

This example script extract SAP’s Download Manager stored passwords. For SAP Download Manager versions before2.1.140a, stored passwords were kept unencrypted. For versions between 2.1.140a and 2.1.142, the scriptshould be able to decrypt the password given possible to obtain the machine serial number.

The input of the script is the file stored by the SAP Download Manager program, which uses the Java serializationencoding.

The script can attempt to retrieve the machine serial number when running on Windows, if provided withthe --retrieve-serial-number option. For other platforms it must need to be provided by the--serial-number parameter.

For more details on the encryption mechanism see CVE-2016-3685 and CVE-2016-3684 documented in the SAPDownload Manager Password Weak Encryption security advisory.

3.4. Example scripts 105

Page 110: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

dlmanager_infector

The SAP Download Manager infector script is a proof of concept to demonstrate the risk of not validating SAR filesignatures. The script can be used to infect a given SAR v2.00 or v2.01 file by means of adding new files to it. Eachfile to infect is specified by a pair: filename (original filename) and archive filename (the name we wantinside the archive). The script can also be used to dynamically infect SAR files being downloaded using mitmproxy.In that case, the scripts takes the files to inject as parameters, performs an SSLStrip-like MitM and when identifiesa SAR file that is going to be offered as a download it infects it.

For more details about the exemplified attack vector see the Deep-dive into SAP archive file formats presentation atTroopers’ 2016.

3.4.3 Enqueue Example scripts

enqueue_dos_exploit

This example script can be used to tests against a Denial of Service vulnerability affecting the Enqueue service (CVE-2016-4015). For more details about the vulnerability see ERPScan’s Security Advisory.

This example script was contributed by Vahagn Vardanyan.

enqueue_monitor

This script is an example implementation of SAP’s Enqueue Server Monitor program (ens_mon). It allows themonitoring of a Enqueue Server service and allows sending different admin commands and opcodes. Includes somecommands not available on the ensmon program.

The script implements a console-like interface that can be used to specify the operations to perform on the EnqueueServer. A list of implemented commands can be obtained by running help.

3.4.4 Gateway Example scripts

gw_monitor

XXX

3.4.5 Internet Graphic Service Example scripts

igs_http_imgconv

This example script demonstrate the use of the IGS interpreter IMGCONV through HTTP listener to convert a providedjpg file to the png format with a 100x100 size.

igs_http_xmlchart

This example script demonstrate the use of the IGS interpreter through HTTP listener to generate a simple chart. Theinput of the chart is provided in XML format and the script will print the generated charts’ URLs.

106 Chapter 3. User guide

Page 111: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

igs_http_zipper

This example script demonstrate the use of the IGS interpreter ZIPPER through HTTP listener to compress an inputfile to a zip file. The script will print the generated zip files URLs.

igs_rfc_zipper

This example script demonstrate the use of the IGS interpreter ZIPEER through RFC listener to compress an inputfile to a zip file.

3.4.6 Message Server Example scripts

ms_change_param

This example script changes a parameter using SAP Message Server Administration requests. In order to be able tochange a parameter the Message Server should be configured in monitoring mode (ms/monitor=1, see correspond-ing help for more details) and the internal port should be reachable. Keep in mind that some of the parameters arenot “dynamic” and can’t be changed using this method. If the parameter value is not specified, the script retrieve thecurrent value.

ms_dos_exploit

This example script can be used to tests a Denial of Service vulnerability affecting the Message Server (CVE-2017-5997). For more details about the vulnerability see ERPScan’s Security Advisory and SAP Security Note 2358972.

This example script was contributed by Vahagn Vardanyan and Mathieu Geli.

ms_dump_info

This example script provides a way to dump different type of configuration and parameters about an SAP’s instancemade available via the Message Server service. The script connects to the internal port of the MS service (by default39NN) and by running the dump command it will obtain the configuration values.

The following is an example result of running the command:

$ examples/ms_dump_info.py -d XXX.XXX.XXX.XXX -p 3901[*] Connected to the message server XXX.XXX.XXX.XXX:3901[*] Sending login packet:[*] Login OK, Server string: MSG_SERVER('[*] Sending dump info', 'MS_DUMP_CON')-------------------------- dump of mscon table -----------------------------

NR ADDRESS > Unique key FIHDL NEXTREQ NEXTREP----------------------------------------------------------------------------

#entries = 0

('[*] Sending dump info', 'MS_DUMP_PARAMS')

Release = 753Release no = 7530Build version = 753.2017.08.01System name = SYS

(continues on next page)

3.4. Example scripts 107

Page 112: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

(continued from previous page)

Instance name = ASCS01Trace level = 1Trace logging = active (52428800)Trace logging string = on, 50 mcomment = message server SYSstart time = Fri May 3 07:14:19 2019start time (seconds) = 1556892859up time = 0:30:35 (1835 secs)build time = Aug 18 2017 23:27:38build with Unicode = TRUEbuild with Threads = TRUEsystem type = AMD/Intel x86_64 with Linuxsystem id = 0x186server host = sapserverserver host (fqn) = sapserverserver addr = XXX.XXX.XXX.XXXserver service = sapmsSYSserver port = 3601server service (internal) = 3901server port (internal) = 3901use unix domain sockets = TRUEJ2EE send notification = message/requestJ2EE advanced login = onJ2EE broadcast time = 0/Wed Dec 31 16:00:00 1969J2EE reconnect support = 1ms/timeout = 5000ms/timeout2 = 10000ms/conn_timeout = 300ms/max_sleep = 20ms/sapevt_lb = 0ms/keepalive = 300ms/max_clients = 600ms/ext_client_quota = 50#clients = 2#clients external = 0ms/max_counter = 100ms/max_vhost = 16ms/audit = LOGIN/OUT (0x1)statistic activatedms/max_queue = 600ms/warn_queue = 5ms/cache_check = 900cache count = 0cache size = 10allocated buffer = 2ms/max_open_requests = 10000#max_open_requests = 0ms/server_port_0 = PROT=HTTP,PORT=8101,TIMEOUT=20,PROCTIMEOUT=60ms/http_port = 8101http state = LISTENms/https_port =https state = INITms/http_lookup = 1ms/http_domain = TRUEms/http_timeout = 20ms/http_proctime = 60ms/http_bufferln = 65536

(continues on next page)

108 Chapter 3. User guide

Page 113: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

(continued from previous page)

ms/redirect_version = 1ms/http_max_clients = 500ms/http_max_ports = 20ms/http_enable_handler = TRUEms/http_handler_retry = 10ms/http_handler_timeout = 60ms/http_was_required = FALSEms/url_fqn = 1is/HTTP/default_root_hdl = abapis/instname_encoding = none#http client = 0#https client = 0

ms_dump_param

This example script connects to the internal Message Server port and retrieves the SAP’s instance profile parametersconfigured and available to the service. While similar to ms_dump_info, instead of just dumping the values it willallow for performing checks against a defined set of expected values. The list of expected parameters and their valuesshould be provided in a file with the following format:

#<SAP parameter>:<check type in [FILE|EQUAL|NOTEQUAL|INF|SUP|REGEX]>:<expected value>

The supported check types are:

• FILE: The parameter defines an external configuration file.

• EQUAL: The parameter is compared with an expected value and checked if equal.

• NOTEQUAL: The parameter is compared with an expected value and checked if not equal.

• INF: The parameter is compared with an expected integer value and checked if inferior.

• SUP: The parameter is compared with an expected integer value and checked if superior.

• REGEX: The parameter is compared against a regular expression and expected to be matched.

A set of of default recommended values is provided in examples/list_sap_parameters but each user shouldcreate their own set of expected values. The script can be used then to create a baseline configuration and automatethe validation of a set of Application Servers against it. It’s worth noting that due to the way parameters are storedand made available to the Message Server service there might be false positives. Additionally, configuration storedin external files (e.g. ACL files, secinfo, reginfo) need to be checked by other means as the script will onlypoint out the location of the file but not it’s content. Other dump commands might be helpful as to obtain those valuesprogrammatically, check the output of ms_dump_info for more details.

The following is an example result of running the command:

$ examples/ms_dump_param.py -d XXX.XXX.XXX.XXX -p 3901 -f examples/list_sap_parameters[*] Initiate connection to message server XXX.XXX.XXX.XXX:3901[*] Connected. I check parameters...[*] Sending login packet:[*] Login OK, Server string: MSG_SERVER

[+] auth/no_check_in_some_cases = Y[+] auth/rfc_authority_check = 1[ ] dbms/type = syb[ ] DIR_AUDIT = /usr/sap/SYS/ASCS01/log[ ] FN_AUDIT = audit_++++++++

(continues on next page)

3.4. Example scripts 109

Page 114: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

(continued from previous page)

[+] gw/acl_mode = 1[+] gw/logging = ACTION=Ss LOGFILE=gw_log-%y-%m-%d SWITCHTF=day MAXSIZEKB=100[+] gw/monitor = 1[ ] gw/proxy_check = *[ ] gw/prxy_info = /usr/sap/SYS/ASCS01/data/prxyinfo[ ] gw/reg_info = /usr/sap/SYS/ASCS01/data/reginfo[!] gw/reg_no_conn_info = 1[ ] gw/sec_info = /usr/sap/SYS/SYS/global/secinfo[+] gw/sim_mode = 0[!] icm/HTTP/logging_0 = *[!] icm/HTTP/logging_1 = *[!] icm/HTTP/logging_2 = *[!] icm/HTTP/logging_3 = *[!] icm/HTTP/logging_4 = *[ ] icm/server_port_0 = PROT=HTTP,PORT=0,TIMEOUT=60,PROCTIMEOUT=60[ ] icm/server_port_1 = PROT=SMTP,PORT=0,TIMEOUT=120,PROCTIMEOUT=120[ ] icm/server_port_2 = NOT_EXIST[ ] icm/server_port_3 = NOT_EXIST[ ] icm/server_port_4 = NOT_EXIST[ ] INSTANCE_NAME = ASCS01[ ] j2ee/dbname = SYS[ ] j2ee/dbtype = syb[+] login/fails_to_user_lock = 5[!] login/min_password_lng = 6[+] login/no_automatic_user_sapstar = 1[!] login/password_compliance_to_current_policy = 0[+] login/password_downwards_compatibility = 0[ ] login/system_client = 001[ ] ms/acl_file_admin = NOT_EXIST[ ] ms/acl_file_extbnd = NOT_EXIST[ ] ms/acl_file_ext = NOT_EXIST[ ] ms/acl_file_int = NOT_EXIST[ ] ms/acl_info = /usr/sap/SYS/SYS/global/ms_acl_info[+] ms/admin_port = 0[+] ms/audit = 1[!] ms/http_logging = PREFIX=/,LOGFILE=dev_ms_logging,LOGFORMAT=SAPMSG[+] ms/monitor = 0[ ] rdisp/extbnd_port = *[!] rdisp/msserv = sapmsSYS[+] rdisp/msserv_internal = 3901[!] rec/client = OFF[!] rsau/enable = 0[+] rsau/ip_only = *[+] rsau/max_diskspace/local = 1000000000[+] rsau/max_diskspace/per_day = 0[+] rsau/max_diskspace/per_file = 0[+] rsdb/ssfs_connect = 1[ ] rslg/local/file = /usr/sap/SYS/ASCS01/log/SLOG01[+] rslg/max_diskspace/local = 10000000[ ] SAPDBHOST = sapserver[ ] SAPFQDN = NOT_EXIST[ ] SAPSYSTEM = 01[ ] SAPSYSTEMNAME = SYS[ ] service/http/acl_file = NOT_EXIST[ ] service/https/acl_file = NOT_EXIST[+] service/protectedwebmethods = SDEFAULT[!] snc/enable = 0

(continues on next page)

110 Chapter 3. User guide

Page 115: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

(continued from previous page)

[!] system/secure_communication = OFF[ ] system/type = ABAP

The script’s output will contain a [+] mark if the value obtained from the Message Server matched the expected onein the provided file or a [!] mark if that’s not the case. Other parameters not checked will have an empty mark [ ].

This example script was contributed by Ivan Genuer. The recommended values and parameters related to the Gatewayand Message Server services were obtained from the May 2019 Security Notes Webinar by Frank Buchholz.

ms_impersonator

This example script is a proof of concept that connects with the Message Server service of a SAP Netweaver Applica-tion Server and impersonates an application server registering as a Dialog instance server.

ms_listener

This example script connects with the Message Server service and listen for messages coming from the server. Alongwith the ms_messenger script, it can be used as an example for using the Message Server as a messenger serviceand send packets from one client to another connected to the service.

ms_messenger

This example script connects with the Message Server service and sends a message to another client connected to it.Along with the ms_listener script, it can be used as an example for using the Message Server as a messengerservice and send packets from one client to another connected to the service.

ms_monitor

This script is an example implementation of SAP’s Message Server Monitor program (msmon). It allows the monitor-ing of a Message Server service and allows sending different commands and opcodes. Includes some commands notavailable on the msmon program. Some commands requires the server running in monitor mode, while most of themrequires access to the Message Server internal port.

The script implements a console-like interface that can be used to specify the operations to perform on the MessageServer. A list of implemented commands can be obtained by running help.

ms_observer

This example script connects with the Message Server service of a SAP Netweaver Application Server and monitorsthe clients to identify new application servers. As the Message Server broadcast the addition, removal or change ofclients to all the clients connected to it, it’s possible to identify those state changes and print them. Similar to SAP’smsprot tool.

3.4.7 Router Example scripts

router_admin

This example script connects to a SAP Router instance and allows to perform administrative tasks. The commandsavailable and their syntax is similar to the one found on the saprouter program. The operation codes and commands

3.4. Example scripts 111

Page 116: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

are documented in the SAP’s help pages for the SAP Router. In addition to those commands found in the saprouterprogram, the scripts includes undocumented operations codes.

In order for administrative tasks to be run, the script need to be run from the same system where the SAP Routerinstance is running (connections identified as “local” by the Network Interface (NI) protocol), or the SAP Routerneeds to be configured as to allow remote connections to the SAP Router port. An example of such a routing table toallow this access is as follows:

P * 127.0.0.1 3299

The undocumented commands implemented by the script are the following ones:

• set-peer-trace: Takes an address mask as an argument and sets the tracing of peers matching that addressmask.

• clear-peer-trace: Takes an address mask as an argument and clears the tracing of peers matching thataddress mask.

• trace-connection: Takes a client identifier as an argument and enables a trace for that connection. Thelist of clients being traced can be observed using the router-info commands.

router_fingerprint

It was found out that SAP Router instances include some information in error messages when processing certain typeof malformed packets or when certain fault situations are reached. The information contained in those error messagesincludes details such as the SAP Router’s release number, name of the source code file where the error is thrown,and in some cases the code line where the error was identified. As the source file numbers are frequently changingbetween one version of the program an another, it can be very precise as to potentially identify build numbers andpinpoint particular version numbers. This information can be valuable as to determine potential security risk in caseof running old and potentially vulnerable versions of the SAP Router service.

This example script is an experimental attempt at performing remote SAP Router version fingerprinting by trigger-ing those error conditions and matching the information provided in the error messages with a previously generateddatabase. A fingerprint database is maintained and located in the examples/router_fingerprints.jsonfile.

The following is an example result of running the script against a version of SAP Router already in the database:

$ python router_fingerprint.py -d <hostname>[*] Loading fingerprint database[*] Trying to fingerprint version using 13 packets[*] (1/13) Fingerprint for packet 'No route one entry'[*] (1/13) Fingerprint for packet 'No route one entry' matched ![*] (2/13) Fingerprint for packet 'Timeout'[*] (2/13) Fingerprint for packet 'Timeout' matched !....[*] (13/13) Fingerprint for packet 'No route invalid length' matched !

[*] Matched fingerprints (13/13):[+] Request: No route one entry[+] Request: Timeout[+] Request: No route[+] Request: Empty route invalid offset[+] Request: Non existent domain old version[+] Request: Valid domain invalid service[+] Request: Invalid control opcode[+] Request: Network packet too big

(continues on next page)

112 Chapter 3. User guide

Page 117: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

(continued from previous page)

[+] Request: Empty route invalid length[+] Request: Non existent domain[+] Request: Empty route valid length[+] Request: Empty route null offset[+] Request: No route invalid length

[*] Probable versions (1):[*] Hits: 13 Version: version: "40" release: "749" patch_number: "200" source_id: "0.→˓200" update_level: "0" platform: "linux-x86-64" submitted_by: "[email protected]→˓"

As can be observed, by matching the information in the error message with the fingerprint database it’s possible tonarrow down the version to a build number.

The following is an example result of running the script against a version of SAP Router that is not found in thedatabase:

$ ./router_fingerprint.py -d <hostname>[*] Loading fingerprint database[*] Trying to fingerprint version using 13 packets[*] (1/13) Fingerprint for packet 'No route one entry'[*] (1/13) Fingerprint for packet 'No route one entry' not matched[*] (2/13) Fingerprint for packet 'Timeout'[*] (2/13) Fingerprint for packet 'Timeout' not matched....[*] (13/13) Fingerprint for packet 'No route invalid length'[*] (13/13) Fingerprint for packet 'No route invalid length' not matched

[*] Non matched fingerprints (13/13):[-] Request: No route one entry[-] Request: Timeout[-] Request: No route[-] Request: Empty route invalid offset[-] Request: Non existent domain old version[-] Request: Valid domain invalid service[-] Request: Invalid control opcode[-] Request: Network packet too big[-] Request: Empty route invalid length[-] Request: Non existent domain[-] Request: Empty route valid length[-] Request: Empty route null offset[-] Request: No route invalid length

[-] Some error values where not found in the fingerprint database. If you want to→˓contribute submit a issue to https://github.com/SecureAuthCorp/pysap or write an→˓email to [email protected] with the following information along with the SAP→˓Router file information and how it was configured.

New fingerprint saved to: saprouter_new_fingerprints.json

Version information to complete and submit:{

"comment": "","submitted_by": "",

(continues on next page)

3.4. Example scripts 113

Page 118: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

(continued from previous page)

"update_level": "","patch_number": "","file_version": "","platform": "","source_id": ""

}

In this case, as the information contained in the error messages wasn’t found in the database, the script output containsthe steps and information required to incorporate that version in the database as a new record. This can be done byusing the --add-fingerprint option on the script and providing the json record.

The following example command line options can be used to add the missing version number to the database:

$ ./router_fingerprint.py -a saprouter_new_fingerprints.json -i '{> "comment": "A new comment to add to the fingerprint",> "submitted_by": "email or contact of the submitter",> "update_level": "update level",> "patch_number": "patch number",> "file_version": "file vesion",> "platform": "linux_x86_64",> "source_id": "source id number"> }'[*] Loading fingerprint database[*] Adding a new entry to the fingerprint database[*] Added a new entry for the target No route one entry[*] Added a new entry for the target Timeout[*] Added a new entry for the target No route[*] Added a new entry for the target Empty route invalid offset[*] Added a new entry for the target Non existent domain old version[*] Added a new entry for the target Valid domain invalid service[*] Added a new entry for the target Invalid control opcode[*] Added a new entry for the target Network packet too big[*] Added a new entry for the target Empty route invalid length[*] Added a new entry for the target Non existent domain[*] Added a new entry for the target Empty route valid length[*] Added a new entry for the target Empty route null offset[*] Added a new entry for the target No route invalid length

Fingerprints for missing versions can be contributed in the form of GitHub issues reporting the version and buildnumbers or in the form of pull requests with the addition of new records to the database.

router_niping

This example scripts is a very basic implementation of the niping tool available with SAP kernel distributionsand the saprouter program. The niping utility establishes a communication between two ends (a “client” anda “server”) and uses the NI protocol to send payloads. The tool is offered as a way to perform troubleshootingand network diagnostics, and it can help determining network speed and identify connectivity issues. Due to theimplementation of the NI protocol is also used to validate SAP Router configurations and ACLs.

router_password_check

This example and proof of concept script connects with a SAP Router service and makes an information request usinga provided password. It then records the time the remote service takes to respond to the request. Further analysis ofthe time records could be performed in order to identify whether the server is vulnerable to a timing attack on the

114 Chapter 3. User guide

Page 119: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

password check (CVE-2014-0984). More details about the vulnerability can be found in the SAP Router PasswordTiming Attack security advisory.

The script make use of the fau_timer library for measuring the timing of server’s responses, which can be installedfrom the mona-timing-lib repository in GitHub.

router_portfw

This example script establishes a connection to a target host and port through a SAP Router service. It works by bindinga local port (specified by --local-port) on a local IP address (provided by --local-host) and requesting theSAP Router (specified with --remote-host and --remote-port) to route a connection to the specified targetport (--target-port) and host (--target-host). A route password can be optionally provided as well (withthe --target-pass parameter).

The script can be used to route traffic to a remote destination through the SAP Router, for either testing ACLs oraccessing internal resources exposed through it. It’s worth mentioning that as the implementation relies on the use ofa “proxy” pattern, the route is only requested to the SAP Router when there’s traffic received on the local port binded.

The script is based on a similar functionality implemented in BizPloit’s saprouterNative script. More infor-mation can be found in Onapsis’ blogpost series about testing SAP Router security with BizPloit, part I and partII.

router_scanner

This example script performs a scan of a given set of target hosts (specified with --target-hosts) andports (provided with --target-ports) via a SAP Router instance (specified with --remote-host and--remote-port). By requesting a connection to be routed to a given host/port combination and looking to theSAP Router response, it’s possible to determine if the aforementioned host/port is open to the SAP Router. The scriptcan be also used to discover and validate ACLs configured in the SAP Router instance.

The list of hosts can be provided to the --target-hosts parameter as a comma-separated list of hostnames or IPaddresses (e.g. 10.0.0.1,10.0.0.10), or if the Python’s netaddr library is installed in CIDR representation(e.g. 10.0.0.1/24). In the same way, the ports to scan for can be provided in the --target-ports parameterusing a commma-separated list (e.g. 3200,3300) or a range (e.g. 3200-3299).

The script is based on a similar functionality implemented in BizPloit’s saprouterSpy script. More informationcan be found in Onapsis’ blogpost series about testing SAP Router security with BizPloit, part I and part II.

3.4. Example scripts 115

Page 120: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

116 Chapter 3. User guide

Page 121: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

CHAPTER 4

Development guide

4.1 Development

If you are interested in contribute to the project, this part of the documentation should contain the start point.

4.1.1 Release and version history

v0.1.17 - 2019-XX-XX

• Using Scapy version 2.4.3.

• Added documentation of projects using pysap.

• Added documentation of all example scripts.

• bin/pysapcar: Add cli option to determine output directory when extracting archives with pysapcar ([#24](https://github.com/SecureAuthCorp/pysap/pull/24)) Thanks [@okuuva](https://github.com/okuuva)!

• pysap/SAPDiag.py: Added support bits for SAP GUI 7.50 and SAP NW 7.52 SP01.

• pysap/SAPCAR.py: Fixed crafting of archive files by defaulting length fields to zero ([#22](https://github.com/SecureAuthCorp/pysap/issues/22)) Thanks [@okuuva](https://github.com/okuuva)!

• pysap/SAPMS.py: Added the DPInfo[1-3] packets for handling specific Message Server ADM packetsrelaying Dispatcher/WP info: [1-3] because of tight SAP kernel version dependency. ([#31](https://github.com/SecureAuthCorp/pysap/pull/31)) Thanks Mathieu ([@gelim](https://github.com/gelim)) and Dmitry([@_chipik](https://twitter.com/_chipik))!

• pysap/SAPRFC.py: Enhanced with mainly SAPCPIC* and SAPRFXPG* new packets. ([#31](https://github.com/SecureAuthCorp/pysap/pull/31)) Thanks Mathieu ([@gelim](https://github.com/gelim)) and Dmitry([@_chipik](https://twitter.com/_chipik))!

• pysap/SAPRouter.py: Fixed padding on SAPRouter client info packets.

• examples/rfc_monitor.py: Renamed the script to gw_monitor.py.

117

Page 122: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

• examples/router_scanner.py: Add capability to provide a comma separated list of targets/ports to scan.

• examples/list_sap_parameters: Updated recommended values and added new parameters.

• examples/ms_dump_info.py: Added NOTEQUAL check type.

• examples/router_fingerprints.json: Added fingerprints for SAP Router 7.49 and 7.45 kernels.

v0.1.16 - 2018-06-19

• Using Scapy version 2.4.0.

• Using Sphinx 1.7.4 for documentation.

• Added missing pysap.utils package in source/binary packages.

• Use flake8 to find syntax errors and undefined names in Travis ([#20](https://github.com/SecureAuthCorp/pysap/pull/20)) Thanks [@cclauss](https://github.com/cclauss)!

• pysap/SAPCAR.py: Improved SAPCAR files parsing, adding proper structure names based on VSI documenta-tion.

v0.1.15 - 2018-03-27

• Version released at Troopers’18

• Added initial support for handling IGS (Internet Graphic Server) packets along with example scripts toplay with them ([#19](https://github.com/SecureAuthCorp/pysap/pull/19)) Thanks [@iggy38](https://github.com/iggy38)!

• Added initial support for handling PSE and SSO Credential format files.

• bin/pysapgenpse: New binary tool for working with PSE and SSO credential files.

• bin/pysapcar: Added options for creating a new archive and appending files to an existing one.

• pysap/SAPCredv2.py: New module for SSO Credential files definitions and decryption logic.

• pysap/SAPDiagItems.py, extra/parsesupportbits.py: Corrected order of support data bit fields ([#18](https://github.com/SecureAuthCorp/pysap/pull/18)). Thanks [@hnzlmnn](https://github.com/hnzlmnn)!

• pysap/SAPIGS.py: New module for IGS packets layer ([#19](https://github.com/SecureAuthCorp/pysap/pull/19)).

• pysap/SAPLPS.py: New module for LPS definitions and INT/DP API decryption logic.

• pysap/SAPMS.py: Added Message Server Domain field, MS J2EE Cluster/Header/Service packets. ThanksAlbert Zedlitz!

• pysap/SAPPSE.py: New module for PSE files definitions and decryption logic.

• pysap/utils.py: Moved utils classes into a package.

• examples/diag_login_brute_force.py: Detect invalid clients while logins ([#17](https://github.com/SecureAuthCorp/pysap/pull/17)). Thanks [@hnzlmnn](https://github.com/hnzlmnn)!

• examples/dlmanager_decrypt.py: Replaced use of PyCrypto with Cryptography library.

• examples/igs_*.py: New example scripts to interact with IGS services ([#19](https://github.com/SecureAuthCorp/pysap/pull/19)).

• examples/rfc_monitor.py: Added noop command in the monitor and version command line option.

• examples/ms_*.py: Added command line option to specify Message Server Domain.

118 Chapter 4. Development guide

Page 123: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

• extra/pse2john.py: New extra script to extract crypto material in John the Ripper format.

v0.1.14 - 2017-10-04

• Added initial support for handling SNC frames and some of their fields.

• pysap/SAPNC.py: Added fields for SNCFrames and helper wrapper/unwrapper functions.

• pysap/SAPRouter.py: Fixed route request for more than one SAP Router when using the native proxy.

• pysap/SAPRouter.py: Allow route strings to use lowercase separator chars (e.g. “/h/host/s/port”).

• pysap/SAPRouter.py: Allow a SAPRoutedStreamSocket to bypass the NI layer if no route was specified but talkmode was set to raw ([#10](https://github.com/SecureAuthCorp/pysap/pull/10)).

• pysap/SAPRouter.py: Enhanced the version retrieve routine by not failing when an error is returned by the server([#11](https://github.com/SecureAuthCorp/pysap/issues/11)). Thanks [@gelim](https://github.com/gelim)!

• pysap/SAPRouter.py: Fixed missing eyecatcher in control messages ([#10](https://github.com/SecureAuthCorp/pysap/pull/10)). Thanks [@gelim](https://github.com/gelim)!.

• examples/diag_login_screen_info.py: Script was improved by better printing technical information and out-putting login screen text items (language, input fields, login text) ([#14](https://github.com/SecureAuthCorp/pysap/pull/14)). Thanks [@gelim](https://github.com/gelim)!.

• examples/diag_login_brute_force.py: Script was improved to handle currently logged in users ([#16](https://github.com/SecureAuthCorp/pysap/pull/16)). Thanks [@hnzlmnn](https://github.com/hnzlmnn)!

• example/router/admin.py: Improved client list table display and fixed timestamps ([#12](https://github.com/SecureAuthCorp/pysap/issues/12)). Thanks [@gelim](https://github.com/gelim)!.

• examples/ms_dump_param.py: New example script to list Message Server parameters and check them againsta list of expected values ([#15](https://github.com/SecureAuthCorp/pysap/pull/15)). Thanks [@iggy38](https://github.com/iggy38)!

• examples/ms_dos_exploit.py: New example script to check for [CVE-2017-5997](https://erpscan.com/advisories/erpscan-16-038-sap-message-server-http-remote-dos/) DoS vulnerability on Message Server andfixed at [SAP Note 2358972](https://launchpad.support.sap.com/#/notes/2358972) ([#10](https://github.com/SecureAuthCorp/pysap/pull/10)). Thanks [@vah13](https://github.com/vah13) and [@gelim](https://github.com/gelim)!

v0.1.13 - 2017-02-16

• Documentation now includes graphical representation of the main packets of each protocol.

• Example scripts now accept route strings without requiring remote host option.

• pysap/SAPRouter.py: Fixed route request for more than one SAP Router.

• pysap/SAPEnqueue.py: SAPEnqueueStreamSocket now can connect to an Enqueue server through a SAPRouter.

• examples/router_niping.py: New example script that implements a very basic version of the niping tool. It workson client or server mode.

• examples/enqueue_monitor.py: The script now accepts route strings for connecting through a SAPRouter.

v0.1.12.1 - 2016-12-19

• Minor release.

4.1. Development 119

Page 124: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

• Source build didn’t included header files and thus builds from pip source were failing.

v0.1.12 - 2016-12-16

• Using Scapy version 2.3.3.

• Minor fixes and code arrangements.

• Building and testing in OSX with Travis and Windows with Appveyor.

• pysap/SAPDiagItems.py: Added default support bits from SAP GUI 7.40 version.

• examples/diag_capturer.py: Added option to display available capture interfaces.

• examples/enqueue_dos_exploit.py: New example script to check for [CVE-2016-4015](https://erpscan.com/advisories/erpscan-16-019-sap-netweaver-enqueue-server-dos-vulnerability/) DoS vulnerability on StandaloneEnqueue Server and fixed at [SAP Note 2258784](https://launchpad.support.sap.com/#/notes/0002258784)([#6](https://github.com/SecureAuthCorp/pysap/pull/6)). Thanks [@vah13](https://github.com/vah13)!

• examples/router_fingerprints.json: Added fingerprints from SAP Router releases 745.

v0.1.11 - 2016-10-12

• Some documentation improvements. Hosting the documentation in [Read the Docs](https://pysap.readthedocs.io/en/latest/).

• ChangeLog file in Markdown format for better documentation.

• Improvements over the pysapcar tool, general fixes and added handling of multi-block SAP CAR archive files.Thanks [Hans-Christian Esperer](https://github.com/hce) for the feedback!

• pysap/SAPDiag.py: Splitted SBA/SFE/SLC fields.

• pysap/SAPDiag.py: Renamed error flag to error number.

• examples/diag_capturer.py: Fix imports for running diag capturer example script in Windows.

• examples/diag_login_brute_force.py: Added SOLMAN [default](https://www.troopers.de/media/filer_public/37/34/3734ebb3-989c-4750-9d48-ea478674991a/an_easy_way_into_your_sap_systems_v30.pdf) [creden-tials](https://launchpad.support.sap.com/#/notes/2293011) and improved reading credentials file.

v0.1.10 - 2016-03-25

• Version released at Troopers’16

• Added support for handling SAP SAR file formats.

• pysap/SAPCAR.py: New module for handling SAP SAR file formats.

• extra/dlmanager_decrypt.py: Example PoC for [decrypting](https://www.coresecurity.com/advisories/sap-download-manager-password-weak-encryption) [SAP Download Manager](https://support.sap.com/software/download-manager.html) stored passwords.

• examples/dlmanager_infector.py: Example script to open a SAP SAR archive file and infect it by adding fileswith arbitrary filenames (e.g. including absolute or relative paths). It can be also used as a [mitmproxy](https://mitmproxy.org/) script for on-the-fly infecting SAR files being downloaded.

120 Chapter 4. Development guide

Page 125: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

v0.1.9 - 2016-02-08

• Using Scapy version 2.3.2.

• Replaced epydoc with Sphinx for documentation.

• Minor enhancement and code arrangements.

• pysap/SAPDiagItems.py: Added new support bits from SAP GUI 7.30p9 and 7.40 versions.

• pysap/utils.py: Removed custom fields now available on Scapy.

• examples/router_fingerprints.json: Added some fingerprints from SAP Router releases 720.32 and 742.

v0.1.8 - 2015-10-29

• Enabled travis containers for more quick builds.

• Minor documentation and README improvements.

• pysap/SAPRouter.py: Documented some version numbers from old releases ([#3](https://github.com/SecureAuthCorp/pysap/pull/3)). Thanks [invisiblethreat](https://github.com/invisiblethreat)!

• pysapcompress/vpa108csulzh.cpp: Improved the fix for CVE-2015-2278 by properly initializing arrays([#4](https://github.com/SecureAuthCorp/pysap/pull/4)). Thanks [ret5ret](https://github.com/ret5ret)!

• examples/diag_render_login_screen.py: Fail gracefully if wx is not found.

• examples/router_password_check.py: Updating the fau_timer library in use and failing gracefully if it’s notfound.

• examples/router_fingerprint.py: New example script for performing fingerprint over SAP Router versions. Thisis experimental and the database included only contains a few SAP Router versions, but it might work.

v0.1.7 - 2015-05-13

• Fixed vulnerabilities in LZC and LZH compression libraries ([CVE-2015-2282 and CVE-2015-2278](https://www.coresecurity.com/advisories/sap-lzc-lzh-compression-multiple-vulnerabilities)). Added test cases forchecking proper fixes.

• pysap/SAPRouter.py: Moved SAP Router native proxy implementation to the SAP Router module so it can bereused.

• examples/router_portfw.py: Using the native proxy implementation in SAP Router module.

v0.1.6 - 2015-03-25

• Requirements now handled by setuptools.

• Test building with clang on travis.

• Cleared installation docs.

• pysap/SAPNI.py: Made clients an instance variable in SAPNIServer.

• pysap/SAPRouter.py: Added unknown field.

• examples/diag_dos_exploit.py: Small fix.

• examples/router_admin.py: Small fix on response handling.

• examples/router_portfw.py: Added support for specify talk mode when requesting routes.

4.1. Development 121

Page 126: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

• examples/router_scanner.py: Added support for specify talk mode when requesting routes.

v0.1.5 - 2015-01-16

• Updated to use scapy v2.3.1.

• Code is more Python3-friendly.

• Added travis script for running tests.

• General minor fixes and code improvements.

• Added test suites for SAPNI, SAPDiag and SAPRouter modules.

• Added support for routing via SAP Router in almost all example scripts.

• pysap/SAPDiag.py: Added support for message info and Diag error packets.

• pysap/SAPDiag.py: Diag item lookup now support looking up multiple items, and string lookups.

• pysap/SAPDiagClient.py: Added support for specifying support bits when connecting, support for routing viaSAP Router.

• pysap/SAPDiagClient.py: If no terminal is supplied, use a random looking IP by default to avoid identification([SAP Note 1497445](https://launchpad.support.sap.com/#/notes/1497445)).

• pysap/SAPDiagItems.py: Fixes on some atom items for old versions.

• pysap/SAPEnqueue.py: Added trace max file size field.

• pysap/SAPNI.py: Added helpers for creating new connections.

• pysap/SAPNI.py: SAPNIProxy implemented using a Worker thread.

• pysap/SAPNI.py: SAPNIServer implemented using SAPNIStreamSocket.

• pysap/SAPRouter.py: Added route hop conversion helpers.

• pysap/SAPRouter.py: Added info client and info server packets.

• pysap/SAPRouter.py: Added SAPRoutedStreamSocket.

• pysap/utils.py: Reimplemented MutablePacketField with evaluators.

• pysapcompress/pysapcompress.cpp: Improved routines and added handling of some error conditions.

• examples/diag_capturer.py: New example script for dumping Diag login credentials by sniffing or reading apcap file.

• examples/enqueue_monitor.py: Added command for get replication info and command for check-ing trace pattern endless loop vulnerability ([CVE-2014-0995](https://www.coresecurity.com/advisories/sap-netweaver-enqueue-server-trace-pattern-denial-service-vulnerability)).

• examples/router_admin.py: Parsing of info request responses.

• examples/router_password_check: New example script for testing if a SAP Router is vulnerableto a timing attack on the password check ([CVE-2014-0984](https://www.coresecurity.com/advisories/sap-router-password-timing-attack)).

• requirements-optional.txt: Added optional requirements.

122 Chapter 4. Development guide

Page 127: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

v0.1.4 - 2014-03-25

• Version released at Troopers’14.

• Changelog now in GNU format.

• Changed setup from distutils to setuptools.

• Added some unit tests.

• Arranged most of the code according to PEP8.

• pysap/SAPDiagItems.py: Fixed some support bits and added new ones found in SAP GUI version 7.30.

• pysap/SAPDiagItems.py: Added new Diag Items: WindowsSize.

• pysap/SAPEnqueue.py: New packet classes. Crafting of Enqueue Server packets: Connection Admin and ServerAdmin.

• pysap/SAPNI.py: Fixed handling of NI_PING keep-alive requests.

• pysap/SAPNI.py: Added logging namespace sapni for all NI layer activity.

• pysap/SAPMS.py: New packet classes. Crafting of Message Server packets.

• pysap/SAPRouter.py: New packet classes. Crafting of SAP Router packets: Route, Admin, Control and ErrorInformation.

• pysap/SAPSNC.py: New packet class. Container for SNC Frame packets.

• pysapcompress/pysapcompress.cpp: Splitted exception class in two: CompressError and DecompressError.

• examples/ms_change_param.py: Added example for retrieving or changing a parameter value using MS Adminset_param commands.

• examples/ms_dump_info.py: New example script for retrieving information using MS Admin dump commands.

• examples/ms_impersonator.py: New example script for impersonating an application server connected to a Mes-sage Server service instance.

• examples/ms_listener.py: New example script for connecting to a Message Server and listening for messagescoming from the server.

• examples/ms_messager.py: New example script for sending a message to a connected client through the MessageServer.

• examples/ms_monitor.py: New example script for monitoring the Message Server service (msmon tool onsteroids).

• examples/ms_observer.py: New example script for connecting to a Message Server service and observe clientsconnecting to it (msprot tool).

• examples/router_admin.py: New example script for performing administrative tasks on a SAP Route. Includesundocumented commands.

• examples/router_portfw.py: New example script for routing native connections through SAP Router.

• examples/router_scanner.py: New example script for scanning internal hosts using SAP Router.

v0.1.3 - 2013-08-28

• Added general documentation and setup.py command to build it using epydoc.

• pysap/SAPNI.py: Refactored the SAP Diag Proxy and Server modules to a base NI implementation.

• pysapcompress/pysapcompress.cpp: Added handling of error return codes.

4.1. Development 123

Page 128: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

• examples/diag_interceptor.py: Refactored to use the new NIProxy implementation. Fixed some hanging issues.Thanks Florian Grunow for the feedback!

• examples/diag_login_brute_force.py: Handling of license errors.

v0.1.2 - 2012-09-27

• Version released at Brucon’12.

• pysap/SAPNI.py, pysap/SAPDiag.py: Network Interface packet class moved to a new module. Binding of theSAPNI/protocol layer is performed now by each script to allow the use of different protocols with SAPNI.

• pysap/SAPNI.py: Added a NI Stream Socket class for using it instead of the base Stream Socket.

• pysap/SAPDiagItems.py: Added new Diag Atom types, as used in NW 7.01 and early versions.

• examples/diag_rogue_server.py: Minor fixes.

• examples/diag_render_login_screen.py: Minor fixes.

• examples/diag_login_brute_force.py: Added multi-thread support.

v0.1.1 - 2012-07-29

• Initial version released at Defcon 20.

4.1.2 Documentation

Documentation can be build using:

$ python setup.py doc

A build is also available at Read the Docs.

The build process requires several packages and libraries to be available. The operative system libraries required are:

• pandoc

• A LaTex environment, for example TexLive on Linux or MikTex on Windows.

For example, installation on a Ubuntu box would require the following commands:

$ sudo apt install pandoc texlive-base

Python packages can be installed using

$ pip install pysap[docs]

4.1.3 Notebooks

Documentation include a graphical representation of the most commonly used protocol packets and file formats. Thisgraphical representations are built using Scapy, The Jupyter Notebook , nbconvert and nbsphinx.

Jupyter notebooks containing the protocol packets’ representation can be re-build using the following command:

$ python setup.py notebooks

124 Chapter 4. Development guide

Page 129: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

4.1.4 Code contributions

When contributing code, follow this checklists:

1. Fork the repository on GitHub.

2. Run the tests to check that all current tests pass on the system. If they don’t, some investigation might berequired to determine why they fail. Note that current tests are limited and only covers some of the protocolsand client interfaces.

3. If possible, write tests that demonstrate the bug you’re fixing or the feature being added.

4. Make the desired changes.

5. Run the tests again and ensure they are passing again and remain valid.

6. Send a GitHub Pull Request to the repository’s master branch.

4.1.5 Bug reporting

Bug reports are important to keep the project up. It’s important to clarify that examples are not mean to be valid for allcurrent software versions, and in most of the cases they are demonstrations over the capabilities of having the packagesimplemented in the library. However, improvements are highly appreciated on both library’s core components andexample scripts.

When submitting bugs, follow this checklist:

1. Check current GitHub issues for potential duplicates.

2. Create a new issue detailing as much information as possible. Packet captures are always helpful when dealingwith specific packets missing or client interface errors.

4.2 Developer Interface

This part of the documentation covers the developer interfaces of pysap.

4.2.1 pysap package

pysap

[pysap](https://www.secureauth.com/labs/open-source-tools/pysap) is an open source Python library that providesmodules for crafting and sending packets using SAP’s NI, Diag, Enqueue, Router, Message Server, SNC and IGSprotocols. In addition, support for creating and parsing different proprietary file formats is included. The modules arebuilt on top of [Scapy](https://scapy.net/) and are based on information acquired at researching the different protocols,file formats and services.

Features

• Dissection and crafting of the following network protocols:

– SAP Network Interface (NI)

– SAP Diag

– SAP Enqueue

4.2. Developer Interface 125

Page 130: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

– SAP Router

– SAP Message Server (MS)

– SAP Secure Network Connection (SNC)

– SAP Internet Graphic Server (IGS)

• Client interfaces for handling the following file formats:

– SAP SAR archive files

– SAP PSE (Personal Security Environment) files

– SAP SSO Credential (Credv2) files

• Library implementing SAP’s LZH and LZC compression algorithms.

• Automatic compression/decompression of payloads with SAP’s algorithms.

• Client, proxy and server classes implemented for some of the protocols.

• Example scripts to illustrate the use of the different modules and protocols.

copyright SECUREAUTH LABS. Copyright (C) 2019 SecureAuth Corporation. All rights reserved.

license GNU General Public License v2 or later (GPLv2+).

Subpackages

pysap.utils package

class pysap.utils.Worker(decoder, function)Bases: threading.Thread

Thread Worker

It runs a function into a new thread.

run()Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passedto the object’s constructor as the target argument, if any, with sequential and keyword arguments takenfrom the args and kwargs arguments, respectively.

stop()

Submodules

pysap.utils.console module

class pysap.utils.console.BaseConsole(options)Bases: cmd.Cmd, object

complete_options(text, line, begidx, endidx)

do_exit(args)Exit console.

do_help(args)Show help.

126 Chapter 4. Development guide

Page 131: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

do_history(args)Show commands history.

do_options(args)Show/set options.

do_script(args)Runs a script file.

emptyline()Called when an empty line is entered in response to the prompt.

If this method is not overridden, it repeats the last nonempty command entered.

postcmd(stop, line)Hook method executed just after a command dispatch is finished.

postloop()Hook method executed once when the cmdloop() method is about to return.

precmd(line)Hook method executed just before the command line is interpreted, but after the input prompt is generatedand issued.

preloop()Hook method executed once when the cmdloop() method is called.

pysap.utils.crypto module

class pysap.utils.crypto.PBKDF1(algorithm, length, salt, iterations, backend)Bases: object

derive(key_material)

verify(key_material, expected_key)

class pysap.utils.crypto.PKCS12_PBES1(salt, iterations, iv, password, hash_algorithm,enc_algorithm, enc_mode, backend)

Bases: object

decrypt(cipher_text)

derive_key(salt, iterations, password)

encrypt(plain_text)

class pysap.utils.crypto.PKCS12_PBKDF1(algorithm, length, salt, iterations, id, backend)Bases: object

derive(password)

verify(key_material, expected_key)

pysap.utils.crypto.dpapi_decrypt_blob(blob, entropy=None)Decrypts a blob of data using DPAPI.

Parameters

• blob (string) – encrypted blob to decrypt

• entropy (string) – additional entropy to use to decrypt

Returns decrypted blob

Return type string

4.2. Developer Interface 127

Page 132: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Raises Exception – if the platform is not Windows or the decryption failed

pysap.utils.fields module

class pysap.utils.fields.ASN1F_CHOICE_SAFE(name, default, *args, **kwargs)Bases: scapy.asn1fields.ASN1F_CHOICE

m2i(pkt, s)Try to safely extract an ASN1_Packet from the choices list.

Raises ASN1_Error – if unable to parse the packet using any of the given choices

class pysap.utils.fields.ByteMultiEnumKeysField(name, default, enum, depends_on,fmt=’H’)

Bases: scapy.fields.MultiEnumField

MultiEnumField that picks a reduced number of values. Used for fuzzing Byte fields with reduced number ofvalues.

randval()Return a volatile object whose value is both random and suitable for this field

class pysap.utils.fields.IntToStrField(name, default, length=11)Bases: scapy.fields.Field

Custom field from int to str values, with a variable length

format

i2count(pkt, x)Convert internal value to a number of elements usable by a FieldLenField. Always 1 except for list fields

i2m(pkt, x)Convert internal value to machine value

length

m2i(pkt, x)Convert machine value to internal value

class pysap.utils.fields.MutablePacketField(name, default, length_from, get_class, evalu-ators=None)

Bases: scapy.fields.StrLenField

Packet field that mutates the class according to a list of evaluators. The evaluators are run against the packet andgiven to a class getter.

If the class can’t be found, the field is treated as a StrLenField.

evaluators

get_class(pkt)

i2m(pkt, i)Convert internal value to machine value

length_from

m2i(pkt, m)Convert machine value to internal value

class pysap.utils.fields.PacketListStopField(name, default, cls, count_from=None,length_from=None, stop=None)

Bases: scapy.fields.PacketListField

128 Chapter 4. Development guide

Page 133: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Custom field that contains a list of packets until a ‘stop’ condition is met.

count_from

getfield(pkt, s)Extract an internal value from a string

Extract from the raw packet s the field value belonging to layer pkt.

Returns a two-element list, first the raw packet string after having removed the extracted field, second theextracted field itself in internal representation.

length_from

stop

class pysap.utils.fields.PacketNoPaddedBases: scapy.packet.Packet

Regular scapy packet with no padding.

aliastypes = [<class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

extract_padding(s)DEV: to be overloaded to extract current layer’s padding.

Parameters s (str) – the current layer

Returns a couple of strings (actual layer, padding)

class pysap.utils.fields.RandByteReducedBases: scapy.volatile.RandNum

RandByte that only returns random values between 0 and x2a. Used while performing some fuzz to reduce thetest cases space.

class pysap.utils.fields.StrEncodedPaddedField(name, default, encoding=’utf-16’,padd=’x0c’, fmt=’H’, remain=0)

Bases: scapy.fields.StrField

addfield(pkt, s, val)Add an internal value to a string

Copy the network representation of field val (belonging to layer pkt) to the raw string packet s, and returnthe new string packet.

encoding

getfield(pkt, s)Extract an internal value from a string

Extract from the raw packet s the field value belonging to layer pkt.

Returns a two-element list, first the raw packet string after having removed the extracted field, second theextracted field itself in internal representation.

h2i(pkt, x)Convert human value to internal value

i2h(pkt, x)Convert internal value to human value

padd

remain

4.2. Developer Interface 129

Page 134: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

class pysap.utils.fields.StrFixedLenPaddedField(name, default, length=None,length_from=None, padd=’ ’)

Bases: scapy.fields.StrFixedLenField

Packet field that has a fixed length and is padded with a given character.

addfield(pkt, s, val)Add an internal value to a string

Copy the network representation of field val (belonging to layer pkt) to the raw string packet s, and returnthe new string packet.

getfield(pkt, s)Extract an internal value from a string

Extract from the raw packet s the field value belonging to layer pkt.

Returns a two-element list, first the raw packet string after having removed the extracted field, second theextracted field itself in internal representation.

length_from

padd

class pysap.utils.fields.StrNullFixedLenField(name, default, length=None,length_from=None, max_length=None,null_terminated=None)

Bases: scapy.fields.StrFixedLenField

Packet field that has a fixed length and is conditionally null-terminated.

addfield(pkt, s, val)Add an internal value to a string

Copy the network representation of field val (belonging to layer pkt) to the raw string packet s, and returnthe new string packet.

getfield(pkt, s)Extract an internal value from a string

Extract from the raw packet s the field value belonging to layer pkt.

Returns a two-element list, first the raw packet string after having removed the extracted field, second theextracted field itself in internal representation.

i2repr(pkt, v)Convert internal value to a nice representation

length_from

max_length

null_terminated

randval()Return a volatile object whose value is both random and suitable for this field

class pysap.utils.fields.StrNullFixedLenPaddedField(name, default, length=None,length_from=None, padd=’ ’)

Bases: scapy.fields.StrFixedLenField

Packet field that has a fixed length and is padded with a given character and null terminated.

addfield(pkt, s, val)Add an internal value to a string

130 Chapter 4. Development guide

Page 135: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Copy the network representation of field val (belonging to layer pkt) to the raw string packet s, and returnthe new string packet.

getfield(pkt, s)Extract an internal value from a string

Extract from the raw packet s the field value belonging to layer pkt.

Returns a two-element list, first the raw packet string after having removed the extracted field, second theextracted field itself in internal representation.

length_from

padd

pysap.utils.fields.saptimestamp_to_datetime(timestamp)Converts a timestamp in “SAP format” to a datetime object. Time zone looks to be fixed at GMT+1.

Submodules

pysap.SAPCAR module

class pysap.SAPCAR.SAPCARArchive(fil, mode=’rb+’, version=’2.01’)Bases: object

Proxy class that can be used to read SAP CAR archive files.

add_file(filename, archive_filename=None)Adds a new file to the SAP CAR archive file.

Parameters

• filename (string) – name of the file to add

• archive_filename (string) – name of the file to use in the archive

close()Close the file descriptor object associated to the archive file.

create()Creates the structure for holding a new SAP CAR archive file.

fd = None

filename = None

filesThe list of file objects inside this archive file.

Returns list of file objects

Return type L{dict} of L{SAPCARArchiveFile}

files_namesThe list of file names inside this archive file.

Returns list of file names

Return type L{list} of L{string}

open(filename)Returns a file-like object that can be used to access a file inside the SAP CAR archive.

Parameters filename (string) – name of the file to open

4.2. Developer Interface 131

Page 136: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Returns a file-like object that can be used to access the decompressed file.

Return type file

raw()Returns the raw data of the archive file.

Returns raw data

Return type string

read()Reads the SAP CAR archive file and populates the files list.

Raises Exception – if the file is invalid or unsupported

versionThe version of the archive file.

Returns version

Return type string

write()Writes the SAP CAR archive file to the file descriptor.

write_as(filename=None)Writes the SAP CAR archive file to another file.

Parameters filename (string) – name of the file to write to

class pysap.SAPCAR.SAPCARArchiveFile(file_format=None)Bases: object

Proxy class that can be used to access a file inside a SAP CAR archive and obtain its properties.

static calculate_checksum(data)Calculates the CRC32 checksum of a given data string.

Parameters data (str) – data to calculate the checksum over

Returns the CRC32 checksum

Return type int

check_checksum()Checks if the checksum of the file is valid.

Returns if the checksum matches

Return type bool

checksumThe checksum of the file.

Returns checksum

Return type int

Raises SAPCARInvalidFileException – if the file is invalid and contains more than oneend of data block

filenameThe name of the file.

Returns name of the file

Return type string

132 Chapter 4. Development guide

Page 137: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

classmethod from_archive_file(archive_file, version=’2.01’)Populates the file format object from another archive file object.

Parameters

• archive_file (L{SAPCARArchiveFile}) – archive file object to build the fileformat object from

• version (string) – version of the file to construct

Raises ValueError – if the version requested is invalid

classmethod from_file(filename, version=’2.01’, archive_filename=None)Populates the file format object from an actual file on the local file system.

Parameters

• filename (string) – filename to build the file format object from

• version (string) – version of the file to construct

• archive_filename (string) – filename to use inside the archive file

Raises ValueError – if the version requested is invalid

is_directory()Determines if the file is a directory.

Returns if the file is a directory

Return type bool

is_file()Determines if the file is a regular file.

Returns if the file is a regular file

Return type bool

open(enforce_checksum=False)Opens the compressed file and returns a file-like object that can be used to access its uncompressed content.

Parameters enforce_checksum (bool) – If the checksum validation should be enforce

Returns file-like object with the uncompressed file content

Return type file

Raises

• Exception – If the file to open is a directory

• DecompressError – If there’s a decompression error

• SAPCARInvalidFileException – If the file is invalid

• SAPCARInvalidChecksumException – If the checksum is invalid

perm_modeThe permissions mode of the file.

Returns permissions in numeric format

Return type int

permissionsThe permissions of the file.

Returns permissions in human-readable format

4.2. Developer Interface 133

Page 138: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Return type string

sizeThe size of the file.

Returns size of the file

Return type int

timestampThe timestamp of the file.

Returns timestamp in human-readable format

Return type string

timestamp_rawThe timestamp of the file.

Returns timestamp in numeric format

Return type int

typeThe type of the file.

Returns type of the file

Return type string

versionThe version of the file.

Returns version of the file

Return type string

class pysap.SAPCAR.SAPCARArchiveFilev200Format(_pkt=”, post_transform=None, _inter-nal=0, _underlayer=None, **fields)

Bases: pysap.utils.fields.PacketNoPadded

SAP CAR file information format

This is ued to parse files inside a SAP CAR archive.

aliastypes = [<class 'pysap.SAPCAR.SAPCARArchiveFilev200Format'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

extract(fd)Extracts the archive file and writes the extracted file to the provided file object. Returns the checksumobtained from the archive. If blocks are uncompressed, the file is directly extracted. If the blocks arecompressed, each block is added to a buffer, skipping the length field, and decompression is performedafter the block marked as end of data. Expected length and compression header is obtained from the firstblock and checksum from the end of data block.

Parameters fd (file) – file-like object to write the extracted file to

Returns checksum

Return type int

Raises

• DecompressError – If there’s a decompression error

• SAPCARInvalidFileException – If the file is invalid

fields_desc = [<Field (SAPCARArchiveFilev200Format,SAPCARArchiveFilev201Format).type>, <Field (SAPCARArchiveFilev200Format,SAPCARArchiveFilev201Format).perm_mode>, <Field (SAPCARArchiveFilev200Format,SAPCARArchiveFilev201Format).file_length_low>, <Field (SAPCARArchiveFilev200Format,SAPCARArchiveFilev201Format).file_length_high>, <Field (SAPCARArchiveFilev200Format,SAPCARArchiveFilev201Format).timestamp>, <Field (SAPCARArchiveFilev200Format,SAPCARArchiveFilev201Format).code_page>, <Field (SAPCARArchiveFilev200Format,SAPCARArchiveFilev201Format).user_info_length>, <Field (SAPCARArchiveFilev200Format,SAPCARArchiveFilev201Format).filename_length>, <Field (SAPCARArchiveFilev200Format,SAPCARArchiveFilev201Format).filename>, <Field (SAPCARArchiveFilev200Format,SAPCARArchiveFilev201Format).user_info>, <scapy.fields.ConditionalField object>]

134 Chapter 4. Development guide

Page 139: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

file_lengthGetter for the file length fields. It converts the two length fields (low and high) as provided in the archivefile into a long long integer.

is_filename_null_terminated = False

version = '2.00'

class pysap.SAPCAR.SAPCARArchiveFilev201Format(_pkt=”, post_transform=None, _inter-nal=0, _underlayer=None, **fields)

Bases: pysap.SAPCAR.SAPCARArchiveFilev200Format

SAP CAR file information format

This is used to parse files inside a SAP CAR archive.

aliastypes = [<class 'pysap.SAPCAR.SAPCARArchiveFilev201Format'>, <class 'pysap.SAPCAR.SAPCARArchiveFilev200Format'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPCARArchiveFilev200Format,SAPCARArchiveFilev201Format).type>, <Field (SAPCARArchiveFilev200Format,SAPCARArchiveFilev201Format).perm_mode>, <Field (SAPCARArchiveFilev200Format,SAPCARArchiveFilev201Format).file_length_low>, <Field (SAPCARArchiveFilev200Format,SAPCARArchiveFilev201Format).file_length_high>, <Field (SAPCARArchiveFilev200Format,SAPCARArchiveFilev201Format).timestamp>, <Field (SAPCARArchiveFilev200Format,SAPCARArchiveFilev201Format).code_page>, <Field (SAPCARArchiveFilev200Format,SAPCARArchiveFilev201Format).user_info_length>, <Field (SAPCARArchiveFilev200Format,SAPCARArchiveFilev201Format).filename_length>, <Field (SAPCARArchiveFilev200Format,SAPCARArchiveFilev201Format).filename>, <Field (SAPCARArchiveFilev200Format,SAPCARArchiveFilev201Format).user_info>, <scapy.fields.ConditionalField object>]

is_filename_null_terminated = True

version = '2.01'

class pysap.SAPCAR.SAPCARArchiveFormat(_pkt=”, post_transform=None, _internal=0, _un-derlayer=None, **fields)

Bases: scapy.packet.Packet

SAP CAR file format

This is used to parse SAP CAR archive files.

aliastypes = [<class 'pysap.SAPCAR.SAPCARArchiveFormat'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPCARArchiveFormat).magic_string>, <Field (SAPCARArchiveFormat).version>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>]

class pysap.SAPCAR.SAPCARCompressedBlobFormat(_pkt=”, post_transform=None, _inter-nal=0, _underlayer=None, **fields)

Bases: pysap.utils.fields.PacketNoPadded

SAP CAR compressed blob

This is used for decompressing blobs inside the compressed block.

aliastypes = [<class 'pysap.SAPCAR.SAPCARCompressedBlobFormat'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPCARCompressedBlobFormat).compressed_length>, <Field (SAPCARCompressedBlobFormat).uncompress_length>, <Field (SAPCARCompressedBlobFormat).algorithm>, <Field (SAPCARCompressedBlobFormat).magic_bytes>, <Field (SAPCARCompressedBlobFormat).special>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>]

class pysap.SAPCAR.SAPCARCompressedBlockFormat(_pkt=”, post_transform=None, _inter-nal=0, _underlayer=None, **fields)

Bases: pysap.utils.fields.PacketNoPadded

SAP CAR compressed block

This is used for decompressing blocks inside the file info format.

aliastypes = [<class 'pysap.SAPCAR.SAPCARCompressedBlockFormat'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPCARCompressedBlockFormat).type>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>]

exception pysap.SAPCAR.SAPCARInvalidChecksumExceptionBases: exceptions.Exception

Exception to denote a syntactically valid SAP CAR file with an invalid checksum

exception pysap.SAPCAR.SAPCARInvalidFileExceptionBases: exceptions.Exception

Exception to denote an invalid SAP CAR file

4.2. Developer Interface 135

Page 140: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

pysap.SAPCAR.SAPCAR_BLOCK_TYPE_COMPRESSED = 'DA'SAP CAR compressed block

pysap.SAPCAR.SAPCAR_BLOCK_TYPE_COMPRESSED_LAST = 'ED'SAP CAR compressed end of data block

pysap.SAPCAR.SAPCAR_BLOCK_TYPE_UNCOMPRESSED = 'UD'SAP CAR uncompressed block

pysap.SAPCAR.SAPCAR_BLOCK_TYPE_UNCOMPRESSED_LAST = 'UE'SAP CAR uncompressed end of data block

pysap.SAPCAR.SAPCAR_HEADER_MAGIC_STRING_BACKUP = 'CAR\x00'SAP CAR archive header magic string backup file

pysap.SAPCAR.SAPCAR_HEADER_MAGIC_STRING_STANDARD = 'CAR 'SAP CAR archive header magic string standard

pysap.SAPCAR.SAPCAR_TYPE_AS400 = 'SV'SAP CAR AS400 save file string

pysap.SAPCAR.SAPCAR_TYPE_DIR = 'DR'SAP CAR directory string

pysap.SAPCAR.SAPCAR_TYPE_FILE = 'RG'SAP CAR regular file string

pysap.SAPCAR.SAPCAR_TYPE_LINK = 'LK'SAP CAR Unix soft link string

pysap.SAPCAR.SAPCAR_TYPE_SHORTCUT = 'SC'SAP CAR Windows short cut string

pysap.SAPCAR.SAPCAR_VERSION_200 = '2.00'SAP CAR file format version 2.00 string

pysap.SAPCAR.SAPCAR_VERSION_201 = '2.01'SAP CAR file format version 2.01 string

pysap.SAPCAR.filemode(mode)Convert a file’s mode to a string of the form ‘-rwxrwxrwx’.

pysap.SAPCAR.sapcar_archive_file_versions = {'2.00': <class 'pysap.SAPCAR.SAPCARArchiveFilev200Format'>, '2.01': <class 'pysap.SAPCAR.SAPCARArchiveFilev201Format'>}SAP CAR file format versions

pysap.SAPCAR.sapcar_is_last_block(packet)Helper function that evaluates if a block packet is the end of data one or not.

Parameters packet (Packet) – packet to check

Returns if the block packet is the end of data one

Return type bool

pysap.SAPCredv2 module

pysap.SAPCredv2.CIPHER_ALGORITHM_3DES = 0Constant for 3DES encryption algorithm

pysap.SAPCredv2.CIPHER_ALGORITHM_AES256 = 1Constant for AES256 encryption algorithm

136 Chapter 4. Development guide

Page 141: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

class pysap.SAPCredv2.SAPCredv2(_pkt=”, post_transform=None, _internal=0, _under-layer=None, **fields)

Bases: scapy.asn1packet.ASN1_Packet

SAP Credv2 Credential set definition

ASN1_codec = <ASN1Codec BER[1]>

ASN1_root = <ASN1F_SEQUENCE_OF creds>

aliastypes = [<class 'pysap.SAPCredv2.SAPCredv2'>, <class 'scapy.asn1packet.ASN1_Packet'>, <class 'scapy.packet.Packet'>]

fields_desc = [<ASN1F_SEQUENCE_OF creds>]

class pysap.SAPCredv2.SAPCredv2Cred(_pkt=”, post_transform=None, _internal=0, _under-layer=None, **fields)

Bases: scapy.asn1packet.ASN1_Packet

SAP Credv2 Credential definition

ASN1_codec = <ASN1Codec BER[1]>

ASN1_root = <pysap.utils.fields.ASN1F_CHOICE_SAFE object>

aliastypes = [<class 'pysap.SAPCredv2.SAPCredv2Cred'>, <class 'scapy.asn1packet.ASN1_Packet'>, <class 'scapy.packet.Packet'>]

fields_desc = [<pysap.utils.fields.ASN1F_CHOICE_SAFE object>]

class pysap.SAPCredv2.SAPCredv2_Cred(_pkt=”, post_transform=None, _internal=0, _under-layer=None, **fields)

Bases: scapy.asn1packet.ASN1_Packet

SAP Credv2 Credential without LPS definition

ASN1_codec = <ASN1Codec BER[1]>

ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_IA5_STRING object>, <scapy.asn1fields.ASN1F_IA5_STRING object>, <scapy.asn1fields.ASN1F_IA5_STRING object>, <scapy.asn1fields.ASN1F_IA5_STRING object>, <scapy.asn1fields.ASN1F_BIT_STRING object>)>

aliastypes = [<class 'pysap.SAPCredv2.SAPCredv2_Cred'>, <class 'scapy.asn1packet.ASN1_Packet'>, <class 'scapy.packet.Packet'>]

cipher_algorithm

cipher_format_version

common_name

decrypt(username)Decrypt a credential given a particular username. Tries to identify the credential format and choose thedecryption method to use.

Requires the cryptography library installed.

Parameters username (string) – Username to use when decrypting

Returns decrypted object

Return type SAPCredv2_Cred_Plain

Raises Exception – if the cryptography library is not available

decrypt_simple(username)Decrypt a credential using the simple approach. It only handles 3DES. Tries to parse the decrypted objectinto a plain credential object type. If it fails, probably due to an invalid username use to decrypt it, raisesan exception.

Parameters username (string) – Username to use when decrypting

Returns decrypted object

4.2. Developer Interface 137

Page 142: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Return type SAPCredv2_Cred_Plain

Raises Exception – if the decrypted object can’t be parsed

decrypt_with_header(username)Decrypt a credential file using the header. It handles 3DES and AES256 algorithms. Tries to parse thedecrypted object into a plain credential object type. If it fails, probably due to an invalid username use todecrypt it, raises an exception.

Parameters username (string) – Username to use when decrypting

Returns decrypted object

Return type SAPCredv2_Cred_Plain

Raises SAPCredv2_Decryption_Error – if there’s an error decrypting the object

fields_desc = [<scapy.asn1fields.ASN1F_IA5_STRING object>, <scapy.asn1fields.ASN1F_IA5_STRING object>, <scapy.asn1fields.ASN1F_IA5_STRING object>, <scapy.asn1fields.ASN1F_IA5_STRING object>, <scapy.asn1fields.ASN1F_BIT_STRING object>]

lps_type

lps_type_str

pse_file_path

class pysap.SAPCredv2.SAPCredv2_Cred_Cipher(_pkt=”, post_transform=None, _internal=0,_underlayer=None, **fields)

Bases: scapy.packet.Packet

SAP Cred cipher packet. This is the header of an encrypted credential format 1. It contains all the required datato decrypt the stored credential.

aliastypes = [<class 'pysap.SAPCredv2.SAPCredv2_Cred_Cipher'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPCredv2_Cred_Cipher).version>, <Field (SAPCredv2_Cred_Cipher).algorithm>, <Field (SAPCredv2_Cred_Cipher).unknown>, <Field (SAPCredv2_Cred_Cipher).salt>, <Field (SAPCredv2_Cred_Cipher).iv>, <Field (SAPCredv2_Cred_Cipher).cipher_text>]

class pysap.SAPCredv2.SAPCredv2_Cred_LPS(_pkt=”, post_transform=None, _internal=0, _un-derlayer=None, **fields)

Bases: scapy.asn1packet.ASN1_Packet

SAP Credv2 Credential with LPS definition

ASN1_codec = <ASN1Codec BER[1]>

ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_INTEGER object>, <ASN1F_SEQUENCE(<ASN1F_SET(<ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_OID object>, <scapy.asn1fields.ASN1F_PRINTABLE_STRING object>)>,)>,)>, <scapy.asn1fields.ASN1F_UTF8_STRING object>, <scapy.asn1fields.ASN1F_BIT_STRING object>)>

aliastypes = [<class 'pysap.SAPCredv2.SAPCredv2_Cred_LPS'>, <class 'scapy.asn1packet.ASN1_Packet'>, <class 'scapy.packet.Packet'>]

cipher_algorithm

cipher_format_version

common_name

decrypt(username=None)Decrypt a credential file using LPS. Requires the cryptography library installed.

Parameters username (string) – Username to use when decrypting. Not used but kept tomatch signature

Returns decrypted object

Return type SAPCredv2_Cred_Plain

Raises Exception – if the cryptography library is not available

fields_desc = [<scapy.asn1fields.ASN1F_INTEGER object>, <scapy.asn1fields.ASN1F_OID object>, <scapy.asn1fields.ASN1F_PRINTABLE_STRING object>, <scapy.asn1fields.ASN1F_UTF8_STRING object>, <scapy.asn1fields.ASN1F_BIT_STRING object>]

lps_type

138 Chapter 4. Development guide

Page 143: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

lps_type_str

pse_file_path

class pysap.SAPCredv2.SAPCredv2_Cred_Plain(_pkt=”, post_transform=None, _internal=0,_underlayer=None, **fields)

Bases: scapy.asn1packet.ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>

ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_IA5_STRING object>, <scapy.asn1fields.ASN1F_optional object>, <scapy.asn1fields.ASN1F_optional object>, <scapy.asn1fields.ASN1F_optional object>)>

PROVIDER_MSCryptProtect = 'MSCryptProtect'Provider for Windows hosts using DPAPI

aliastypes = [<class 'pysap.SAPCredv2.SAPCredv2_Cred_Plain'>, <class 'scapy.asn1packet.ASN1_Packet'>, <class 'scapy.packet.Packet'>]

static decrypt_MSCryptProtect(plain, cred)Decrypts a credential using the Windows DP API. Requires the current logged-in user to have permissionsto decrypt the blob stored in the credentials file.

Parameters

• plain (SAPCredv2_Cred_Plain) – plain credential extracted

• cred (SAPCredv2_Cred) – credential from where the blob was extracted

Returns the content in the blob decrypted using the provider

Return type string

decrypt_provider(cred)Decrypts a credential file already decrypted using the specified provider. This is platform dependent andrequires specific third-party libraries.

Parameters cred (SAPCredv2_Cred) – credential from where the blob was extracted

Returns the content in the blob decrypted using the provider

Return type string

Raises Exception – if the provider is invalid or unsupported

fields_desc = [<scapy.asn1fields.ASN1F_IA5_STRING object>, <scapy.asn1fields.ASN1F_IA5_STRING object>, <scapy.asn1fields.ASN1F_IA5_STRING object>, <scapy.asn1fields.ASN1F_IA5_STRING object>]

providers = {'MSCryptProtect': <staticmethod object at 0x7fa9234d0948>}Definition of implemented providers

exception pysap.SAPCredv2.SAPCredv2_Decryption_ErrorBases: exceptions.Exception

pysap.SAPCredv2.cipher_algorithms = {0: '3DES', 1: 'AES256'}Dict with encryption algorithms supported

pysap.SAPCredv2.cred_key_fmt = '240657rsga&/%srwthgrtawe45hhtrtrsr35467b2dx3456j67mv67f89656f75'Fixed key embedded in CommonCryptoLib for encrypted credentials

pysap.SAPDiag module

class pysap.SAPDiag.SAPDiagBases: pysap.utils.fields.PacketNoPadded

SAP Diag packet

4.2. Developer Interface 139

Page 144: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

This packet holds the Diag Header and serve as a container for SAPDiagItem items. It handles compres-sion/decompression, adding the appropriate Compression Header when necessary.

aliastypes = [<class 'pysap.SAPDiag.SAPDiag'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

do_compress(s)Compress a string using SAP compression C++ extension.

Parameters s (C{string}) – string to compress

Returns string compression header plus the compressed string

Return type C{string}

Raises pysapcompress.Error – when a compression error is raised

do_decompress(s, length)Decompress a string using SAP compression C++ extension.

Parameters

• s (C{string}) – compression header plus compressed string

• length (int) – reported compressed length

Returns decompressed string

Return type C{string}

Raises pysapcompress.Error – when a decompression error is raised

fields_desc = [<Field (SAPDiag).mode>, <Field (SAPDiag).com_flag_TERM_GRA>, <Field (SAPDiag).com_flag_TERM_NNM>, <Field (SAPDiag).com_flag_TERM_CAS>, <Field (SAPDiag).com_flag_TERM_INI>, <Field (SAPDiag).com_flag_TERM_EOP>, <Field (SAPDiag).com_flag_TERM_NOP>, <Field (SAPDiag).com_flag_TERM_EOC>, <Field (SAPDiag).com_flag_TERM_EOS>, <Field (SAPDiag).mode_stat>, <Field (SAPDiag).err_no>, <Field (SAPDiag).msg_type>, <Field (SAPDiag).msg_info>, <Field (SAPDiag).msg_rc>, <Field (SAPDiag).compress>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPDiag).message>]

get_item(item_type=None, item_id=None, item_sid=None)Get an item from the packet’s message. Returns None if the message is not found, or a list if the item isfound multiple times.

Parameters

• item_type (int or C{string} or list) – item type byte or string value

• item_id (int or C{string} or list) – item ID byte or string value

• item_sid (int or C{string} or list) – item SID byte or string value

Returns list of items found on the packet or None

Return type list of SAPDiagItem

post_build(p, pay)Compress the payload. If the compression flag is set, compress both the message field and the payload.

pre_dissect(s)Prepares the packet for dissection. If the compression flag is set, decompress the payload.

class pysap.SAPDiag.SAPDiagDPBases: scapy.packet.Packet

SAP Diag DP Header packet

This packet is used for initialization of Diag connections. Usually there’s no need to change any value more thatthe terminal.

aliastypes = [<class 'pysap.SAPDiag.SAPDiagDP'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPDiagDP).request_id>, <Field (SAPDiagDP).retcode>, <Field (SAPDiagDP).sender_id>, <Field (SAPDiagDP).action_type>, <Field (SAPDiagDP).req_info>, <Field (SAPDiagDP).tid>, <Field (SAPDiagDP).uid>, <Field (SAPDiagDP).mode>, <Field (SAPDiagDP).wp_id>, <Field (SAPDiagDP).wp_ca_blk>, <Field (SAPDiagDP).appc_ca_blk>, <Field (SAPDiagDP).length>, <Field (SAPDiagDP).new_stat>, <Field (SAPDiagDP).unused1>, <Field (SAPDiagDP).rq_id>, <Field (SAPDiagDP).unused2>, <Field (SAPDiagDP).terminal>, <Field (SAPDiagDP).unused3>, <Field (SAPDiagDP).unused4>, <Field (SAPDiagDP).unused5>, <Field (SAPDiagDP).unused6>, <Field (SAPDiagDP).unused7>, <Field (SAPDiagDP).unused8>, <Field (SAPDiagDP).unused9>, <Field (SAPDiagDP).unused10>]

140 Chapter 4. Development guide

Page 145: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

class pysap.SAPDiag.SAPDiagErrorBases: pysap.utils.fields.PacketNoPadded

SAP Diag Error packet

This packet holds Diag error packets.

aliastypes = [<class 'pysap.SAPDiag.SAPDiagError'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPDiagError).msg>, <Field (SAPDiagError).padd>]

class pysap.SAPDiag.SAPDiagItemBases: pysap.utils.fields.PacketNoPadded

SAP Diag Item packet

This packet holds the different types of Diag items. The value field is interpreted according to the Type/ID/SIDspecified for the item.

aliastypes = [<class 'pysap.SAPDiag.SAPDiagItem'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPDiagItem).item_type>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPDiagItem).item_value>]

class pysap.SAPDiag.SAPDiagItemsBases: scapy.packet.Packet

SAP Diag Items container

Container for SAPDiagItem packets.

aliastypes = [<class 'pysap.SAPDiag.SAPDiagItems'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPDiagItems).message>]

pysap.SAPDiag.bind_diagitem(item_class, item_type, item_id=None, item_sid=None)Registers a Diag item class associated to a given type, ID and SID.

Parameters

• item_class (SAPDiagItem class) – item class to associate

• item_type (int or string) – item type to associate

• item_id (int) – item ID to associate

• item_sid (int) – item SID to associate

pysap.SAPDiag.diag_appl_ids = {1: 'SCRIPT', 2: 'GRAPH', 3: 'IXOS', 4: 'ST_USER', 5: 'DYNN', 6: 'ST_R3INFO', 7: 'POPU', 8: 'RFC_TR', 9: 'DYNT', 10: 'CONTAINER', 11: 'MNUENTRY', 12: 'VARINFO', 14: 'CONTROL', 15: 'UI_EVENT', 18: 'ACC_LIST', 19: 'RCUI', 20: 'GUI_PACKET'}Diag APPL/APPL4 IDs

pysap.SAPDiag.diag_appl_sids = {1: {1: 'SCRIPT_OTF', 2: 'SCRIPT_SCREEN', 3: 'SCRIPT_POSTSCRIPT', 4: 'SCRIPT_ITF'}, 2: {3: 'GRAPH RELEASE 3', 5: 'GRAPH RELEASE 5'}, 3: {1: 'ABLAGE', 2: 'ANZEIGE', 3: 'IXOS_COMMAND'}, 4: {1: 'V1', 2: 'CONNECT', 3: 'SELECTEDRECT', 4: 'FONTMETRIC', 5: 'TABLEMETRIC', 6: 'GUITIME', 7: 'GUITIMEZONE', 8: 'TURNTIME', 9: 'GUIVERSION', 11: 'SUPPORTDATA', 12: 'RFC_CONNECT', 13: 'WSIZE', 14: 'V2', 15: 'TURNTIME2', 16: 'RFC_PARENT_UUID', 17: 'RFC_NEW_UUID', 18: 'RFC_UUIDS', 19: 'RFC_UUIDS2', 20: 'XML_LOGIN', 21: 'XML_TRANSACTION', 22: 'SCROLLBAR_WIDTH', 23: 'TOOLBAR_HEIGHT', 24: 'PASSPORT_DATA', 25: 'GUI_STATE', 26: 'DECIMALPOINT', 27: 'LANGUAGE', 28: 'USERNAME', 29: 'GUIPATCHLEVEL', 30: 'WSIZE_PIXEL', 31: 'GUI_OS_VERSION', 32: 'BROWSER_VERSION', 33: 'OFFICE_VERSION', 34: 'JDK_VERSION', 35: 'GUIXT_VERSION', 36: 'DISPLAY_SIZE', 37: 'GUI_TYPE', 38: 'DIALOG_STEP_NUMBER'}, 5: {1: 'CHL', 3: 'XMLPROP DYNPRO'}, 6: {1: 'MODENUMBER', 2: 'DBNAME', 3: 'CPUNAME', 4: 'RFC_TRIGGER', 5: 'GUI_LABEL', 6: 'DIAGVERSION', 7: 'TCODE', 8: 'RFC_WAITING', 9: 'RFC_REFRESH', 10: 'IMODENUMBER', 11: 'MESSAGE', 12: 'CLIENT', 13: 'DYNPRONAME', 14: 'DYNPRONUMBER', 15: 'CUANAME', 16: 'CUASTATUS', 17: 'SUPPORTDATA', 18: 'RFC_CONNECT_OK', 19: 'GUI_FKEY', 20: 'GUI_FKEYT', 21: 'STOP_TRANS', 22: 'RFC_DIAG_BLOCK_SIZE', 23: 'USER_CHECKED', 24: 'FLAGS', 25: 'USERID', 26: 'ROLLCOUNT', 27: 'GUI_XT_VAR', 28: 'IMODEUUID', 29: 'IMODEUUID_INVALIDATE', 30: 'IMODEUUIDS', 31: 'IMODEUUIDS2', 32: 'CODEPAGE', 33: 'CONTEXTID', 34: 'AUTOLOGOUT_TIME', 35: 'CODEPAGE_DIAG_GUI', 36: 'CODEPAGE_APP_SERVER', 37: 'GUI_THEME', 38: 'GUI_USER_SCRIPTING', 39: 'CODEPAGE_APP_SERVER_1', 40: 'TICKET4GUI', 41: 'KERNEL_VERSION', 42: 'STD_TOOLBAR_ITEMS'}, 7: {2: 'DEST'}, 8: {0: 'RFC_TR_REQ', 1: 'RFC_TR_RET', 2: 'RFC_TR_ERR', 3: 'RFC_TR_RQT', 4: 'RFC_TR_MOR', 5: 'RFC_TR_MOB', 6: 'RFC_TR_RNB', 7: 'RFC_TR_RNT', 8: 'RFC_TR_DIS', 9: 'RFC_TR_CALL', 10: 'RFC_TR_CALL_END', 11: 'RFC_TR_RES'}, 9: {1: 'DYNT_FOCUS', 2: 'DYNT_ATOM', 3: 'DYNT_EVENT_UNUSED', 4: 'TABLE_ROW_REFERENCE', 5: 'TABLE_ROW_DAT_INPUT_DUMMY', 6: 'TABLE_INPUT_HEADER', 7: 'TABLE_OUTPUT_HEADER', 8: 'TABLE_ROW_DATA_INPUT', 9: 'TABLE_ROW_DATA_OUTPUT', 10: 'DYNT_NOFOCUS', 11: 'DYNT_FOCUS_1', 12: 'TABLE_ROW_REFERENCE_1', 13: 'TABLE_FIELD_NAMES', 14: 'TABLE_HEADER', 15: 'DYNT_TABSTRIP_HEADER', 16: 'DYNT_TABSTRIP_BUTTONS', 17: 'TABLE_ROW_REFERENCE_2', 18: 'DYNT_CONTROL_FOCUS', 21: 'DYNT_TC_COLUMN_TITLE_XMLP', 22: 'DYNT_TC_ROW_SELECTOR_NAME', 23: 'DYNT_FOCUS_FRAME'}, 10: {1: 'RESET', 2: 'DEFAULT', 3: 'SUBSCREEN', 4: 'LOOP', 5: 'TABLE', 6: 'NAME', 8: 'TABSTRIP', 9: 'TABSTRIP_PAGE', 10: 'CONTROL', 12: 'XMLPROP', 13: 'SPLITTER', 14: 'SPLITTER_CELL'}, 11: {1: 'MENU_ACT', 2: 'MENU_MNU', 3: 'MENU_PFK', 4: 'MENU_KYB'}, 12: {1: 'MESTYPE', 2: 'SCROLL_INFOS', 3: 'MESTYPE2', 4: 'OKCODE', 5: 'CONTAINER', 6: 'SCROLL_INFOS2', 7: 'AREASIZE', 8: 'AREA_PIXELSIZE', 9: 'SESSION_TITLE', 10: 'SESSION_ICON', 11: 'LIST_CELL_TEXT', 12: 'CONTAINER_LOOP', 13: 'LIST_FOCUS', 14: 'MAINAREA_PIXELSIZE', 15: 'SERVICE_REQUEST'}, 14: {1: 'CONTROL_PROPERTIES'}, 15: {1: 'UI_EVENT_SOURCE'}, 18: {1: 'ACC_LIST_INFO4FIELD', 2: 'ACC_LIST_CONTAINER'}, 19: {1: 'RCUI_STREAM', 2: 'RCUI_SYSTEM_ERROR', 3: 'RCUI_SPAGPA', 4: 'RCUI_MEMORYID', 5: 'RCUI_TXOPTION', 6: 'RCUI_VALUE', 7: 'RCUI_COMMAND', 8: 'RCUI_BDCMSG', 9: 'RCUI_CONNECT_DATA'}, 20: {1: 'GUI_PACKET_STATE', 2: 'GUI_PACKET_DATA'}}Diag APPL/APPL4 SIDs

pysap.SAPDiag.diag_compress_values = {0: 'Compression switched off', 1: 'Compression switched on', 2: 'Data encrypted', 3: 'Data encrypted wrap'}Compression Flag values

pysap.SAPDiag.diag_guess_diagdp_header(self, payload)Guess if the payload is a SAPDiag or SAPDiagDP, base on the mode field. Use this function asguess_payload_class for the SAPNI packet if need to dissect SAPDiag packets.

pysap.SAPDiag.diag_item_appl_classes = {}Dictionary for registering Diag APPL/APPL4 item classes

pysap.SAPDiag.diag_item_classes = {}Dictionary for registering Diag item classes

4.2. Developer Interface 141

Page 146: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

pysap.SAPDiag.diag_item_get_class(pkt, item_type, item_id, item_sid)Obtains the Diag item class according to the type, ID and SID of the packet. If the Type/ID/SID is not registered,returns None.

Parameters

• pkt (SAPDiagItem) – the item to look at

• item_type (int) – function that returns the item type

• item_id (int) – function that returns the item ID

• item_sid (int) – functions that returns the item SID

Returns the associated SAPDiagItem class if registered or None

pysap.SAPDiag.diag_item_get_length(item)Returns the item length according to the item_type

Parameters item (SAPDiagItem) – item to look at

Returns the item length

Return type int

pysap.SAPDiag.diag_item_is_appl_appl4(item)Returns if an item is APPL or APPL4

Parameters item (SAPDiagItem) – item to look a

Returns whether the item is a APPL or APPL4 item

Return type bool

pysap.SAPDiag.diag_item_is_long(item)Returns if the item has a long length field

Parameters item (SAPDiagItem) – item to look at

Returns if the item has a long length field (4 bytes)

Return type bool

pysap.SAPDiag.diag_item_is_short(item)Returns if the item has a short length field

Parameters item (SAPDiagItem) – item to look at

Returns if the item has a short length field (2 bytes)

Return type bool

pysap.SAPDiag.diag_item_types = {1: 'SES', 2: 'ICO', 3: 'TIT', 7: 'DiagMessage', 8: 'OKC', 9: 'CHL', 10: 'SFE', 11: 'SBA', 12: 'EOM', 16: 'APPL', 17: 'DIAG_XMLBLOB', 18: 'APPL4', 19: 'SLC', 21: 'SBA2'}Diag Item Types

142 Chapter 4. Development guide

Page 147: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

pysap.SAPDiagClient module

class pysap.SAPDiagClient.SAPDiagConnection(host, port, terminal=None, com-press=False, init=False, route=None,support_data=<SAPDiagItemitem_type=APPL item_id=ST_USERitem_sid=SUPPORTDATAitem_value=<SAPDiagSupportBitsSAPGUI_IMODE=1SAPGUI_COMPR_ENHANCED=1SAPGUI_FONT_METRIC=1SAPGUI_SYMBOL_RIGHT=1SAPGUI_SELECT_RECT=1SAPGUI_DIAGVERSION=1SAPGUI_LABELS=1PROGRESS_INDICATOR=1RFC_DIALOG=0 INPUT_UPPERCASE=1SAPGUI_TABPROPERTY=1 UPPER-CASE=1 SAPGUI_PUSHBUTTON_1=1SAPGUI_FOCUS_1=1 SAPGUI_TABLE=1SAPGUI_LONG_MESSAGE=1DLGH_FLAGS=1 CONTAINER_TYPE=1OBJECT_NAMES=1 FULL_MENU=1STOP_TRANS=1 MENU_SHORTCUT=1FKEY_TABLE=1 LIST_HOTSPOT=0NORABAX=0 NOMESSAGES=0NOGRAPH=1 GUIAPI=0 TAB-SEL_ATTRIB=1 MESDUM_FLAG1=1MESSAGE_INFO=0 APPL_MNU=1 TA-BLE_SIZE_OK=1 SCROLL_INFOS=1OCX_SUPPORT=0 MESSAGE_VARS=1NEW_BSD_JUSTRIGHT=1 NORFC=0NOSAPSCRIPT=1 NOSYSMSG=0 TAB-SCROLL_INFOS=1 UNKNOWN_1=0TABSTRIP=1 PUSHBUTTON_2=1CONN_WSIZE=0 CURR_TCODE=1VARINFO_OKCODE=1 MES-SAGE_INFO2=1 NEED_STDDYNPRO=0R3INFO_USER_CHECKED=0APPTOOLBAR_FIXED=1CONTROL_CONTAINER=1MULTI_LOGIN_USER=0RFCBLOB_DIAG_PARSER=1NEW_MODE_REQUEST=1TABLE_FIELD_NAMES=1R3INFO_USERID=1 CHECKRA-DIO_EVENTS=1 R3INFO_FLAGS=0 COM-BOBOX_TABLE=1 ISO_LANGUAGE=0INPUT_REQUIRED=1 COMBOBOX=1TYPE_SERVER=0 LABEL_OWNER=0EVENT_DESCRIPTION=1 SCROL-LABLE_TABSTRIP_PAGE=1CONTEXT_MENU=1 WIN16=0NUM_FIELD=1 USER_TURNTIME2=0R3INFO_ROLLCOUNT=0 NOT-GUI=0 R3INFO_IMODEUUID=0VARINFO_CONTAINER=0PROPFONT_VALID=0 TA-BLE_ROW_REFERENCES_2=1 UN-USED_1=0 PROPERTY_BAG=0 CLICK-ABLE_FIELD=0 ENJOY_IMODEUUID=0CTL_PROPCACHE=1 DPLOAD-ONDEMAND=1 JAVA_BEANS=1RFC_COMPRESS=1 RFC_QUEUE=1XML_BLOBS=1 WAN=0 HAS_CACHE=0HEX_FIELD=0 UNUSED_4=0XML_PROPERTIES=1 UNUSED_3=0UNUSED_2=0 KEEP_SCROLLPOS=1RFC_ASYNC_BLOB=1 UN-USED_6=0 COOKIE=0 PROPER-TYPUMP=0 NO_EASYACCESS=0ITS=0 ENJOY_IMODEUUID2=1 UN-USED_5=0 XML_PROP_TABLE=1AREA2FRONT=1 EMER-GENCY_REPAIR=0 CACHED_VSETS=0AUTO_CODEPAGE=1 EN-TRY_HISTORY=0 CONTROL_FOCUS=1DPLOADONDEMAND_WRITE=1SUPPBIT_AREA_SIZE=1 NO-TIFY_NEWMODE=0 SINGLE_SESSION=0UNKNOWN_2=0 PRINTDATA=1 WORK-PLACE=0 EDIT_VARLEN=1 AU-TORESIZE=0 SCROLLBAR_WIDTH=1CONTROL_FOCUS_ON_LIST=1WEBGUI_HELPMODE=0 WE-BGUI=0 DYNAMIC_PASSPORT=1DP_HTTP_PUT=0 XMLPROP_DYNPRO=1XMLPROP_CONTAINER=1 TOOL-BAR_HEIGHT=1 ENABLE_UTF8=1ENJOY_IMODEUUID3=1 ECATT=1ACCESSIBILITY=0 SLC=1GUI_USER_SCRIPTING=1 EOK-DUMMY_1=1 CBU_RBUDUMMY_2=1CBURBU_NEW_STATE=1 GUIPATCH-LEVEL=1 ENABLE_APPL4=1R3INFO_CODEPAGE_APP=1 EN-ABLE_UTF16LE=0 ENABLE_UTF16BE=0VARINFO_ICON_TITLE_LIST=1R3INFO_AUTOLOGOUT_TIME=0GUI_USER_SCRIPTING_INFO=0ACC_LIST=0 VALUE_4_HISTORY=1SPLITTER=1 EVENT_DESCRIPTION_1=1TOP_WINDOW=1 GUI_THEME=1BINARY_EVENTID=1 DE-FAULT_TOOLTIP=1 TAB-SEL_ATTRIB_INPUT=0ACC_LIST_PROPS=0TICKET4GUI=0 FRAME_1=1R3INFO_CODEPAGE_APP_1=1DYNT_NOFOCUS=0 TEXTE-DIT_STREAM=1 RFC_SERVER_4_GUI=0OBJECT_NAMES_4_LOGIN_PROCESS=0ITS_PLUGIN=0 TA-BLE_COLUMNWIDTH_INPUT=0CONTROL_FOCUS_ON_LIST_2=0CELLINFO=1 CBU_RBUDUMMY_3=1XML_PROP_TABLE_2=1 MES-SAGE_INFO3=0 EOKDUMMY_2=1VARINFO_CONTAINER_LOOP=1R3INFO_KERNEL_VERSION=1WEBSAPCONSOLE=0 MENUEN-TRY_WITH_FCODE=0 RCUI=0R3INFO_FLAGS_2=0 MES-SAGE_SERVICE_REQUEST=1TC_KEEP_SCROLL_POSITION=1 DIA-LOG_STEP_NUMBER=1 GUI_PACKET=1DISPLAY_SIZE=1 GUIPATCH-LEVEL_2=1 MAINAREA_SIZE=1SBA2=1 ALLWAYS_SEND_CLIENT=0LIST_FULLWIDTH=0TRACE_GUI_CONNECT=0XMLPROP_LIST_DYNPRO=0STD_TOOLBAR_ITEMS=1VARINFO_CONTAINER_1=1MAX_STRING_LEN=1DYNT_FOCUS_FRAME=1EXTMODE_FONT_METRIC=0 AMC=0IDA_ALV_FRAGMENTS=0 IDA_ALV=0SAP_PERSONAS=0 MAX_WSIZE=0GUI_SIGNATURE_COLOR=0 UN-KNOWN_3=0 AGI_ID_TC=0 AGI_ID=0MSGINFO_WITH_CODEPAGE=0CONNECT_CHECK_DONE=0FIORI_MODE=0 NO_FOCUS_ON_LIST=0AGI_ID_TS_BUTTON=0 GROUPBOX=0padding_bits=0 |> |>)

Bases: object

4.2. Developer Interface 143

Page 148: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

SAP Diag Connection

This class represents a basic client connection to a Diag server. Handles initialization and further interaction bysending/receiving packets.

close()Send an ‘end of connection’ packet and closes the socket

connect()Creates a SAPNIStreamSocket connection to the host/port. If a route was specified, connect to thetarget Diag server through the SAP Router.

get_support_data_item(support_data)

static get_terminal_name()Generates a random IP address to use as a terminal name. In SAP systems that don’t implement SAPNote 1497445, the dispatcher registers logs the terminal name as provided by the client, or fallback toregistering the IP address if the terminal name can’t be resolved. Using a random IP address as terminalname in unpatched systems will make the ‘terminal’ field of the security audit log unreliable.

init()Sends an initialization request. If the socket wasn’t created, call the connect method. If compressionwas specified, the initialization will be performed using the respective User Connect item.

Returns initialization response (usually login screen)

Return type SAPNI

initialized = False

Ivar if the connection was initialized

Type bool

interact(message)Interacts with the SAP Diag server, adding the SAPDiagStep item and ending with a ‘end of message’item.

Parameters message (list of SAPDiagItem) – items to send

Returns server’s response

Return type SAPNI

last_response = None

Ivar stores the last response received from the server

Type SAPNI

receive()Receive a SAPNI packet using the SAPNIStreamSocket. Response is returned and also stored inlast_response.

Returns packet received

Return type SAPNI

send(packet)Sends a packet using the SAPNIStreamSocket

Parameters packet (SAPDiag) – packet to send

send_message(msg)Sends a SAPDiag message, prepending the Diag header.

144 Chapter 4. Development guide

Page 149: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Parameters msg (list of SAPDiagItem) – items to send

sr(packet)Sends and receive a SAPNI packet using the SAPNIStreamSocket

Parameters packet (SAPDiag) – packet to send

Returns packet received

Return type SAPNI

sr_message(msg)Sends and receive a SAPDiag message, prepending the Diag header.

Parameters msg (list of SAPDiagItem) – items to send

Returns server’s response

Return type SAPNI

step = 0

Ivar number of the last dialog step performed

Type int

pysap.SAPDiagItems module

class pysap.SAPDiagItems.SAPDiagAreaSizeBases: pysap.utils.fields.PacketNoPadded

aliastypes = [<class 'pysap.SAPDiagItems.SAPDiagAreaSize'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPDiagAreaSize).window_height>, <Field (SAPDiagAreaSize).window_width>, <Field (SAPDiagAreaSize).area_height>, <Field (SAPDiagAreaSize).area_width>]

class pysap.SAPDiagItems.SAPDiagDyntAtomBases: scapy.packet.Packet

aliastypes = [<class 'pysap.SAPDiagItems.SAPDiagDyntAtom'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPDiagDyntAtom).items>]

class pysap.SAPDiagItems.SAPDiagDyntAtomItemBases: pysap.utils.fields.PacketNoPadded

aliastypes = [<class 'pysap.SAPDiagItems.SAPDiagDyntAtomItem'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPDiagDyntAtomItem).atom_length>, <Field (SAPDiagDyntAtomItem).dlg_flag_1>, <Field (SAPDiagDyntAtomItem).dlg_flag_2>, <Field (SAPDiagDyntAtomItem).etype>, <Field (SAPDiagDyntAtomItem).area>, <Field (SAPDiagDyntAtomItem).block>, <Field (SAPDiagDyntAtomItem).group>, <Field (SAPDiagDyntAtomItem).row>, <Field (SAPDiagDyntAtomItem).col>, <Field (SAPDiagDyntAtomItem).attr_DIAG_BSD_COMBOSTYLE>, <Field (SAPDiagDyntAtomItem).attr_DIAG_BSD_YES3D>, <Field (SAPDiagDyntAtomItem).attr_DIAG_BSD_PROPFONT>, <Field (SAPDiagDyntAtomItem).attr_DIAG_BSD_MATCHCODE>, <Field (SAPDiagDyntAtomItem).attr_DIAG_BSD_JUSTRIGHT>, <Field (SAPDiagDyntAtomItem).attr_DIAG_BSD_INTENSIFY>, <Field (SAPDiagDyntAtomItem).attr_DIAG_BSD_INVISIBLE>, <Field (SAPDiagDyntAtomItem).attr_DIAG_BSD_PROTECTED>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>]

post_build(p, pay)DEV: called right after the current layer is build.

Parameters

• pkt (str) – the current packet (build by self_buil function)

• pay (str) – the packet payload (build by do_build_payload function)

Returns a string of the packet with the payload

class pysap.SAPDiagItems.SAPDiagMenuEntriesBases: scapy.packet.Packet

aliastypes = [<class 'pysap.SAPDiagItems.SAPDiagMenuEntries'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPDiagMenuEntries).entries>]

4.2. Developer Interface 145

Page 150: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

class pysap.SAPDiagItems.SAPDiagMenuEntryBases: pysap.utils.fields.PacketNoPadded

aliastypes = [<class 'pysap.SAPDiagItems.SAPDiagMenuEntry'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPDiagMenuEntry).length>, <Field (SAPDiagMenuEntry).position_1>, <Field (SAPDiagMenuEntry).position_2>, <Field (SAPDiagMenuEntry).position_3>, <Field (SAPDiagMenuEntry).position_4>, <Field (SAPDiagMenuEntry).flag_TERM_??8>, <Field (SAPDiagMenuEntry).flag_TERM_??7>, <Field (SAPDiagMenuEntry).flag_TERM_??6>, <Field (SAPDiagMenuEntry).flag_TERM_VKEY>, <Field (SAPDiagMenuEntry).flag_TERM_SEP>, <Field (SAPDiagMenuEntry).flag_TERM_MEN>, <Field (SAPDiagMenuEntry).flag_TERM_SEL>, <Field (SAPDiagMenuEntry).flag_TERM_??1>, <Field (SAPDiagMenuEntry).virtual_key>, <Field (SAPDiagMenuEntry).return_code_1>, <Field (SAPDiagMenuEntry).return_code_2>, <Field (SAPDiagMenuEntry).return_code_3>, <Field (SAPDiagMenuEntry).return_code_4>, <Field (SAPDiagMenuEntry).return_code_5>, <Field (SAPDiagMenuEntry).return_code_6>, <Field (SAPDiagMenuEntry).function_code_1>, <Field (SAPDiagMenuEntry).function_code_2>, <Field (SAPDiagMenuEntry).function_code_3>, <Field (SAPDiagMenuEntry).function_code_4>, <Field (SAPDiagMenuEntry).function_code_5>, <Field (SAPDiagMenuEntry).function_code_6>, <Field (SAPDiagMenuEntry).text>, <Field (SAPDiagMenuEntry).accelerator>, <Field (SAPDiagMenuEntry).info>]

class pysap.SAPDiagItems.SAPDiagSESBases: pysap.utils.fields.PacketNoPadded

aliastypes = [<class 'pysap.SAPDiagItems.SAPDiagSES'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPDiagSES).eventarray>, <Field (SAPDiagSES).eventid1>, <Field (SAPDiagSES).eventid2>, <Field (SAPDiagSES).eventid3>, <Field (SAPDiagSES).eventid4>, <Field (SAPDiagSES).eventid5>, <Field (SAPDiagSES).screen_flag>, <Field (SAPDiagSES).modal_no>, <Field (SAPDiagSES).x_pos>, <Field (SAPDiagSES).y_pos>, <Field (SAPDiagSES).imode>, <Field (SAPDiagSES).flag_1>, <Field (SAPDiagSES).padd>, <Field (SAPDiagSES).dim_row>, <Field (SAPDiagSES).dim_col>]

class pysap.SAPDiagItems.SAPDiagStepBases: scapy.packet.Packet

aliastypes = [<class 'pysap.SAPDiagItems.SAPDiagStep'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPDiagStep).step>]

class pysap.SAPDiagItems.SAPDiagSupportBitsBases: scapy.packet.Packet

aliastypes = [<class 'pysap.SAPDiagItems.SAPDiagSupportBits'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPDiagSupportBits).SAPGUI_IMODE>, <Field (SAPDiagSupportBits).SAPGUI_COMPR_ENHANCED>, <Field (SAPDiagSupportBits).SAPGUI_FONT_METRIC>, <Field (SAPDiagSupportBits).SAPGUI_SYMBOL_RIGHT>, <Field (SAPDiagSupportBits).SAPGUI_SELECT_RECT>, <Field (SAPDiagSupportBits).SAPGUI_DIAGVERSION>, <Field (SAPDiagSupportBits).SAPGUI_LABELS>, <Field (SAPDiagSupportBits).PROGRESS_INDICATOR>, <Field (SAPDiagSupportBits).RFC_DIALOG>, <Field (SAPDiagSupportBits).INPUT_UPPERCASE>, <Field (SAPDiagSupportBits).SAPGUI_TABPROPERTY>, <Field (SAPDiagSupportBits).UPPERCASE>, <Field (SAPDiagSupportBits).SAPGUI_PUSHBUTTON_1>, <Field (SAPDiagSupportBits).SAPGUI_FOCUS_1>, <Field (SAPDiagSupportBits).SAPGUI_TABLE>, <Field (SAPDiagSupportBits).SAPGUI_LONG_MESSAGE>, <Field (SAPDiagSupportBits).DLGH_FLAGS>, <Field (SAPDiagSupportBits).CONTAINER_TYPE>, <Field (SAPDiagSupportBits).OBJECT_NAMES>, <Field (SAPDiagSupportBits).FULL_MENU>, <Field (SAPDiagSupportBits).STOP_TRANS>, <Field (SAPDiagSupportBits).MENU_SHORTCUT>, <Field (SAPDiagSupportBits).FKEY_TABLE>, <Field (SAPDiagSupportBits).LIST_HOTSPOT>, <Field (SAPDiagSupportBits).NORABAX>, <Field (SAPDiagSupportBits).NOMESSAGES>, <Field (SAPDiagSupportBits).NOGRAPH>, <Field (SAPDiagSupportBits).GUIAPI>, <Field (SAPDiagSupportBits).TABSEL_ATTRIB>, <Field (SAPDiagSupportBits).MESDUM_FLAG1>, <Field (SAPDiagSupportBits).MESSAGE_INFO>, <Field (SAPDiagSupportBits).APPL_MNU>, <Field (SAPDiagSupportBits).TABLE_SIZE_OK>, <Field (SAPDiagSupportBits).SCROLL_INFOS>, <Field (SAPDiagSupportBits).OCX_SUPPORT>, <Field (SAPDiagSupportBits).MESSAGE_VARS>, <Field (SAPDiagSupportBits).NEW_BSD_JUSTRIGHT>, <Field (SAPDiagSupportBits).NORFC>, <Field (SAPDiagSupportBits).NOSAPSCRIPT>, <Field (SAPDiagSupportBits).NOSYSMSG>, <Field (SAPDiagSupportBits).TABSCROLL_INFOS>, <Field (SAPDiagSupportBits).UNKNOWN_1>, <Field (SAPDiagSupportBits).TABSTRIP>, <Field (SAPDiagSupportBits).PUSHBUTTON_2>, <Field (SAPDiagSupportBits).CONN_WSIZE>, <Field (SAPDiagSupportBits).CURR_TCODE>, <Field (SAPDiagSupportBits).VARINFO_OKCODE>, <Field (SAPDiagSupportBits).MESSAGE_INFO2>, <Field (SAPDiagSupportBits).NEED_STDDYNPRO>, <Field (SAPDiagSupportBits).R3INFO_USER_CHECKED>, <Field (SAPDiagSupportBits).APPTOOLBAR_FIXED>, <Field (SAPDiagSupportBits).CONTROL_CONTAINER>, <Field (SAPDiagSupportBits).MULTI_LOGIN_USER>, <Field (SAPDiagSupportBits).RFCBLOB_DIAG_PARSER>, <Field (SAPDiagSupportBits).NEW_MODE_REQUEST>, <Field (SAPDiagSupportBits).TABLE_FIELD_NAMES>, <Field (SAPDiagSupportBits).R3INFO_USERID>, <Field (SAPDiagSupportBits).CHECKRADIO_EVENTS>, <Field (SAPDiagSupportBits).R3INFO_FLAGS>, <Field (SAPDiagSupportBits).COMBOBOX_TABLE>, <Field (SAPDiagSupportBits).ISO_LANGUAGE>, <Field (SAPDiagSupportBits).INPUT_REQUIRED>, <Field (SAPDiagSupportBits).COMBOBOX>, <Field (SAPDiagSupportBits).TYPE_SERVER>, <Field (SAPDiagSupportBits).LABEL_OWNER>, <Field (SAPDiagSupportBits).EVENT_DESCRIPTION>, <Field (SAPDiagSupportBits).SCROLLABLE_TABSTRIP_PAGE>, <Field (SAPDiagSupportBits).CONTEXT_MENU>, <Field (SAPDiagSupportBits).WIN16>, <Field (SAPDiagSupportBits).NUM_FIELD>, <Field (SAPDiagSupportBits).USER_TURNTIME2>, <Field (SAPDiagSupportBits).R3INFO_ROLLCOUNT>, <Field (SAPDiagSupportBits).NOTGUI>, <Field (SAPDiagSupportBits).R3INFO_IMODEUUID>, <Field (SAPDiagSupportBits).VARINFO_CONTAINER>, <Field (SAPDiagSupportBits).PROPFONT_VALID>, <Field (SAPDiagSupportBits).TABLE_ROW_REFERENCES_2>, <Field (SAPDiagSupportBits).UNUSED_1>, <Field (SAPDiagSupportBits).PROPERTY_BAG>, <Field (SAPDiagSupportBits).CLICKABLE_FIELD>, <Field (SAPDiagSupportBits).ENJOY_IMODEUUID>, <Field (SAPDiagSupportBits).CTL_PROPCACHE>, <Field (SAPDiagSupportBits).DPLOADONDEMAND>, <Field (SAPDiagSupportBits).JAVA_BEANS>, <Field (SAPDiagSupportBits).RFC_COMPRESS>, <Field (SAPDiagSupportBits).RFC_QUEUE>, <Field (SAPDiagSupportBits).XML_BLOBS>, <Field (SAPDiagSupportBits).WAN>, <Field (SAPDiagSupportBits).HAS_CACHE>, <Field (SAPDiagSupportBits).HEX_FIELD>, <Field (SAPDiagSupportBits).UNUSED_4>, <Field (SAPDiagSupportBits).XML_PROPERTIES>, <Field (SAPDiagSupportBits).UNUSED_3>, <Field (SAPDiagSupportBits).UNUSED_2>, <Field (SAPDiagSupportBits).KEEP_SCROLLPOS>, <Field (SAPDiagSupportBits).RFC_ASYNC_BLOB>, <Field (SAPDiagSupportBits).UNUSED_6>, <Field (SAPDiagSupportBits).COOKIE>, <Field (SAPDiagSupportBits).PROPERTYPUMP>, <Field (SAPDiagSupportBits).NO_EASYACCESS>, <Field (SAPDiagSupportBits).ITS>, <Field (SAPDiagSupportBits).ENJOY_IMODEUUID2>, <Field (SAPDiagSupportBits).UNUSED_5>, <Field (SAPDiagSupportBits).XML_PROP_TABLE>, <Field (SAPDiagSupportBits).AREA2FRONT>, <Field (SAPDiagSupportBits).EMERGENCY_REPAIR>, <Field (SAPDiagSupportBits).CACHED_VSETS>, <Field (SAPDiagSupportBits).AUTO_CODEPAGE>, <Field (SAPDiagSupportBits).ENTRY_HISTORY>, <Field (SAPDiagSupportBits).CONTROL_FOCUS>, <Field (SAPDiagSupportBits).DPLOADONDEMAND_WRITE>, <Field (SAPDiagSupportBits).SUPPBIT_AREA_SIZE>, <Field (SAPDiagSupportBits).NOTIFY_NEWMODE>, <Field (SAPDiagSupportBits).SINGLE_SESSION>, <Field (SAPDiagSupportBits).UNKNOWN_2>, <Field (SAPDiagSupportBits).PRINTDATA>, <Field (SAPDiagSupportBits).WORKPLACE>, <Field (SAPDiagSupportBits).EDIT_VARLEN>, <Field (SAPDiagSupportBits).AUTORESIZE>, <Field (SAPDiagSupportBits).SCROLLBAR_WIDTH>, <Field (SAPDiagSupportBits).CONTROL_FOCUS_ON_LIST>, <Field (SAPDiagSupportBits).WEBGUI_HELPMODE>, <Field (SAPDiagSupportBits).WEBGUI>, <Field (SAPDiagSupportBits).DYNAMIC_PASSPORT>, <Field (SAPDiagSupportBits).DP_HTTP_PUT>, <Field (SAPDiagSupportBits).XMLPROP_DYNPRO>, <Field (SAPDiagSupportBits).XMLPROP_CONTAINER>, <Field (SAPDiagSupportBits).TOOLBAR_HEIGHT>, <Field (SAPDiagSupportBits).ENABLE_UTF8>, <Field (SAPDiagSupportBits).ENJOY_IMODEUUID3>, <Field (SAPDiagSupportBits).ECATT>, <Field (SAPDiagSupportBits).ACCESSIBILITY>, <Field (SAPDiagSupportBits).SLC>, <Field (SAPDiagSupportBits).GUI_USER_SCRIPTING>, <Field (SAPDiagSupportBits).EOKDUMMY_1>, <Field (SAPDiagSupportBits).CBU_RBUDUMMY_2>, <Field (SAPDiagSupportBits).CBURBU_NEW_STATE>, <Field (SAPDiagSupportBits).GUIPATCHLEVEL>, <Field (SAPDiagSupportBits).ENABLE_APPL4>, <Field (SAPDiagSupportBits).R3INFO_CODEPAGE_APP>, <Field (SAPDiagSupportBits).ENABLE_UTF16LE>, <Field (SAPDiagSupportBits).ENABLE_UTF16BE>, <Field (SAPDiagSupportBits).VARINFO_ICON_TITLE_LIST>, <Field (SAPDiagSupportBits).R3INFO_AUTOLOGOUT_TIME>, <Field (SAPDiagSupportBits).GUI_USER_SCRIPTING_INFO>, <Field (SAPDiagSupportBits).ACC_LIST>, <Field (SAPDiagSupportBits).VALUE_4_HISTORY>, <Field (SAPDiagSupportBits).SPLITTER>, <Field (SAPDiagSupportBits).EVENT_DESCRIPTION_1>, <Field (SAPDiagSupportBits).TOP_WINDOW>, <Field (SAPDiagSupportBits).GUI_THEME>, <Field (SAPDiagSupportBits).BINARY_EVENTID>, <Field (SAPDiagSupportBits).DEFAULT_TOOLTIP>, <Field (SAPDiagSupportBits).TABSEL_ATTRIB_INPUT>, <Field (SAPDiagSupportBits).ACC_LIST_PROPS>, <Field (SAPDiagSupportBits).TICKET4GUI>, <Field (SAPDiagSupportBits).FRAME_1>, <Field (SAPDiagSupportBits).R3INFO_CODEPAGE_APP_1>, <Field (SAPDiagSupportBits).DYNT_NOFOCUS>, <Field (SAPDiagSupportBits).TEXTEDIT_STREAM>, <Field (SAPDiagSupportBits).RFC_SERVER_4_GUI>, <Field (SAPDiagSupportBits).OBJECT_NAMES_4_LOGIN_PROCESS>, <Field (SAPDiagSupportBits).ITS_PLUGIN>, <Field (SAPDiagSupportBits).TABLE_COLUMNWIDTH_INPUT>, <Field (SAPDiagSupportBits).CONTROL_FOCUS_ON_LIST_2>, <Field (SAPDiagSupportBits).CELLINFO>, <Field (SAPDiagSupportBits).CBU_RBUDUMMY_3>, <Field (SAPDiagSupportBits).XML_PROP_TABLE_2>, <Field (SAPDiagSupportBits).MESSAGE_INFO3>, <Field (SAPDiagSupportBits).EOKDUMMY_2>, <Field (SAPDiagSupportBits).VARINFO_CONTAINER_LOOP>, <Field (SAPDiagSupportBits).R3INFO_KERNEL_VERSION>, <Field (SAPDiagSupportBits).WEBSAPCONSOLE>, <Field (SAPDiagSupportBits).MENUENTRY_WITH_FCODE>, <Field (SAPDiagSupportBits).RCUI>, <Field (SAPDiagSupportBits).R3INFO_FLAGS_2>, <Field (SAPDiagSupportBits).MESSAGE_SERVICE_REQUEST>, <Field (SAPDiagSupportBits).TC_KEEP_SCROLL_POSITION>, <Field (SAPDiagSupportBits).DIALOG_STEP_NUMBER>, <Field (SAPDiagSupportBits).GUI_PACKET>, <Field (SAPDiagSupportBits).DISPLAY_SIZE>, <Field (SAPDiagSupportBits).GUIPATCHLEVEL_2>, <Field (SAPDiagSupportBits).MAINAREA_SIZE>, <Field (SAPDiagSupportBits).SBA2>, <Field (SAPDiagSupportBits).ALLWAYS_SEND_CLIENT>, <Field (SAPDiagSupportBits).LIST_FULLWIDTH>, <Field (SAPDiagSupportBits).TRACE_GUI_CONNECT>, <Field (SAPDiagSupportBits).XMLPROP_LIST_DYNPRO>, <Field (SAPDiagSupportBits).STD_TOOLBAR_ITEMS>, <Field (SAPDiagSupportBits).VARINFO_CONTAINER_1>, <Field (SAPDiagSupportBits).MAX_STRING_LEN>, <Field (SAPDiagSupportBits).DYNT_FOCUS_FRAME>, <Field (SAPDiagSupportBits).EXTMODE_FONT_METRIC>, <Field (SAPDiagSupportBits).AMC>, <Field (SAPDiagSupportBits).IDA_ALV_FRAGMENTS>, <Field (SAPDiagSupportBits).IDA_ALV>, <Field (SAPDiagSupportBits).SAP_PERSONAS>, <Field (SAPDiagSupportBits).MAX_WSIZE>, <Field (SAPDiagSupportBits).GUI_SIGNATURE_COLOR>, <Field (SAPDiagSupportBits).UNKNOWN_3>, <Field (SAPDiagSupportBits).AGI_ID_TC>, <Field (SAPDiagSupportBits).AGI_ID>, <Field (SAPDiagSupportBits).MSGINFO_WITH_CODEPAGE>, <Field (SAPDiagSupportBits).CONNECT_CHECK_DONE>, <Field (SAPDiagSupportBits).FIORI_MODE>, <Field (SAPDiagSupportBits).NO_FOCUS_ON_LIST>, <Field (SAPDiagSupportBits).AGI_ID_TS_BUTTON>, <Field (SAPDiagSupportBits).GROUPBOX>, <Field (SAPDiagSupportBits).padding_bits>]

class pysap.SAPDiagItems.SAPDiagUIEventSourceBases: pysap.utils.fields.PacketNoPadded

aliastypes = [<class 'pysap.SAPDiagItems.SAPDiagUIEventSource'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPDiagUIEventSource).valid_unused>, <Field (SAPDiagUIEventSource).valid_functionkey_data>, <Field (SAPDiagUIEventSource).valid_navigation_data>, <Field (SAPDiagUIEventSource).valid_control_pos>, <Field (SAPDiagUIEventSource).valid_menu_pos>, <Field (SAPDiagUIEventSource).event_type>, <Field (SAPDiagUIEventSource).control_type>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPDiagUIEventSource).control_row>, <Field (SAPDiagUIEventSource).control_col>, <Field (SAPDiagUIEventSource).container_nrs>, <Field (SAPDiagUIEventSource).containers>]

class pysap.SAPDiagItems.SAPDiagUserConnectBases: scapy.packet.Packet

aliastypes = [<class 'pysap.SAPDiagItems.SAPDiagUserConnect'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPDiagUserConnect).protocol_version>, <Field (SAPDiagUserConnect).code_page>, <Field (SAPDiagUserConnect).ws_type>]

class pysap.SAPDiagItems.SAPDiagWindowSizeBases: pysap.utils.fields.PacketNoPadded

aliastypes = [<class 'pysap.SAPDiagItems.SAPDiagWindowSize'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPDiagWindowSize).window_height>, <Field (SAPDiagWindowSize).window_width>, <Field (SAPDiagWindowSize).area_height>, <Field (SAPDiagWindowSize).area_width>]

pysap.SAPDiagItems.diag_atom_etypes = {101: 'DIAG_DGOTYP_EFIELD', 102: 'DIAG_DGOTYP_OFIELD', 103: 'DIAG_DGOTYP_KEYWORD', 104: 'DIAG_DGOTYP_CHECKBUTTON_4', 105: 'DIAG_DGOTYP_RADIOBUTTON_0', 106: 'DIAG_DGOTYP_PUSHBUTTON_3', 107: 'DIAG_DGOTYP_FRAME_3', 108: 'DIAG_DGOTYP_LOOP_6', 109: 'DIAG_DGOTYP_SUBSCREEN', 111: 'DIAG_DGOTYP_PROPERTY', 112: 'DIAG_DGOTYP_ICON_0', 113: 'DIAG_DGOTYP_PUSHBUTTON_1', 114: 'DIAG_DGOTYP_FNAME', 115: 'DIAG_DGOTYP_PUSHBUTTON_2', 116: 'DIAG_DGOTYP_TABSTRIP_BUTTON', 117: 'DIAG_DGOTYP_COMBOBOX', 118: 'DIAG_DGOTYP_CHECKBUTTON_1', 119: 'DIAG_DGOTYP_RADIOBUTTON_1', 120: 'DIAG_DGOTYP_XMLPROP', 121: 'DIAG_DGOTYP_EFIELD_1', 122: 'DIAG_DGOTYP_OFIELD_1', 123: 'DIAG_DGOTYP_KEYWORD_1_1', 124: 'DIAG_DGOTYP_CHECKBUTTON_2', 125: 'DIAG_DGOTYP_RADIOBUTTON__0', 126: 'DIAG_DGOTYP_COMBOBOX_1', 127: 'DIAG_DGOTYP_FRAME_1', 128: 'DIAG_DGOTYP_CHECKBUTTON_3', 129: 'DIAG_DGOTYP_RADIOBUTTON_3', 130: 'DIAG_DGOTYP_EFIELD_2', 131: 'DIAG_DGOTYP_OFIELD_2', 132: 'DIAG_DGOTYP_KEYWORD_2'}Dynt Atom item types

pysap.SAPDiagItems.diag_ui_event_control_values = {0: 'NONE', 1: 'FIELD', 2: 'RADIOBUTTON', 3: 'CHECKBUTTON', 4: 'MENUBUTTON', 5: 'TOOLBARBUTTON', 6: 'STANDARDTOOLBARBUTTON', 7: 'PUSHBUTTON', 8: 'TABLEVIEW', 9: 'TABSTRIP', 10: 'DYNPRO', 11: 'CUSTOM_CONTROL', 13: 'FRAME', 14: 'TABLEVIEW_COLSEL_BUTTON', 15: 'TABLEVIEW_ROWSEL_BUTTON', 16: 'TABLEVIEW_CELL', 17: 'CONTEXTMENU', 18: 'SPLITTER', 19: 'MESSAGE', 20: 'OKCODE', 21: 'ACC_CONTAINER'}Diag UI Event Control Type values

pysap.SAPDiagItems.diag_ui_event_navigation_data_values = {1: 'TAB', 2: 'TAB_BACK', 3: 'JUMP_OVER', 4: 'JUMP_OVER_BACK', 5: 'JUMP_OUT', 6: 'JUMP_OUT_BACK', 7: 'JUMP_SECTION', 8: 'JUMP_SECTION_BACK', 9: 'FIRST_FIELD', 10: 'LAST_FIELD'}Diag UI Event Navigation Data values

pysap.SAPDiagItems.diag_ui_event_type_values = {1: 'SELECT', 2: 'HE', 3: 'VALUEHELP', 6: 'RESIZE', 7: 'FUNCTIONKEY', 8: 'SCROLL', 9: 'BUTTONPRESSED', 10: 'VALUECHANGED', 11: 'STATECHANGED', 12: 'NAVIGATION'}Diag UI Event Type values

pysap.SAPEnqueue module

class pysap.SAPEnqueue.SAPEnqueueBases: pysap.utils.fields.PacketNoPadded

146 Chapter 4. Development guide

Page 151: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

SAP Enqueue Server packet

This packet is used for general Enqueue packets.

aliastypes = [<class 'pysap.SAPEnqueue.SAPEnqueue'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPEnqueue).magic_bytes>, <Field (SAPEnqueue).id>, <Field (SAPEnqueue).len>, <Field (SAPEnqueue).len_frag>, <Field (SAPEnqueue).dest>, <Field (SAPEnqueue).opcode>, <Field (SAPEnqueue).more_frags>, <Field (SAPEnqueue).type>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>]

post_build(pkt, pay)Adjust the len and len_frags fields after the build of the whole packet.

class pysap.SAPEnqueue.SAPEnqueueParamBases: pysap.utils.fields.PacketNoPadded

SAP Enqueue Server Connection Admin Parameter packet

aliastypes = [<class 'pysap.SAPEnqueue.SAPEnqueueParam'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPEnqueueParam).param>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>]

class pysap.SAPEnqueue.SAPEnqueueStreamSocket(sock, *args, **kwargs)Bases: pysap.SAPRouter.SAPRoutedStreamSocket

Stream socket implementation of the Enqueue Server protocol. It performs reassemble of received fragmentedpackets to ease use in upper layers.

desc = 'Enqueue Stream socket'

recv()Receive a packet at the Enqueue layer, performing reassemble of fragmented packets if necessary.

Returns received SAPEnqueue packet

Return type SAPEnqueue

Raises socket.error – if the connection was close

class pysap.SAPEnqueue.SAPEnqueueTracePatternBases: pysap.utils.fields.PacketNoPadded

SAP Enqueue Server Admin Trace Pattern

aliastypes = [<class 'pysap.SAPEnqueue.SAPEnqueueTracePattern'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPEnqueueTracePattern).len>, <Field (SAPEnqueueTracePattern).pattern>]

pysap.SAPEnqueue.enqueue_conn_admin_opcode_values = {0: 'Loopback packet', 1: 'Parameter Request', 2: 'Parameter Response', 3: 'Shutdown Read', 4: 'Shutdown Write', 5: 'Shutdown Both', 6: 'Keepalive'}Enqueue Server Opcode values

pysap.SAPEnqueue.enqueue_dest_values = {1: 'SYNC_ENQUEUE', 2: 'ASYNC_ENQUEUE', 3: 'SERVER_ADMIN', 5: 'STAT_QUERY', 6: 'CONECTION_ADMIN', 7: 'ENQ_TO_REP', 8: 'REP_TO_ENQ'}Enqueue Server Destination values

pysap.SAPEnqueue.enqueue_param_values = {0: 'ENCPARAM_RECV_LEN', 1: 'ENCPARAM_SEND_LEN', 2: 'ENCPARAM_MSG_TYPE', 3: 'ENCPARAM_SET_NAME', 4: 'ENCPARAM_SET_NOSUPP', 5: 'ENCPARAM_SET_VERSION', 6: 'ENCPARAM_SET_UCSUPPORT'}Enqueue Server Connection Admin Parameter values

pysap.SAPEnqueue.enqueue_server_admin_opcode_values = {1: 'EnAdmDummyRequest', 2: 'EnAdmShutdownRequest', 4: 'EnAdmGetReplInfoRequest', 6: 'EnAdmTraceRequest'}Enqueue Server Admin Opcode values

pysap.SAPEnqueue.enqueue_server_admin_trace_action_values = {1: 'Raise level', 2: 'Lower level', 3: 'Get trace state', 4: 'Set trace status', 5: 'Reset trace files'}Enqueue Server Admin Trace Action values

pysap.SAPEnqueue.enqueue_server_admin_trace_limit_values = {0: 'Globally', 1: 'Only in enserver', 2: 'Only in repserver', 3: 'Only in threads of type', 4: 'Only in one thread of type'}Enqueue Server Admin Trace Limit values

pysap.SAPEnqueue.enqueue_server_admin_trace_thread_values = {0: 'All threads', 1: 'All I/O threads', 2: 'Enqueue Worker thread', 3: 'Replication thread', 4: 'ADM thread', 5: 'Signal thread', 6: 'Listener thread'}Enqueue Server Admin Trace Thread values

4.2. Developer Interface 147

Page 152: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

pysap.SAPEnqueue.enqueue_type_values = {0: 'SYNC_REQUEST', 1: 'ASYNC_REQUEST', 2: 'RESPONSE'}Enqueue Server Type values

pysap.SAPIGS module

class pysap.SAPIGS.SAPIGSBases: scapy.packet.Packet

SAP Internet Graphic Server call packet

This packet is used for the Remote IGS Function Call protocol.

aliastypes = [<class 'pysap.SAPIGS.SAPIGS'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPIGS).function>, <Field (SAPIGS).listener>, <Field (SAPIGS).hostname>, <Field (SAPIGS).id>, <Field (SAPIGS).padd1>, <Field (SAPIGS).todo1>, <Field (SAPIGS).padd2>, <Field (SAPIGS).todo2>, <Field (SAPIGS).padd3>, <Field (SAPIGS).eye_catch>, <Field (SAPIGS).padd4>, <Field (SAPIGS).codepage>, <Field (SAPIGS).offset_content>, <Field (SAPIGS).packet_size>]

static http(host, port, interpreter, files=None, tls=False, method=’POST’)HTTP request for IGS

This method build a http(s) request for IGS HTTP Multiplexer service instead of Remote IGS FunctionCall

Parameters

• host (string) – remote host to connect to

• port (int) – remote port to connect to

• interpreter (string) – interpreter of function to call

• files (dict) – list of files to send in case of multipart/form-data

• tls (bool) – using https or not

• method (string) – HTTP request method to use

Returns the HTTP request to send as raw

Return type string

Raises ImportError – if the requests library can’t be imported

class pysap.SAPIGS.SAPIGSTableBases: scapy.packet.Packet

SAP IGS table description

Mandatory for RFC call type. This describes table name/width/length where content will be stored.

static add_entry(t_name, t_line, t_width, t_column, c_name, c_width, **kwargs)Add an entry into Table description

This where custom content is stored Entry must be write from the end like : ‘ abcd’

Parameters

• t_name (string) – name of table

• t_line (int) – number of line

• t_width (int) – width of table

• t_column (int) – number of column

• c_name (string) – name of column

• c_width (int) – width of column

148 Chapter 4. Development guide

Page 153: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Returns SAP IGS Table

Return type SAPIGSTable

aliastypes = [<class 'pysap.SAPIGS.SAPIGSTable'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPIGSTable).version_label>, <Field (SAPIGSTable).version>, <Field (SAPIGSTable).table_name_label>, <Field (SAPIGSTable).table_name>, <Field (SAPIGSTable).table_line_label>, <Field (SAPIGSTable).table_line>, <Field (SAPIGSTable).table_width_label>, <Field (SAPIGSTable).table_width>, <Field (SAPIGSTable).table_column_label>, <Field (SAPIGSTable).table_column>, <Field (SAPIGSTable).column_name_label>, <Field (SAPIGSTable).column_name>, <Field (SAPIGSTable).column_width_label>, <Field (SAPIGSTable).column_width>]

pysap.SAPIGS.igs_req_adm = {1: 'ADM:REGPW', 2: 'ADM:UNREGPW', 3: 'ADM:REGIP', 4: 'ADM:UNREGIP', 5: 'ADM:FREEIP', 6: 'ADM:ILLBEBACK', 7: 'ADM:ABORT', 8: 'ADM:PING', 9: 'ADM:PONG', 10: 'ADM:SHUTDOWNIGS', 11: 'ADM:SHUTDOWNPW', 12: 'ADM:CHECKCONSUMER', 13: 'ADM:FREECONSUMER', 14: 'ADM:GETLOGFILE', 15: 'ADM:GETCONFIGFILE', 16: 'ADM:GETDUMP', 17: 'ADM:DELETEDUMP', 18: 'ADM:INSTALL', 19: 'ADM:SWITCH', 20: 'ADM:GETVERSION', 21: 'ADM:STATUS', 22: 'ADM:STATISTIC', 23: 'ADM:STATISTICNEW', 24: 'ADM:GETSTATCHART', 25: 'ADM:SIM'}IGS Request Administrator function

pysap.SAPIGS.igs_req_interpreter = {1: 'ZIPPER', 2: 'IMGCONV', 3: 'RSPOCONNECTOR', 4: 'XMLCHART', 5: 'CHART', 6: 'BWGIS', 7: 'SAPGISXML'}IGS Request Interpreter

pysap.SAPLPS module

class pysap.SAPLPS.SAP_LPS_CipherBases: scapy.packet.Packet

SAP LPS cipher packet. This is the data stored inside an LPS encrypted blob (credential or PSE file). It containsall the required data to decrypt and validate the stored context.

Context length should be <28h Restriction length should be <400h

LPS_DPAPI = 1

LPS_FALLBACK = 0

LPS_TPM = 2

aliastypes = [<class 'pysap.SAPLPS.SAP_LPS_Cipher'>, <class 'scapy.packet.Packet'>]

decrypt()Decrypt a blob using LPS. Implements FALLBACK and DP methods to derive or obtain the encryption keyfrom the one stored in the PSE/credential file and then uses that encryption key to decrypt the credentialusing the AES cipher.

LPS-protected PSEs/credentials are verified with both a CRC32 checksum and an HMAC. Validation ofthe checksum and HMAC is not implemented.

Requires the cryptography library installed.

Returns decrypted object

Return type string

Raises

• Exception – if the cryptography library is not available

• NotImplemented – if the LPS method is not implemented

• SAP_LPS_Decryption_Error – if there’s an error decrypting the object

decrypt_encryption_key_dpapi()Decrypts the encryption key using the DP API. The key is encrypted using the DP API without any addi-tional entropy.

Returns Encryption key decrypted

Return type string

decrypt_encryption_key_fallback()Decrypts the encryption key using the FALLBACK method. In this method, the context string, usually

4.2. Developer Interface 149

Page 154: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

“CredEncryption” or “PSEEncryption”, is encrypted using a derivation of a fixed key hardcoded in Com-monCryptoLib, and used as key to encrypt the actual encryption key used in the file with the AES cipher.

Returns Encryption key decrypted

Return type string

decrypt_encryption_key_tpm()Decrypts the encryption key using the TPM method.

Returns Encryption key decrypted

Return type string

fields_desc = [<Field (SAP_LPS_Cipher).version>, <Field (SAP_LPS_Cipher).lps_type>, <Field (SAP_LPS_Cipher).context_length>, <Field (SAP_LPS_Cipher).context>, <Field (SAP_LPS_Cipher).restriction_length>, <Field (SAP_LPS_Cipher).restriction>, <Field (SAP_LPS_Cipher).encrypted_key_length>, <Field (SAP_LPS_Cipher).encrypted_key>, <Field (SAP_LPS_Cipher).unknown_length>, <Field (SAP_LPS_Cipher).unknown>, <Field (SAP_LPS_Cipher).encrypted_data_length>, <Field (SAP_LPS_Cipher).encrypted_data>, <Field (SAP_LPS_Cipher).hmac>, <Field (SAP_LPS_Cipher).checksum>]

lps_types = {0: 'FALLBACK', 1: 'DPAPI', 2: 'TPM'}LPS types

exception pysap.SAPLPS.SAP_LPS_Decryption_ErrorBases: exceptions.Exception

pysap.SAPLPS.cred_key_lps_fallback = '\xe7j\xd2\xceK\xa7\xc7\x9e\xf9y_\xa8.n\xaa\x1dv\x02.\xcd\xd7t8Q'Fixed key embedded in CommonCryptoLib for encrypted credentials using LPS in fallback mode

pysap.SAPLPS.lps_encryption_key_decryptor = {0: <unbound method SAP_LPS_Cipher.decrypt_encryption_key_fallback>, 1: <unbound method SAP_LPS_Cipher.decrypt_encryption_key_dpapi>, 2: <unbound method SAP_LPS_Cipher.decrypt_encryption_key_tpm>}LPS encryption key decryptor functions

pysap.SAPMS module

class pysap.SAPMS.SAPDPInfo1Bases: scapy.packet.Packet

SAP Dispatcher Info packet

This packet is encapsulated inside SAPMS packet and before the MS ADM payload. Kernel 745

aliastypes = [<class 'pysap.SAPMS.SAPDPInfo1'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPDPInfo1).dp_req_prio>, <Field (SAPDPInfo1).dp_user_trace>, <Field (SAPDPInfo1).dp_req_len>, <Field (SAPDPInfo1).dp_padd3>, <Field (SAPDPInfo1).dp_padd4>, <Field (SAPDPInfo1).dp_type_from>, <Field (SAPDPInfo1).dp_fromname>, <Field (SAPDPInfo1).dp_padd41>, <Field (SAPDPInfo1).dp_padd42>, <Field (SAPDPInfo1).dp_agent_type_from>, <Field (SAPDPInfo1).dp_padd43>, <Field (SAPDPInfo1).dp_padd44>, <Field (SAPDPInfo1).dp_worker_type_from>, <Field (SAPDPInfo1).dp_worker_from_num>, <Field (SAPDPInfo1).dp_padd6>, <Field (SAPDPInfo1).dp_padd7>, <Field (SAPDPInfo1).dp_addr_from_t>, <Field (SAPDPInfo1).dp_padd8>, <Field (SAPDPInfo1).dp_addr_from_u>, <Field (SAPDPInfo1).dp_addr_from_m>, <Field (SAPDPInfo1).dp_padd9>, <Field (SAPDPInfo1).dp_respid_from>, <Field (SAPDPInfo1).dp_padd10>, <Field (SAPDPInfo1).dp_padd11>, <Field (SAPDPInfo1).dp_type_to>, <Field (SAPDPInfo1).dp_toname>, <Field (SAPDPInfo1).dp_padd51>, <Field (SAPDPInfo1).dp_padd52>, <Field (SAPDPInfo1).dp_agent_type_to>, <Field (SAPDPInfo1).dp_padd54>, <Field (SAPDPInfo1).dp_padd55>, <Field (SAPDPInfo1).dp_worker_type_to>, <Field (SAPDPInfo1).dp_worker_to_num>, <Field (SAPDPInfo1).dp_padd01>, <Field (SAPDPInfo1).dp_padd02>, <Field (SAPDPInfo1).dp_addr_to_t>, <Field (SAPDPInfo1).dp_padd03>, <Field (SAPDPInfo1).dp_addr_to_u>, <Field (SAPDPInfo1).dp_addr_to_m>, <Field (SAPDPInfo1).dp_padd21>, <Field (SAPDPInfo1).dp_respid_to>, <Field (SAPDPInfo1).dp_padd22>, <Field (SAPDPInfo1).dp_padd23>, <Field (SAPDPInfo1).dp_req_handler>, <Field (SAPDPInfo1).dp_req_rc>, <Field (SAPDPInfo1).dp_blob_padding>, <Field (SAPDPInfo1).dp_blob_56>, <Field (SAPDPInfo1).dp_blob_57>, <Field (SAPDPInfo1).dp_blob_worker_from_num>, <Field (SAPDPInfo1).dp_blob_worker_type_from>, <Field (SAPDPInfo1).dp_blob_62>, <Field (SAPDPInfo1).dp_blob_addr_from_t>, <Field (SAPDPInfo1).dp_blob_addr_from_u>, <Field (SAPDPInfo1).dp_blob_worker_type_to>, <Field (SAPDPInfo1).dp_blob_63>, <Field (SAPDPInfo1).dp_blob_respid_from>, <Field (SAPDPInfo1).dp_blob_64>, <Field (SAPDPInfo1).dp_blob_dst>, <Field (SAPDPInfo1).dp_blob_xx>, <Field (SAPDPInfo1).dp_blob_yy>]

class pysap.SAPMS.SAPDPInfo2Bases: scapy.packet.Packet

SAP Dispatcher Info packet

This packet is encapsulated inside SAPMS packet and before the MS ADM payload. Kernel 720.

aliastypes = [<class 'pysap.SAPMS.SAPDPInfo2'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPDPInfo2).dp_req_prio>, <Field (SAPDPInfo2).dp_blob_00>, <Field (SAPDPInfo2).dp_blob_01>, <Field (SAPDPInfo2).dp_blob_02>, <Field (SAPDPInfo2).dp_blob_03>, <Field (SAPDPInfo2).dp_blob_04>, <Field (SAPDPInfo2).dp_blob_05>, <Field (SAPDPInfo2).dp_addr_from_t>, <Field (SAPDPInfo2).dp_blob_06>, <Field (SAPDPInfo2).dp_blob_07>, <Field (SAPDPInfo2).dp_blob_08>, <Field (SAPDPInfo2).dp_blob_09>, <Field (SAPDPInfo2).dp_blob_10>, <Field (SAPDPInfo2).dp_addr_from_m>, <Field (SAPDPInfo2).dp_addr_from_u>, <Field (SAPDPInfo2).dp_blob_11>, <Field (SAPDPInfo2).dp_blob_12>, <Field (SAPDPInfo2).dp_blob_13>, <Field (SAPDPInfo2).dp_blob_14>, <Field (SAPDPInfo2).dp_name_to>, <Field (SAPDPInfo2).dp_blob_15>, <Field (SAPDPInfo2).dp_addr_to_t>, <Field (SAPDPInfo2).dp_addr_to_u>, <Field (SAPDPInfo2).dp_addr_to_m>, <Field (SAPDPInfo2).dp_blob_16>, <Field (SAPDPInfo2).dp_respid_to>, <Field (SAPDPInfo2).dp_blob_17>, <Field (SAPDPInfo2).dp_blob_18>, <Field (SAPDPInfo2).dp_blob_19>, <Field (SAPDPInfo2).dp_blob_20>, <Field (SAPDPInfo2).dp_blob_21>]

class pysap.SAPMS.SAPDPInfo3Bases: scapy.packet.Packet

SAP Dispatcher Info packet

This packet is encapsulated inside SAPMS packet and before the MS ADM payload. Kernel 749.

aliastypes = [<class 'pysap.SAPMS.SAPDPInfo3'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPDPInfo3).dp_padd1>, <Field (SAPDPInfo3).dp_req_prio>, <Field (SAPDPInfo3).dp_padd2>, <Field (SAPDPInfo3).dp_padd3>, <Field (SAPDPInfo3).dp_padd4>, <Field (SAPDPInfo3).dp_req_len>, <Field (SAPDPInfo3).dp_padd5>, <Field (SAPDPInfo3).dp_padd6>, <Field (SAPDPInfo3).dp_type_from>, <Field (SAPDPInfo3).dp_fromname>, <Field (SAPDPInfo3).dp_padd7>, <Field (SAPDPInfo3).dp_padd8>, <Field (SAPDPInfo3).dp_agent_type_from>, <Field (SAPDPInfo3).dp_padd9>, <Field (SAPDPInfo3).dp_padd10>, <Field (SAPDPInfo3).dp_padd12>, <Field (SAPDPInfo3).dp_padd13>, <Field (SAPDPInfo3).dp_worker_type_from>, <Field (SAPDPInfo3).dp_worker_from_num>, <Field (SAPDPInfo3).dp_padd133>, <Field (SAPDPInfo3).dp_padd111>, <Field (SAPDPInfo3).dp_padd11>, <Field (SAPDPInfo3).dp_addr_from_t>, <Field (SAPDPInfo3).dp_padd14>, <Field (SAPDPInfo3).dp_addr_from_u>, <Field (SAPDPInfo3).dp_addr_from_m>, <Field (SAPDPInfo3).dp_padd15>, <Field (SAPDPInfo3).dp_respid_from>, <Field (SAPDPInfo3).dp_padd16>, <Field (SAPDPInfo3).dp_padd17>, <Field (SAPDPInfo3).dp_type_to>, <Field (SAPDPInfo3).dp_toname>, <Field (SAPDPInfo3).dp_padd18>, <Field (SAPDPInfo3).dp_padd19>, <Field (SAPDPInfo3).dp_agent_type_to>, <Field (SAPDPInfo3).dp_padd20>, <Field (SAPDPInfo3).dp_padd21>, <Field (SAPDPInfo3).dp_worker_type_to>, <Field (SAPDPInfo3).dp_padd22>, <Field (SAPDPInfo3).dp_worker_to_num>, <Field (SAPDPInfo3).dp_padd222>, <Field (SAPDPInfo3).dp_padd23>, <Field (SAPDPInfo3).dp_addr_to_t>, <Field (SAPDPInfo3).dp_padd24>, <Field (SAPDPInfo3).dp_addr_to_u>, <Field (SAPDPInfo3).dp_addr_from_m>, <Field (SAPDPInfo3).dp_padd25>, <Field (SAPDPInfo3).dp_respid_to>, <Field (SAPDPInfo3).dp_padd26>, <Field (SAPDPInfo3).dp_padd27>, <Field (SAPDPInfo3).dp_req_handler>, <Field (SAPDPInfo3).dp_padd28>, <Field (SAPDPInfo3).dp_padd29>, <Field (SAPDPInfo3).dp_padd30>, <Field (SAPDPInfo3).dp_padd31>, <Field (SAPDPInfo3).dp_padd32>]

150 Chapter 4. Development guide

Page 155: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

class pysap.SAPMS.SAPMSBases: scapy.packet.Packet

SAP Message Server packet

This packet is used for the Message Server protocol.

aliastypes = [<class 'pysap.SAPMS.SAPMS'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPMS).eyecatcher>, <Field (SAPMS).version>, <Field (SAPMS).errorno>, <Field (SAPMS).toname>, <Field (SAPMS).msgtype>, <Field (SAPMS).reserved>, <Field (SAPMS).domain>, <Field (SAPMS).reserved>, <Field (SAPMS).key>, <Field (SAPMS).flag>, <Field (SAPMS).iflag>, <Field (SAPMS).fromname>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>]

class pysap.SAPMS.SAPMSAdmRecordBases: pysap.utils.fields.PacketNoPadded

SAP Message Server Administration Record packet

Packet for Message Server administration records. Each administration package has a variable number ofrecords, each one specifies an operation to execute.

aliastypes = [<class 'pysap.SAPMS.SAPMSAdmRecord'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPMSAdmRecord).opcode>, <Field (SAPMSAdmRecord).serial_number>, <Field (SAPMSAdmRecord).executed>, <Field (SAPMSAdmRecord).errorno>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>]

class pysap.SAPMS.SAPMSClient1Bases: pysap.utils.fields.PacketNoPadded

SAP Message Server Client packet version 1

Packet that contains information about a client of the Message Server service. This packet is for version 1,which has been seen only on old releases (SAP NW 2004s).

aliastypes = [<class 'pysap.SAPMS.SAPMSClient1'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPMSClient1).client>, <Field (SAPMSClient1).host>, <Field (SAPMSClient1).service>, <Field (SAPMSClient1).msgtype>, <Field (SAPMSClient1).hostaddrv4>, <Field (SAPMSClient1).servno>]

class pysap.SAPMS.SAPMSClient2Bases: pysap.utils.fields.PacketNoPadded

SAP Message Server Client packet version 2

Packet that contains information about a client of the Message Server service. This packet is for version 2,which has been seen only on old releases (SAP NW 2004s).

aliastypes = [<class 'pysap.SAPMS.SAPMSClient2'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPMSClient2).client>, <Field (SAPMSClient2).host>, <Field (SAPMSClient2).service>, <Field (SAPMSClient2).msgtype>, <Field (SAPMSClient2).hostaddrv4>, <Field (SAPMSClient2).servno>, <Field (SAPMSClient2).status>, <Field (SAPMSClient2).nitrace>, <Field (SAPMSClient2).padd>]

class pysap.SAPMS.SAPMSClient3Bases: scapy.packet.Packet

SAP Message Server Client packet version 3

Packet that contains information about a client of the Message Server service. This packet is for version 3.

aliastypes = [<class 'pysap.SAPMS.SAPMSClient3'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPMSClient3).client>, <Field (SAPMSClient3).host>, <Field (SAPMSClient3).service>, <Field (SAPMSClient3).msgtype>, <Field (SAPMSClient3).hostaddrv6>, <Field (SAPMSClient3).hostaddrv4>, <Field (SAPMSClient3).servno>, <Field (SAPMSClient3).status>, <Field (SAPMSClient3).nitrace>, <Field (SAPMSClient3).padd>]

class pysap.SAPMS.SAPMSClient4Bases: pysap.utils.fields.PacketNoPadded

SAP Message Server Client packet version 4

Packet that contains information about a client of the Message Server service. This packet is for version 4.

aliastypes = [<class 'pysap.SAPMS.SAPMSClient4'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPMSClient4).client>, <Field (SAPMSClient4).host>, <Field (SAPMSClient4).service>, <Field (SAPMSClient4).msgtype>, <Field (SAPMSClient4).hostaddrv6>, <Field (SAPMSClient4).hostaddrv4>, <Field (SAPMSClient4).servno>, <Field (SAPMSClient4).status>, <Field (SAPMSClient4).nitrace>, <Field (SAPMSClient4).sys_service>, <Field (SAPMSClient4).padd>]

4.2. Developer Interface 151

Page 156: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

class pysap.SAPMS.SAPMSCounterBases: pysap.utils.fields.PacketNoPadded

SAP Message Server Counter packet.

Packet containing information about a Counter.

aliastypes = [<class 'pysap.SAPMS.SAPMSCounter'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPMSCounter).uuid>, <Field (SAPMSCounter).count>, <Field (SAPMSCounter).no>]

class pysap.SAPMS.SAPMSJ2EEClusterBases: scapy.packet.Packet

SAP Message Server J2EE Cluster packet

This packet is used for the Message Server protocol for J2EE cluster nodes.

aliastypes = [<class 'pysap.SAPMS.SAPMSJ2EECluster'>, <class 'scapy.packet.Packet'>]

cluster_no = 68199

cluster_no_id = 68354

fields_desc = [<Field (SAPMSJ2EECluster).cluster_id>, <Field (SAPMSJ2EECluster).group_id>, <Field (SAPMSJ2EECluster).join_port>, <Field (SAPMSJ2EECluster).name>, <Field (SAPMSJ2EECluster).host>, <Field (SAPMSJ2EECluster).hostaddrv4>, <Field (SAPMSJ2EECluster).type>, <Field (SAPMSJ2EECluster).state>, <Field (SAPMSJ2EECluster).service_mask>, <Field (SAPMSJ2EECluster).version>, <Field (SAPMSJ2EECluster).modifiers>, <Field (SAPMSJ2EECluster).reserved>, <Field (SAPMSJ2EECluster).hostaddrv6>]

icm_port = 5020

node_no = 5

class pysap.SAPMS.SAPMSJ2EEHeaderBases: scapy.packet.Packet

SAP Message Server J2EE Header packet

This packet is used for the Message Server protocol for J2EE nodes.

aliastypes = [<class 'pysap.SAPMS.SAPMSJ2EEHeader'>, <class 'scapy.packet.Packet'>]

cluster_no = 68199

fields_desc = [<Field (SAPMSJ2EEHeader).sender_cluster_id>, <Field (SAPMSJ2EEHeader).cluster_id>, <Field (SAPMSJ2EEHeader).service_id>, <Field (SAPMSJ2EEHeader).group_id>, <Field (SAPMSJ2EEHeader).node_type>, <Field (SAPMSJ2EEHeader).total_length>, <Field (SAPMSJ2EEHeader).current_length>, <Field (SAPMSJ2EEHeader).current_offset>, <Field (SAPMSJ2EEHeader).total_blocks>, <Field (SAPMSJ2EEHeader).current_block>, <Field (SAPMSJ2EEHeader).message_type>]

class pysap.SAPMS.SAPMSJ2EEServiceBases: pysap.utils.fields.PacketNoPadded

SAP Message Server J2EE Service packet

This packet is used to describe a J2EE service.

aliastypes = [<class 'pysap.SAPMS.SAPMSJ2EEService'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPMSJ2EEService).service_id>, <Field (SAPMSJ2EEService).attached_nodes>, <Field (SAPMSJ2EEService).name>]

class pysap.SAPMS.SAPMSLogonBases: pysap.utils.fields.PacketNoPadded

SAP Message Server Logon packet.

Packet containing logon data.

aliastypes = [<class 'pysap.SAPMS.SAPMSLogon'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPMSLogon).type>, <Field (SAPMSLogon).port>, <Field (SAPMSLogon).address>, <Field (SAPMSLogon).logonname_length>, <Field (SAPMSLogon).logonname>, <Field (SAPMSLogon).prot_length>, <Field (SAPMSLogon).prot>, <Field (SAPMSLogon).host_length>, <Field (SAPMSLogon).host>, <Field (SAPMSLogon).misc_length>, <Field (SAPMSLogon).misc>, <Field (SAPMSLogon).address6_length>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>]

class pysap.SAPMS.SAPMSPropertyBases: scapy.packet.Packet

SAP Message Server Property packet.

152 Chapter 4. Development guide

Page 157: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Packet containing information about properties.

aliastypes = [<class 'pysap.SAPMS.SAPMSProperty'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPMSProperty).client>, <Field (SAPMSProperty).id>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>]

class pysap.SAPMS.SAPMSStat3Bases: pysap.utils.fields.PacketNoPadded

SAP Message Server Statistics version 3

Packet that contains statistics information of the Message Server service. This packet is for version 3.

aliastypes = [<class 'pysap.SAPMS.SAPMSStat3'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPMSStat3).active>, <Field (SAPMSStat3).version>, <Field (SAPMSStat3).unused1>, <Field (SAPMSStat3).no_requests>, <Field (SAPMSStat3).no_requests_padd>, <Field (SAPMSStat3).no_error>, <Field (SAPMSStat3).no_error_padd>, <Field (SAPMSStat3).no_login>, <Field (SAPMSStat3).no_login_padd>, <Field (SAPMSStat3).no_logout>, <Field (SAPMSStat3).no_logout_padd>, <Field (SAPMSStat3).no_send_by_name>, <Field (SAPMSStat3).no_send_by_name_padd>, <Field (SAPMSStat3).no_send_by_type>, <Field (SAPMSStat3).no_send_by_type_padd>, <Field (SAPMSStat3).no_adm_messages>, <Field (SAPMSStat3).no_adm_messages_padd>, <Field (SAPMSStat3).no_adms>, <Field (SAPMSStat3).no_amds_padd>, <Field (SAPMSStat3).no_adm_type>, <Field (SAPMSStat3).no_mod_types>, <Field (SAPMSStat3).no_mod_types_padd>, <Field (SAPMSStat3).no_opcodes_rcvd>, <Field (SAPMSStat3).no_opcodes_rcvd_padd>, <Field (SAPMSStat3).no_opcodes_send>, <Field (SAPMSStat3).no_opcodes_send_padd>, <Field (SAPMSStat3).no_opcodes>, <Field (SAPMSStat3).no_opcode_type>, <Field (SAPMSStat3).no_keepalive_send>, <Field (SAPMSStat3).no_keepalive_send_padd>, <Field (SAPMSStat3).no_keepalive_rcvd>, <Field (SAPMSStat3).no_keepalive_rcvd_padd>, <Field (SAPMSStat3).no_keepalive_disc>, <Field (SAPMSStat3).no_keepalive_disc_padd>, <Field (SAPMSStat3).no_bytes_read>, <Field (SAPMSStat3).no_bytes_read_padd>, <Field (SAPMSStat3).no_bytes_written>, <Field (SAPMSStat3).no_bytes_written_padd>, <Field (SAPMSStat3).no_clients>, <Field (SAPMSStat3).sta_time>, <Field (SAPMSStat3).act_time>]

pysap.SAPMS.dp_agent_type_values = {0: 'INVALID', 1: 'DISP', 2: 'GATEWAY', 3: 'ICMAN', 4: 'TERMINAL', 5: 'MSG', 6: 'WORKER', 7: 'EXT-EVT', 8: 'STARTSRV', 9: 'DPMON', 10: 'ICMON'}Message Server Dispatcher Info Agent Type values

pysap.SAPMS.dp_prio_values = {0: 'LOW', 1: 'MEDIUM', 2: 'HIGH'}Message Server Dispatcher Info Priority values

pysap.SAPMS.dp_req_handler_values = {2: 'REQ_HANDLER_GUI', 8: 'REQ_HANDLER_UPDATE', 10: 'REQ_HANDLER_UPDATE2', 12: 'REQ_HANDLER_UPDATE_ADMIN', 13: 'REQ_HANDLER_UPDATE_ADMIN_RESP', 38: 'REQ_HANDLER_RPC', 40: 'REQ_HANDLER_ADM', 41: 'REQ_HANDLER_ADM_RESP', 42: 'REQ_HANDLER_MSG_SERVER', 43: 'REQ_HANDLER_MSG_SERVER_RESP', 44: 'REQ_HANDLER_BTC', 80: 'REQ_HANDLER_SHUTDOWN', 84: 'REQ_HANDLER_PROCESS', 86: 'REQ_HANDLER_REGISTER_PROCESS', 111: 'REQ_HANDLER_AUTOJAVA_RESP', 112: 'REQ_HANDLER_VMC_RUNTIME', 124: 'REQ_HANDLER_SERVER_STARTUP', 130: 'REQ_HANDLER_SUSPEND_SERVER', 132: 'REQ_HANDLER_RESUME_SERVER'}Message Server Dispatcher Info Request Handler values

pysap.SAPMS.dp_type_values = {0: 'INVALID', 1: 'LOCAL', 2: 'BY_NAME', 3: 'BY_TYPE', 4: 'MSG_SRV'}Message Server Dispatcher Info Type values

pysap.SAPMS.dp_worker_type_values = {0: 'NOWP', 1: 'DIA', 2: 'UPD', 3: 'ENQ', 4: 'BTC', 5: 'SPO', 6: 'UP2'}Message Server Dispatcher Info Worker Type values

pysap.SAPMS.ms_adm_opcode_values = {0: 'AD_GENERAL', 1: 'AD_PROFILE', 2: 'AD_WPSTAT', 3: 'AD_QUEUE', 4: 'AD_STARTSTOP', 5: 'AD_WPCONF', 6: 'AD_USRLST', 7: 'AD_WPKILL', 8: 'AD_TIMEINFO', 9: 'AD_TM_RECONNECT', 10: 'AD_ALRT_GET_STATE', 11: 'AD_ALRT_OPERATION', 12: 'AD_ALRT_SET_PARAM', 13: 'AD_DB_RECONNECT', 14: 'AD_ECHO', 15: 'AD_MSGSERVER', 16: 'AD_WPCONF2', 17: 'AD_GENERAL2', 18: 'AD_SET_LIST_PARAM', 19: 'AD_DUMP_STATUS', 20: 'AD_RZL', 21: 'AD_RZL_STRG', 22: 'AD_COUNT_WPS', 23: 'AD_QUEUE2', 25: 'AD_EM', 26: 'AD_ES', 27: 'AD_SHUTDOWN_STATE', 28: 'AD_SHUTDOWN_INFO', 29: 'AD_SHUTDOWN_ERROR', 31: 'AD_DISPLACE', 32: 'AD_GET_TIMETAB', 33: 'AD_SET_TIMETAB', 40: 'AD_MSBUF', 41: 'AD_ARFC_NOREQ', 42: 'AD_ENQID_INFO', 43: 'AD_DEL_USER', 44: 'AD_SPO_ADM', 45: 'AD_NTAB_SYNC', 46: 'AD_SHARED_PARAMETER', 47: 'AD_RESET_TRACE', 48: 'AD_RESET_USR02', 49: 'AD_WALL_CREATE', 50: 'AD_WALL_DELETE', 51: 'AD_WALL_MODIFY', 52: 'AD_SERVER_STATE', 60: 'AD_SELFIDENT', 61: 'AD_DP_TRACE_CHANGE', 62: 'AD_DP_DUMP_NIHDL', 63: 'AD_DP_CALL_DELAYED', 64: 'AD_GW_ADM', 65: 'AD_DP_WAKEUP_MODE', 66: 'AD_VMC_SYS_EVENT', 67: 'AD_SHARED_PARAM_ALL_WPS', 68: 'AD_SECSESSION_UPDATE', 69: 'AD_SECSESSION_TERMINATE', 70: 'AD_ASRF_REQUEST', 71: 'AD_GET_NILIST', 72: 'AD_LOAD_INFO', 73: 'AD_TEST', 74: 'AD_HANDLE_ACL', 75: 'AD_PROFILE2', 76: 'AD_RSCP_ASYNC', 77: 'AD_BATCH_INFO', 78: 'AD_SOFT_CANCEL', 85: 'AD_SYNC_LOAD_FMT', 86: 'AD_GET_NILIST_PORT', 90: 'AD_UNKNOWN'}Message Server Administration messages opcode values

pysap.SAPMS.ms_adm_rzl_strg_type_values = {10: 'STRG_TYPE_READALL', 11: 'STRG_TYPE_READALL_I', 12: 'STRG_TYPE_READALL_C', 13: 'STRG_TYPE_READALL_LC', 15: 'STRG_TYPE_READALL_OFFSET_I', 16: 'STRG_TYPE_READALL_OFFSET_C', 17: 'STRG_TYPE_READALL_OFFSET_LC', 20: 'STRG_TYPE_READALL_OFFSET', 21: 'STRG_TYPE_READ_I', 22: 'STRG_TYPE_READ_C', 23: 'STRG_TYPE_READ_LC', 31: 'STRG_TYPE_WRITE_I', 32: 'STRG_TYPE_WRITE_C', 33: 'STRG_TYPE_WRITE_LC', 41: 'STRG_TYPE_DEL_I', 42: 'STRG_TYPE_DEL_C', 43: 'STRG_TYPE_DEL_LC', 51: 'STRG_TYPE_CREATE_I', 52: 'STRG_TYPE_CREATE_C', 53: 'STRG_TYPE_CREATE_LC', 90: 'STRG_TYPE_DUMP'}Message Server Administration Messages AD_RZL_STRG string types values

pysap.SAPMS.ms_adm_type_values = {1: 'ADM_REQUEST', 2: 'ADM_REPLY'}Message Server Administration messages type values

pysap.SAPMS.ms_client_status_values = {0: 'MS_STATE_UNKNOWN', 1: 'ACTIVE', 2: 'INACTIVE', 3: 'MS_STATE_SHUTDOWN', 4: 'MS_STATE_STOP', 5: 'MS_STATE_STARTING', 6: 'MS_STATE_INIT'}Message Server Client status values

pysap.SAPMS.ms_domain_values = {0: 'ABAP', 1: 'J2EE', 2: 'JSTARTUP'}Message Server Domain values

pysap.SAPMS.ms_dump_command_values = {1: 'MS_DUMP_MSADM', 2: 'MS_DUMP_CON', 3: 'MS_DUMP_PARAMS', 4: 'MS_DUMP_ALL_CLIENTS', 5: 'MS_DUMP_ALL_SERVER', 6: 'MS_DUMP_ALL_DOMAIN', 7: 'MS_DUMP_DOMAIN_CONN', 8: 'MS_DUMP_RELEASE', 9: 'MS_DUMP_SIZEOF', 10: 'MS_DUMP_FIADM', 11: 'MS_DUMP_FICON', 12: 'MS_DUMP_COUNTER', 13: 'MS_DUMP_STATISTIC', 14: 'MS_DUMP_NIBUF', 15: 'MS_DUMP_URLMAP', 16: 'MS_DUMP_URLPREFIX', 17: 'MS_DUMP_URLHANDLER', 18: 'MS_DUMP_NOSERVER', 19: 'MS_DUMP_ACLINFO', 20: 'MS_DUMP_PERMISSION_TABLE', 21: 'MS_DUMP_J2EE_CLUSTER_STAT', 22: 'MS_DUMP_ACL_FILE_EXT', 23: 'MS_DUMP_ACL_FILE_INT', 24: 'MS_DUMP_ACL_FILE_ADMIN', 25: 'MS_DUMP_ACL_FILE_EXTBND', 26: 'MS_DUMP_ACL_FILE_HTTP', 27: 'MS_DUMP_ACL_FILE_HTTPS'}Message Server Dump Info ID Values

pysap.SAPMS.ms_errorno_values = {0: 'MSERECONNECTION', 1: 'MSENISELWRITE', 2: 'MSENISELREAD', 3: 'MSENIQUEUE', 4: 'MSENILAYER', 71: 'MSETESTSOFTSHUTDOWN', 72: 'MSENOTINIT', 73: 'MSEALREADYINIT', 74: 'MSEINVHDL', 75: 'MSEWRONGSERVER', 76: 'MSEMOREDATA', 77: 'MSESNDTYPEFAILED', 78: 'MSEDUPKEY', 79: 'MSESOFTSHUTDOWN', 81: 'MSENOMEM', 82: 'MSEHEADERINCOMPLETE', 83: 'MSETYPESNOTALLOWED', 84: 'MSEACCESSDENIED', 85: 'MSEWRITEINCOMPLETE', 86: 'MSEREADINCOMPLETE', 87: 'MSEADMIN', 88: 'MSESOCKTOOLARGE', 89: 'MSENOSLOTFREE', 90: 'MSESHUTDOWN', 91: 'MSEREPLYTOOLARGE', 92: 'MSEWRONGVERSION', 93: 'MSEMSGDESTROYED', 94: 'MSENOTUNIQUE', 95: 'MSEPARTNERUNKNOWN', 96: 'MSEPARTNERDIED', 97: 'MSEWRONGTYPE', 98: 'MSEWRONGNAME', 99: 'MSEWAKEUP', 100: 'MSENOTFOUND', 101: 'MSEINVAL', 102: 'MSENOMSG', 103: 'MSEINTERN'}Message Server Error values

pysap.SAPMS.ms_file_reload_values = {1: 'MS_RELOAD_CLIENT_TAB', 2: 'MS_RELOAD_SERVER_TAB', 3: 'MS_RELOAD_DOMAIN_TAB', 4: 'MS_RELOAD_URLMAP', 5: 'MS_RELOAD_URLPREFIX', 6: 'MS_RELOAD_ACL_INFO', 7: 'MS_RELOAD_PERMISSION_TABLE', 8: 'MS_RELOAD_STOC', 9: 'MS_RELOAD_ACL_FILE_EXT', 10: 'MS_RELOAD_ACL_FILE_INT', 11: 'MS_RELOAD_ACL_FILE_ADMIN', 12: 'MS_RELOAD_ACL_FILE_EXTBND', 13: 'MS_RELOAD_ACL_FILE_HTTP', 14: 'MS_RELOAD_ACL_FILE_HTTPS'}Message Server File Reload values

pysap.SAPMS.ms_flag_values = {0: 'MS_UNKNOWN', 1: 'MS_ONE_WAY', 2: 'MS_REQUEST', 3: 'MS_REPLY', 4: 'MS_ADMIN'}Message Server Flag values

pysap.SAPMS.ms_iflag_values = {0: 'MS_UNKNOWN', 1: 'MS_SEND_NAME', 2: 'MS_SEND_TYPE', 3: 'MS_LOGIN', 4: 'MS_LOGOUT', 5: 'MS_ADM_OPCODES', 6: 'MS_MOD_MSGTYPES', 7: 'MS_SEND_TYPE_ONCE', 8: 'MS_LOGIN_2', 9: 'MS_MOD_STATE', 10: 'MS_J2EE_LOGIN', 12: 'MS_J2EE_SEND_TO_CLUSTERID', 13: 'MS_J2EE_SEND_BROADCAST', 14: 'MS_SEND_TYPE_ACK', 15: 'MS_J2EE_LOGIN_2', 16: 'MS_SEND_SERVICE', 17: 'MS_J2EE_LOGIN_3', 18: 'MS_J2EE_LOGIN_4'}Message Server IFlag values

pysap.SAPMS.ms_logon_type_values = {0: 'MS_LOGON_DIAG_LB', 1: 'MS_LOGON_DIAG_LBS', 2: 'MS_LOGON_DIAG', 3: 'MS_LOGON_DIAGS', 4: 'MS_LOGON_RFC', 5: 'MS_LOGON_RFCS', 6: 'MS_LOGON_HTTP', 7: 'MS_LOGON_HTTPS', 8: 'MS_LOGON_FTP', 9: 'MS_LOGON_SMTP', 10: 'MS_LOGON_NNTP', 11: 'MS_LOGON_DIAG_E', 12: 'MS_LOGON_DIAGS_E', 13: 'MS_LOGON_RFC_E', 14: 'MS_LOGON_RFCS_E', 15: 'MS_LOGON_HTTP_E', 16: 'MS_LOGON_HTTPS_E', 17: 'MS_LOGON_FTP_E', 18: 'MS_LOGON_SMTP_E', 19: 'MS_LOGON_NNTP_E', 20: 'MS_LOGON_J2EE', 21: 'MS_LOGON_J2EES', 22: 'MS_LOGON_J2EE_E', 23: 'MS_LOGON_J2EES_E', 24: 'MS_LOGON_P4', 25: 'MS_LOGON_P4S', 26: 'MS_LOGON_IIOP', 27: 'MS_LOGON_IIOPS', 28: 'MS_LOGON_SDM', 29: 'MS_LOGON_TELNET', 30: 'MS_LOGON_DEBUG', 31: 'MS_LOGON_DPROXY', 32: 'MS_LOGON_P4HTTP', 33: 'MS_LOGON_HTTPRI', 34: 'MS_LOGON_HTTPSRI', 35: 'MS_LOGON_J2EERI', 36: 'MS_LOGON_J2EESRI', 37: 'MS_LOGON_TRXNS'}Message Server Logon type values

4.2. Developer Interface 153

Page 158: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

pysap.SAPMS.ms_opcode_error_values = {0: 'MSOP_OK', 1: 'MSOP_UNKNOWN_OPCODE', 2: 'MSOP_NOMEM', 3: 'MSOP_SECURITY_KEY_NOTSET', 4: 'MSOP_UNKNOWN_CLIENT', 5: 'MSOP_ACCESS_DENIED', 6: 'MSOP_REQUEST_REQUIRED', 7: 'MSOP_NAME_REQUIRED', 8: 'MSOP_GET_HWID_FAILED', 9: 'MSOP_SEND_FAILED', 10: 'MSOP_UNKNOWN_DOMAIN', 11: 'MSOP_UNKNOWN_SERVER', 12: 'MSOP_NO_DOMAIN_SERVER', 13: 'MSOP_INVALID_URL', 14: 'MSOP_UNKNOWN_DUMP_REQ', 15: 'MSOP_FILENOTFOUND', 16: 'MSOP_UNKNOWN_RELOAD_REQ', 17: 'MSOP_FILENOTDEFINED', 18: 'MSOP_CONVERT_FAILED', 19: 'MSOP_NOTSET', 20: 'MSOP_COUNTER_EXCEEDED', 21: 'MSOP_COUNTER_NOTFOUND', 22: 'MSOP_COUNTER_DELETED', 23: 'MSOP_COUNTER_EXISTS', 24: 'MSOP_EINVAL', 25: 'MSOP_NO_J2EE_CLUSTERNODE', 26: 'MSOP_UNKNOWN_PROPERTY', 27: 'MSOP_UNKNOWN_VERSION', 28: 'MSOP_ICTERROR', 29: 'MSOP_KERNEL_INCOMPATIBLE', 30: 'MSOP_NIACLCREATE_FAILED', 31: 'MSOP_NIACLSYNTAX_ERROR'}Message Server OpCode Error Values

pysap.SAPMS.ms_opcode_values = {0: 'MS_DP_ADM', 1: 'MS_SERVER_CHG', 2: 'MS_SERVER_ADD', 3: 'MS_SERVER_SUB', 4: 'MS_SERVER_MOD', 5: 'MS_SERVER_LST', 6: 'MS_CHANGE_IP', 7: 'MS_SET_SECURITY_KEY', 8: 'MS_GET_SECURITY_KEY', 9: 'MS_GET_SECURITY_KEY2', 10: 'MS_GET_HWID', 11: 'MS_INCRE_TRACE', 12: 'MS_DECRE_TRACE', 13: 'MS_RESET_TRACE', 14: 'MS_ACT_STATISTIC', 15: 'MS_DEACT_STATISTIC', 16: 'MS_RESET_STATISTIC', 17: 'MS_GET_STATISTIC', 18: 'MS_DUMP_NIBUFFER', 19: 'MS_RESET_NIBUFFER', 20: 'MS_OPEN_REQ_LST', 21: 'MS_SERVER_INFO', 22: 'MS_SERVER_LIST', 23: 'MS_SERVER_ENTRY', 24: 'MS_DOMAIN_INFO', 25: 'MS_DOMAIN_LIST', 26: 'MS_DOMAIN_ENTRY', 27: 'MS_MAP_URL_TO_ADDR', 28: 'MS_GET_CODEPAGE', 29: 'MS_SOFT_SHUTDOWN', 30: 'MS_DUMP_INFO', 31: 'MS_FILE_RELOAD', 32: 'MS_RESET_DOMAIN_CONN', 33: 'MS_NOOP', 34: 'MS_SET_TXT', 35: 'MS_GET_TXT', 36: 'MS_COUNTER_CREATE', 37: 'MS_COUNTER_DELETE', 38: 'MS_COUNTER_INCREMENT', 39: 'MS_COUNTER_DECREMENT', 40: 'MS_COUNTER_REGISTER', 41: 'MS_COUNTER_GET', 42: 'MS_COUNTER_LST', 43: 'MS_SET_LOGON', 44: 'MS_GET_LOGON', 45: 'MS_DEL_LOGON', 46: 'MS_SERVER_DISC', 47: 'MS_SERVER_SHUTDOWN', 48: 'MS_SERVER_SOFT_SHUTDOWN', 49: 'MS_J2EE_CLUSTERNODE_CHG', 50: 'MS_J2EE_CLUSTERNODE_ADD', 51: 'MS_J2EE_CLUSTERNODE_SUB', 52: 'MS_J2EE_CLUSTERNODE_MOD', 53: 'MS_J2EE_CLUSTERNODE_LST', 54: 'MS_J2EE_SERVICE_REG', 55: 'MS_J2EE_SERVICE_UNREG', 56: 'MS_J2EE_SERVICE_LST', 57: 'MS_J2EE_SERVICE_ADD', 58: 'MS_J2EE_SERVICE_SUB', 59: 'MS_J2EE_SERVICE_MOD', 60: 'MS_J2EE_MOD_STATE', 61: 'MS_J2EE_SERVICE_GET', 62: 'MS_J2EE_SERVICE_REG2', 63: 'MS_NITRACE_SETGET', 64: 'MS_SERVER_LONG_LIST', 65: 'MS_J2EE_DEBUG_ENABLE', 66: 'MS_J2EE_DEBUG_DISABLE', 67: 'MS_SET_PROPERTY', 68: 'MS_GET_PROPERTY', 69: 'MS_DEL_PROPERTY', 70: 'MS_IP_PORT_TO_NAME', 71: 'MS_CHECK_ACL', 72: 'MS_LICENSE_SRV', 74: 'MS_SERVER_TEST_SOFT_SHUTDOWN', 75: 'MS_J2EE_RECONNECT_P1', 76: 'MS_J2EE_RECONNECT_P2'}Message Server OpCode values

pysap.SAPMS.ms_property_id_values = {1: 'MS_PROPERTY_TEXT', 2: 'MS_PROPERTY_VHOST', 3: 'MS_PROPERTY_IPADR', 4: 'MS_PROPERTY_PARAM', 5: 'MS_PROPERTY_SERVICE', 6: 'MS_PROPERTY_DELALT', 7: 'Release information'}Message Server Property ID Values

pysap.SAPNI module

class pysap.SAPNI.SAPNIBases: scapy.packet.Packet

SAP NI (Network Interface) packet

This packet is used for craft Network Interface packets. It serves only as a container for packets in the differentprotocols. As this protocol is used by different protocols and the only way to differentiate each one is by theTCP port used, each script using the NI protocol must bind the respective layer with the respective protocol.

For example, a script using the SAP Diag protocol must include the following binds:

bind_layers(SAPNI, SAPDiag, )bind_layers(SAPNI, SAPDiagDP, )bind_layers(SAPDiagDP, SAPDiag, )bind_layers(SAPDiag, SAPDiagItem, )bind_layers(SAPDiagItem,SAPDiagItem, )

SAPNI_PING = 'NI_PING\x00'

Cvar Constant for keep-alive request messages (NI_PING)

Type C{string}

SAPNI_PONG = 'NI_PONG\x00'

Cvar Constant for keep-alive response messages (NI_PONG)

Type C{string}

aliastypes = [<class 'pysap.SAPNI.SAPNI'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPNI).length>]

class pysap.SAPNI.SAPNIClientBases: object

Stub class for a client connecting to the SAP NI server.

class pysap.SAPNI.SAPNIProxy(bind_address, bind_port, remote_address, remote_port, handler,backlog=5, keep_alive=True, options=None)

Bases: object

SAP NI Proxy

It works by setting a listener SAPNIStreamSocket and dispatching client’s requests to a given handler class.

Example usage:: proxy = SAPNIProxy(local_host, local_port, remote_host, remote_port, handler_class)proxy.handle_connection()

handle_connection()Block until a connection is received from the listener and handle that client using the provided handlerclass.

154 Chapter 4. Development guide

Page 159: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Returns the handler instance handling the request

Return type SAPNIProxyHandler

stop()Stop the proxy by closing the listener socket.

class pysap.SAPNI.SAPNIProxyHandler(client, server, options=None)Bases: object

SAP NI Proxy Handler

Handles NI packets. Works spawning one thread for processing data coming from each pair of client/server.

process_client(packet)This method is called each time a packet arrives from the client. It must return a packet in the same layer(SAPNI). Stub method to be overloaded in subclasses.

Parameters packet (Packet) – the packet to be processed

process_server(packet)This method is called each time a packet arrives from the server. It must return a packet in the same layer(SAPNI). Stub method to be overloaded in subclasses.

Parameters packet (Packet) – the packet to be processed

recv_send(local, remote, process)Receives data from one socket connection, process it and send to the remote connection.

Parameters

• local (SAPNIStreamSocket) – the local socket

• remote (SAPNIStreamSocket) – the remote socket

• process (function) – the function that process the incoming data

stop_workers()Stop the processor workers

class pysap.SAPNI.SAPNIServer(server_address, RequestHandlerClass, bind_and_activate=True,socket_cls=None, keep_alive=True, base_cls=None)

Bases: SocketServer.TCPServer

Base SAP NI Server class.

Subclasses must define a client class for keeping state information on the connected clients.

Example usage:: server = SAPNIServer((local_host, local_port), handler_class) server.client_cls =client_class server.serve_forever()

clients_cls

Cvar Client class for storing data about new clients

Type SAPNIClient class

alias of SAPNIClient

get_request()Wrap the socket object with a SAPNIStreamSocket after accepting a connection.

handle_error(request, client_address)Called to handle an error or exception occurred with the server.

options = None

Ivar Options to pass to the request handler

4.2. Developer Interface 155

Page 160: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Type object

shutdown_request(request)Called to shutdown and close an individual request.

class pysap.SAPNI.SAPNIServerHandler(request, client_address, server)Bases: SocketServer.BaseRequestHandler

SAP NI Server Handler

Handles SAPNI packets coming from a SAPNIServer.

close()Close a client connection and deletes the client from the state information on the server.

handle()Handle a client connection. The handler assumes the client connection is a SAPNIStreamSocketobject. After received a SAPNI packet, it stores it on the ‘packet’ instance variable and pass the control tothe handle_data method.

handle_data()Handle the data coming from the client. The SAPNI packet is stored on data and client information onclient_address instance variables. Stub method to be overloaded in subclasses.

setup()Setup a new client connection. Creates a new client object for keeping state information of each client onthe server instance.

class pysap.SAPNI.SAPNIServerThreaded(server_address, RequestHandlerClass,bind_and_activate=True, socket_cls=None,keep_alive=True, base_cls=None)

Bases: SocketServer.ThreadingMixIn, pysap.SAPNI.SAPNIServer

A SAP NI Server implementation using threading

class pysap.SAPNI.SAPNIStreamSocket(sock, keep_alive=True, base_cls=None)Bases: scapy.supersocket.StreamSocket

Stream socket implementation of the SAP Network Interface (NI) layer.

desc = 'NI Stream socket'

classmethod get_nisocket(host, port, **kwargs)Helper function to obtain a SAPNIStreamSocket.

Parameters

• host (C{string}) – host to connect to

• port (int) – port to connect to

• kwargs – arguments to pass to SAPNIStreamSocket constructor

Returns connected socket

Return type SAPNIStreamSocket

Raises socket.error – if the connection to the target host/port failed

recv()Receive a packet at the NI layer, first reading the length field and the reading the data. If the stream iswaiting for a new packet and the remote peer sends a keep-alive request (NI_PING), the receive methodwill respond with a keep-alive response (NI_PONG) to keep the communication stable.

Returns received SAPNI packet

156 Chapter 4. Development guide

Page 161: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Return type SAPNI

Raises socket.error – if the connection was close

send(packet)Send a packet at the NI layer, prepending the length field.

Parameters packet (Packet) – packet to send

sr(packet)Send a given packet and receive the response. Wrapper around the send and receive methods. The responsepacket is build in the SAPNI layer.

Parameters packet (Packet) – packet to send

Returns packet received

Return type Packet

pysap.SAPPSE module

class pysap.SAPPSE.ASN1F_PSE_v2_ENC_CONT_SEQUENCE(*seq, **kwargs)Bases: scapy.asn1fields.ASN1F_SEQUENCE

ASN1_tag = <ASN1Tag v2_ENC_CONT[160]>

class pysap.SAPPSE.ASN1F_PSE_v4_ENC_CONT_SEQUENCE(*seq, **kwargs)Bases: scapy.asn1fields.ASN1F_SEQUENCE

ASN1_tag = <ASN1Tag v4_ENC_CONT[163]>

class pysap.SAPPSE.ASN1_Class_PSEBases: scapy.asn1.asn1.ASN1_Class_UNIVERSAL

ANY = <ASN1Tag ANY[0]>

BIT_STRING = <ASN1Tag BIT_STRING[3]>

BMP_STRING = <ASN1Tag BMP_STRING[30]>

BOOLEAN = <ASN1Tag BOOLEAN[1]>

CHAR_STRING = <ASN1Tag CHAR_STRING[29]>

COUNTER32 = <ASN1Tag COUNTER32[65]>

EMBEDDED_PDF = <ASN1Tag EMBEDDED_PDF[11]>

ENUMERATED = <ASN1Tag ENUMERATED[10]>

ERROR = <ASN1Tag ERROR[-3]>

EXTERNAL = <ASN1Tag EXTERNAL[8]>

GAUGE32 = <ASN1Tag GAUGE32[66]>

GENERALIZED_TIME = <ASN1Tag GENERALIZED_TIME[24]>

GENERAL_STRING = <ASN1Tag GENERAL_STRING[27]>

GRAPHIC_STRING = <ASN1Tag GRAPHIC_STRING[25]>

IA5_STRING = <ASN1Tag IA5_STRING[22]>

INTEGER = <ASN1Tag INTEGER[2]>

IPADDRESS = <ASN1Tag IPADDRESS[64]>

4.2. Developer Interface 157

Page 162: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

ISO646_STRING = <ASN1Tag ISO646_STRING[26]>

NONE = <ASN1Tag NONE[-1]>

NULL = <ASN1Tag NULL[5]>

NUMERIC_STRING = <ASN1Tag NUMERIC_STRING[18]>

OBJECT_DESCRIPTOR = <ASN1Tag OBJECT_DESCRIPTOR[7]>

OID = <ASN1Tag OID[6]>

PRINTABLE_STRING = <ASN1Tag PRINTABLE_STRING[19]>

RAW = <ASN1Tag RAW[-2]>

REAL = <ASN1Tag REAL[9]>

RELATIVE_OID = <ASN1Tag RELATIVE_OID[13]>

SEQUENCE = <ASN1Tag SEQUENCE[48]>

SET = <ASN1Tag SET[49]>

STRING = <ASN1Tag STRING[4]>

T61_STRING = <ASN1Tag T61_STRING[20]>

TIME_TICKS = <ASN1Tag TIME_TICKS[67]>

UNIVERSAL_STRING = <ASN1Tag UNIVERSAL_STRING[28]>

UTC_TIME = <ASN1Tag UTC_TIME[23]>

UTF8_STRING = <ASN1Tag UTF8_STRING[12]>

VIDEOTEX_STRING = <ASN1Tag VIDEOTEX_STRING[21]>

name = 'PSE'

v2_ENC_CONT = <ASN1Tag v2_ENC_CONT[160]>

v4_ENC_CONT = <ASN1Tag v4_ENC_CONT[163]>

class pysap.SAPPSE.ASN1_PSE_v2_ENC_CONT_SEQUENCE(val)Bases: scapy.asn1.asn1.ASN1_SEQUENCE

tag = <ASN1Tag v2_ENC_CONT[160]>

class pysap.SAPPSE.ASN1_PSE_v4_ENC_CONT_SEQUENCE(val)Bases: scapy.asn1.asn1.ASN1_SEQUENCE

tag = <ASN1Tag v4_ENC_CONT[163]>

class pysap.SAPPSE.BERcodec_PSE_v2_ENC_CONT_SEQUENCEBases: scapy.asn1.ber.BERcodec_SEQUENCE

tag = <ASN1Tag v2_ENC_CONT[160]>

class pysap.SAPPSE.BERcodec_PSE_v4_ENC_CONT_SEQUENCEBases: scapy.asn1.ber.BERcodec_SEQUENCE

tag = <ASN1Tag v4_ENC_CONT[163]>

class pysap.SAPPSE.PKCS12_PBE1_ParametersBases: scapy.asn1packet.ASN1_Packet

PKCS12 PBE1 Parameters

ASN1_codec = <ASN1Codec BER[1]>

158 Chapter 4. Development guide

Page 163: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_STRING object>, <scapy.asn1fields.ASN1F_INTEGER object>)>

aliastypes = [<class 'pysap.SAPPSE.PKCS12_PBE1_Parameters'>, <class 'scapy.asn1packet.ASN1_Packet'>, <class 'scapy.packet.Packet'>]

fields_desc = [<scapy.asn1fields.ASN1F_STRING object>, <scapy.asn1fields.ASN1F_INTEGER object>]

class pysap.SAPPSE.PKCS5_Algorithm_IdentifierBases: scapy.asn1packet.ASN1_Packet

PKCS5 Algorithm Identifier

ASN1_codec = <ASN1Codec BER[1]>

ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_OID object>, <scapy.asn1fields.ASN1F_optional object>)>

aliastypes = [<class 'pysap.SAPPSE.PKCS5_Algorithm_Identifier'>, <class 'scapy.asn1packet.ASN1_Packet'>, <class 'scapy.packet.Packet'>]

fields_desc = [<scapy.asn1fields.ASN1F_OID object>, <scapy.asn1fields.ASN1F_CHOICE object>]

class pysap.SAPPSE.PKCS5_Salt_ParameterBases: scapy.asn1packet.ASN1_Packet

PKCS5 Salt Parameter

ASN1_codec = <ASN1Codec BER[1]>

ASN1_root = <scapy.asn1fields.ASN1F_STRING object>

aliastypes = [<class 'pysap.SAPPSE.PKCS5_Salt_Parameter'>, <class 'scapy.asn1packet.ASN1_Packet'>, <class 'scapy.packet.Packet'>]

fields_desc = [<scapy.asn1fields.ASN1F_STRING object>]

class pysap.SAPPSE.SAPPSEFileBases: scapy.asn1packet.ASN1_Packet

SAP PSE definition

ASN1_codec = <ASN1Codec BER[1]>

ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_INTEGER object>, <scapy.asn1fields.ASN1F_CHOICE object>)>

aliastypes = [<class 'pysap.SAPPSE.SAPPSEFile'>, <class 'scapy.asn1packet.ASN1_Packet'>, <class 'scapy.packet.Packet'>]

decrypt(pin)Decrypts a PSE file given a provided PIN. Calls the respective decryption function based on the PSEversion.

decrypt_lps(pin)Decrypts an LPS encrypted PSE file given a provided PIN.

Parameters pin (string) –

Returns decrypted object

Return type SAPPSE_Cont

Raises

• ValueError – if the provided PIN doesn’t match with the one used for encryption

• NotImplementedError – if the algorithm specified is not supported

• Exception – if the algorithm specified is not valid

decrypt_non_lps(pin)Decrypts a non-LPS encrypted PSE file given a provided PIN. Implements PKCS12 PBE1 based encryp-tion for v2 PSE files.

Parameters pin (string) –

4.2. Developer Interface 159

Page 164: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

Returns decrypted object

Return type SAPPSE_Cont

Raises

• ValueError – if the provided PIN doesn’t match with the one used for encryption

• NotImplementedError – if the algorithm specified is not supported

• Exception – if the algorithm specified is not valid

fields_desc = [<scapy.asn1fields.ASN1F_INTEGER object>, <scapy.asn1fields.ASN1F_CHOICE object>]

class pysap.SAPPSE.SAPPSE_ContBases: scapy.asn1packet.ASN1_Packet

SAP PSEv2 Content definition

ASN1_codec = <ASN1Codec BER[1]>

ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_GENERALIZED_TIME object>, <scapy.asn1fields.ASN1F_INTEGER object>, <ASN1F_SET_OF pse_obj>)>

aliastypes = [<class 'pysap.SAPPSE.SAPPSE_Cont'>, <class 'scapy.asn1packet.ASN1_Packet'>, <class 'scapy.packet.Packet'>]

fields_desc = [<scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_GENERALIZED_TIME object>, <scapy.asn1fields.ASN1F_INTEGER object>, <ASN1F_SET_OF pse_obj>]

class pysap.SAPPSE.SAPPSE_ObjBases: scapy.asn1packet.ASN1_Packet

SAP PSEv2 Object definition

ASN1_codec = <ASN1Codec BER[1]>

ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_PRINTABLE_STRING object>, <scapy.asn1fields.ASN1F_GENERALIZED_TIME object>, <scapy.asn1fields.ASN1F_OID object>, <pysap.utils.fields.ASN1F_CHOICE_SAFE object>)>

aliastypes = [<class 'pysap.SAPPSE.SAPPSE_Obj'>, <class 'scapy.asn1packet.ASN1_Packet'>, <class 'scapy.packet.Packet'>]

fields_desc = [<scapy.asn1fields.ASN1F_PRINTABLE_STRING object>, <scapy.asn1fields.ASN1F_GENERALIZED_TIME object>, <scapy.asn1fields.ASN1F_OID object>, <pysap.utils.fields.ASN1F_CHOICE_SAFE object>]

class pysap.SAPPSE.SAPPSE_Obj_CertListBases: scapy.asn1packet.ASN1_Packet

SAP PSEv2 CertList, CSet, SignCSet, EncCSet Object definition

ASN1_codec = <ASN1Codec BER[1]>

ASN1_root = <ASN1F_SET_OF certs>

aliastypes = [<class 'pysap.SAPPSE.SAPPSE_Obj_CertList'>, <class 'scapy.asn1packet.ASN1_Packet'>, <class 'scapy.packet.Packet'>]

fields_desc = [<ASN1F_SET_OF certs>]

class pysap.SAPPSE.SAPPSE_Obj_PKListBases: scapy.asn1packet.ASN1_Packet

SAP PSEv2 PKList, EKList, PCAList Object definition

ASN1_codec = <ASN1Codec BER[1]>

ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_enum_INTEGER object>, <scapy.asn1fields.ASN1F_INTEGER object>, <scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_PACKET object>)>

aliastypes = [<class 'pysap.SAPPSE.SAPPSE_Obj_PKList'>, <class 'scapy.asn1packet.ASN1_Packet'>, <class 'scapy.packet.Packet'>]

fields_desc = [<scapy.asn1fields.ASN1F_enum_INTEGER object>, <scapy.asn1fields.ASN1F_INTEGER object>, <scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_PACKET object>]

class pysap.SAPPSE.SAPPSE_Obj_PKRootBases: scapy.asn1packet.ASN1_Packet

SAP PSEv2 PKRoot Object definition

160 Chapter 4. Development guide

Page 165: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

ASN1_codec = <ASN1Codec BER[1]>

ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_PACKET object>)>

aliastypes = [<class 'pysap.SAPPSE.SAPPSE_Obj_PKRoot'>, <class 'scapy.asn1packet.ASN1_Packet'>, <class 'scapy.packet.Packet'>]

fields_desc = [<scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_PACKET object>]

class pysap.SAPPSE.SAPPSE_Root_KeyBases: scapy.asn1packet.ASN1_Packet

SAP PSEv2 Root Key definition

ASN1_codec = <ASN1Codec BER[1]>

ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_enum_INTEGER object>, <scapy.asn1fields.ASN1F_INTEGER object>, <scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_BIT_STRING object>)>

aliastypes = [<class 'pysap.SAPPSE.SAPPSE_Root_Key'>, <class 'scapy.asn1packet.ASN1_Packet'>, <class 'scapy.packet.Packet'>]

fields_desc = [<scapy.asn1fields.ASN1F_enum_INTEGER object>, <scapy.asn1fields.ASN1F_INTEGER object>, <scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_BIT_STRING object>]

class pysap.SAPPSE.SAPPSEv2_Enc_ContBases: scapy.asn1packet.ASN1_Packet

SAP PSEv2 Encrypted content definition

ASN1_codec = <ASN1Codec BER[1]>

ASN1_root = <ASN1F_PSE_v2_ENC_CONT_SEQUENCE(<scapy.asn1fields.ASN1F_STRING object>, <scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_STRING object>)>

aliastypes = [<class 'pysap.SAPPSE.SAPPSEv2_Enc_Cont'>, <class 'scapy.asn1packet.ASN1_Packet'>, <class 'scapy.packet.Packet'>]

fields_desc = [<scapy.asn1fields.ASN1F_STRING object>, <scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_STRING object>]

class pysap.SAPPSE.SAPPSEv4_Enc_ContBases: scapy.asn1packet.ASN1_Packet

SAP PSEv4 Encrypted content definition

ASN1_codec = <ASN1Codec BER[1]>

ASN1_root = <ASN1F_PSE_v4_ENC_CONT_SEQUENCE(<scapy.asn1fields.ASN1F_INTEGER object>, <scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_STRING object>, <scapy.asn1fields.ASN1F_STRING object>)>

aliastypes = [<class 'pysap.SAPPSE.SAPPSEv4_Enc_Cont'>, <class 'scapy.asn1packet.ASN1_Packet'>, <class 'scapy.packet.Packet'>]

fields_desc = [<scapy.asn1fields.ASN1F_INTEGER object>, <scapy.asn1fields.ASN1F_PACKET object>, <scapy.asn1fields.ASN1F_STRING object>, <scapy.asn1fields.ASN1F_STRING object>]

pysap.SAPRFC module

class pysap.SAPRFC.DEF_FIELDSBases: pysap.utils.fields.PacketNoPadded

SAP RFC Def Fields structure

aliastypes = [<class 'pysap.SAPRFC.DEF_FIELDS'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (DEF_FIELDS).start_padd>, <Field (DEF_FIELDS).start_field1_len>, <Field (DEF_FIELDS).start_field1>]

class pysap.SAPRFC.SAPCPICBases: pysap.utils.fields.PacketNoPadded

SAP CPIC Packet

aliastypes = [<class 'pysap.SAPRFC.SAPCPIC'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPCPIC).cpic_start_padd>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd0003>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd0002>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd0001>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd001>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd002>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd003>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd004>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd005>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd006>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd007>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd008>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd009>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd010>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd011>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd012>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd013>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd014>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd015_0>, <Field (SAPCPIC).cpic_padd015_1>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd016>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd017>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd018>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd019>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd020>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd021>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd022>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd023>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_padd024>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_end_padd>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC).cpic_end_sig>]

4.2. Developer Interface 161

Page 166: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

class pysap.SAPRFC.SAPCPIC2Bases: pysap.utils.fields.PacketNoPadded

SAP CPIC2 Packet

aliastypes = [<class 'pysap.SAPRFC.SAPCPIC2'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPCPIC2).cpic_padd015_1>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC2).cpic_padd016>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC2).cpic_padd017>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC2).cpic_padd018>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC2).cpic_padd019>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC2).cpic_padd021>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC2).cpic_padd022>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC2).cpic_padd023>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC2).cpic_padd024>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC2).cpic_end_padd>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPIC2).cpic_end_sig>]

class pysap.SAPRFC.SAPCPICPARAMBases: pysap.utils.fields.PacketNoPadded

SAP CPIC PARAM Structure

aliastypes = [<class 'pysap.SAPRFC.SAPCPICPARAM'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPCPICPARAM).pref>, <Field (SAPCPICPARAM).param1>, <Field (SAPCPICPARAM).param2>, <Field (SAPCPICPARAM).param_sess_1>, <Field (SAPCPICPARAM).param_sess_2>, <Field (SAPCPICPARAM).mask>, <Field (SAPCPICPARAM).ip>, <Field (SAPCPICPARAM).flag>]

class pysap.SAPRFC.SAPCPICPARAM2Bases: pysap.utils.fields.PacketNoPadded

SAP CPIC PARAM Structure

aliastypes = [<class 'pysap.SAPRFC.SAPCPICPARAM2'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPCPICPARAM2).param1>, <Field (SAPCPICPARAM2).mask>, <Field (SAPCPICPARAM2).ip>]

class pysap.SAPRFC.SAPCPICSUFFIXBases: pysap.utils.fields.PacketNoPadded

SAP CPIC SUFFIX structure

aliastypes = [<class 'pysap.SAPRFC.SAPCPICSUFFIX'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPCPICSUFFIX).suff_padd1>, <Field (SAPCPICSUFFIX).suff_unk1_len>, <Field (SAPCPICSUFFIX).suff_unk1>, <Field (SAPCPICSUFFIX).suff_padd2>, <Field (SAPCPICSUFFIX).suff_unk2_len>, <Field (SAPCPICSUFFIX).suff_unk2>, <Field (SAPCPICSUFFIX).suff_padd3>, <Field (SAPCPICSUFFIX).suff_unk3_len>, <Field (SAPCPICSUFFIX).suff_unk3>, <Field (SAPCPICSUFFIX).suff_padd4>, <Field (SAPCPICSUFFIX).suff_unk4_len>, <Field (SAPCPICSUFFIX).suff_unk4>, <Field (SAPCPICSUFFIX).suff_padd5>, <Field (SAPCPICSUFFIX).suff_unk5_len>, <Field (SAPCPICSUFFIX).suff_unk5>, <Field (SAPCPICSUFFIX).suff_padd6>, <Field (SAPCPICSUFFIX).suff_unk6_len>, <Field (SAPCPICSUFFIX).suff_unk6>, <Field (SAPCPICSUFFIX).suff_padd7>, <Field (SAPCPICSUFFIX).suff_unk7_len>, <Field (SAPCPICSUFFIX).suff_unk7>, <Field (SAPCPICSUFFIX).suff_padd8>, <Field (SAPCPICSUFFIX).suff_unk8_len>, <Field (SAPCPICSUFFIX).suff_unk8>, <Field (SAPCPICSUFFIX).suff_padd9>, <Field (SAPCPICSUFFIX).suff_unk9_len>, <Field (SAPCPICSUFFIX).suff_unk9>, <Field (SAPCPICSUFFIX).suff_padd10k>, <Field (SAPCPICSUFFIX).suff_kernel_len>, <Field (SAPCPICSUFFIX).suff_kernel>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <Field (SAPCPICSUFFIX).suff_padd14>, <Field (SAPCPICSUFFIX).suff_unk14_len>, <Field (SAPCPICSUFFIX).suff_unk14>, <Field (SAPCPICSUFFIX).suff_padd15>, <Field (SAPCPICSUFFIX).suff_unk15_len>, <Field (SAPCPICSUFFIX).suff_unk15>]

class pysap.SAPRFC.SAPCPIC_CUTBases: pysap.utils.fields.PacketNoPadded

SAP CPIC CUT structure.

aliastypes = [<class 'pysap.SAPRFC.SAPCPIC_CUT'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPCPIC_CUT).keke1>]

class pysap.SAPRFC.SAPRFCBases: pysap.utils.fields.PacketNoPadded

SAP Remote Function Call packet

This packet is used for the Remote Function Call (RFC) protocol.

aliastypes = [<class 'pysap.SAPRFC.SAPRFC'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPRFC).version>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>]

class pysap.SAPRFC.SAPRFCDTStructBases: pysap.utils.fields.PacketNoPadded

SAP RFC DT structure.

This structure is used to setup started program.

aliastypes = [<class 'pysap.SAPRFC.SAPRFCDTStruct'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPRFCDTStruct).version>, <Field (SAPRFCDTStruct).padd1>, <Field (SAPRFCDTStruct).root_id>, <Field (SAPRFCDTStruct).conn_id>, <Field (SAPRFCDTStruct).conn_id_suff>, <Field (SAPRFCDTStruct).timeout>, <Field (SAPRFCDTStruct).keepalive_timeout>, <Field (SAPRFCDTStruct).export_trace>, <Field (SAPRFCDTStruct).start_type>, <Field (SAPRFCDTStruct).net_protocol>, <Field (SAPRFCDTStruct).local_addrv6>, <Field (SAPRFCDTStruct).long_lu>, <Field (SAPRFCDTStruct).padd3>, <Field (SAPRFCDTStruct).user>, <Field (SAPRFCDTStruct).padd4>, <Field (SAPRFCDTStruct).padd5>, <Field (SAPRFCDTStruct).padd6>, <Field (SAPRFCDTStruct).padd7>, <Field (SAPRFCDTStruct).addr_ipv4>, <Field (SAPRFCDTStruct).padd8>, <Field (SAPRFCDTStruct).long_tp>]

162 Chapter 4. Development guide

Page 167: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

class pysap.SAPRFC.SAPRFCEXTENDBases: pysap.utils.fields.PacketNoPadded

SAP RFC EXTEND INFO structure

aliastypes = [<class 'pysap.SAPRFC.SAPRFCEXTEND'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPRFCEXTEND).short_dest_name>, <Field (SAPRFCEXTEND).ncpic_lu>, <Field (SAPRFCEXTEND).ncpic_tp>, <Field (SAPRFCEXTEND).ctype>, <Field (SAPRFCEXTEND).clientInfo>, <Field (SAPRFCEXTEND).ncpic_parameters_padd>, <Field (SAPRFCEXTEND).comm_idx>, <Field (SAPRFCEXTEND).conn_idx>]

class pysap.SAPRFC.SAPRFCPINGBases: pysap.utils.fields.PacketNoPadded

SAP Started program packets RFCPING.

aliastypes = [<class 'pysap.SAPRFC.SAPRFCPING'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPRFCPING).fields_test>]

class pysap.SAPRFC.SAPRFCTHStructBases: pysap.utils.fields.PacketNoPadded

SAP RFC TH structure.

aliastypes = [<class 'pysap.SAPRFC.SAPRFCTHStruct'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPRFCTHStruct).th_eyec1>, <Field (SAPRFCTHStruct).th_version>, <Field (SAPRFCTHStruct).th_len>, <Field (SAPRFCTHStruct).th_trace_flag>, <Field (SAPRFCTHStruct).th_sysid>, <Field (SAPRFCTHStruct).th_serevice>, <Field (SAPRFCTHStruct).th_userid>, <Field (SAPRFCTHStruct).th_action>, <Field (SAPRFCTHStruct).th_presysid>, <Field (SAPRFCTHStruct).th_acttype>, <Field (SAPRFCTHStruct).th_id>, <Field (SAPRFCTHStruct).th_unused_comm1>, <Field (SAPRFCTHStruct).th_some_cpic_params>, <Field (SAPRFCTHStruct).th_unused_comm2>, <Field (SAPRFCTHStruct).th_eyec2>]

class pysap.SAPRFC.SAPRFXPGBases: pysap.utils.fields.PacketNoPadded

SAP Started program packets.

aliastypes = [<class 'pysap.SAPRFC.SAPRFXPG'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPRFXPG).xpg_padd100>, <Field (SAPRFXPG).xpg_convid_l_len>, <Field (SAPRFXPG).xpg_convid_l>, <Field (SAPRFXPG).xpg_padd101>, <Field (SAPRFXPG).xpg_strstat_l_len>, <Field (SAPRFXPG).xpg_strstat_l>, <Field (SAPRFXPG).xpg_padd102>, <Field (SAPRFXPG).xpg_xpgid_l_len>, <Field (SAPRFXPG).xpg_xpgid_l>, <Field (SAPRFXPG).xpg_padd103>, <Field (SAPRFXPG).xpg_extprog_l_len>, <Field (SAPRFXPG).xpg_extprog_l>, <Field (SAPRFXPG).xpg_padd104>, <Field (SAPRFXPG).xpg_extprog_val_len>, <Field (SAPRFXPG).xpg_extprog_val>, <Field (SAPRFXPG).xpg_padd105>, <Field (SAPRFXPG).xpg_longparam_l_len>, <Field (SAPRFXPG).xpg_longparam_l>, <Field (SAPRFXPG).xpg_padd106>, <Field (SAPRFXPG).xpg_longparam_val_len>, <Field (SAPRFXPG).xpg_longparam_val>, <Field (SAPRFXPG).xpg_padd107>, <Field (SAPRFXPG).xpg_param_l_len>, <Field (SAPRFXPG).xpg_param_l>, <Field (SAPRFXPG).xpg_padd108>, <Field (SAPRFXPG).xpg_param_val_len>, <Field (SAPRFXPG).xpg_param_val>, <Field (SAPRFXPG).xpg_padd109>, <Field (SAPRFXPG).xpg_stderrcntl_l_len>, <Field (SAPRFXPG).xpg_stderrcntl_l>, <Field (SAPRFXPG).xpg_padd110>, <Field (SAPRFXPG).xpg_stderrcntl_val_len>, <Field (SAPRFXPG).xpg_stderrcntl_val>, <Field (SAPRFXPG).xpg_padd111>, <Field (SAPRFXPG).xpg_stdincntl_l_len>, <Field (SAPRFXPG).xpg_stdincntl_l>, <Field (SAPRFXPG).xpg_padd112>, <Field (SAPRFXPG).xpg_stdincntl_val_len>, <Field (SAPRFXPG).xpg_stdincntl_val>, <Field (SAPRFXPG).xpg_padd113>, <Field (SAPRFXPG).xpg_stdoutcntl_l_len>, <Field (SAPRFXPG).xpg_stdoutcntl_l>, <Field (SAPRFXPG).xpg_padd114>, <Field (SAPRFXPG).xpg_stdoutcntl_val_len>, <Field (SAPRFXPG).xpg_stdoutcntl_val>, <Field (SAPRFXPG).xpg_padd115>, <Field (SAPRFXPG).xpg_termcntl_l_len>, <Field (SAPRFXPG).xpg_termcntl_l>, <Field (SAPRFXPG).xpg_padd116>, <Field (SAPRFXPG).xpg_termcntl_val_len>, <Field (SAPRFXPG).xpg_termcntl_val>, <Field (SAPRFXPG).xpg_padd117>, <Field (SAPRFXPG).xpg_tracecntl_l_len>, <Field (SAPRFXPG).xpg_tracecntl_l>, <Field (SAPRFXPG).xpg_padd118>, <Field (SAPRFXPG).xpg_tracecntl_val_len>, <Field (SAPRFXPG).xpg_tracecntl_val>, <Field (SAPRFXPG).xpg_padd119>, <Field (SAPRFXPG).xpg_log_l_len>, <Field (SAPRFXPG).xpg_log_l>, <Field (SAPRFXPG).xpg_padd120>, <Field (SAPRFXPG).xpg_log_val1_len>, <Field (SAPRFXPG).xpg_log_val1>, <Field (SAPRFXPG).xpg_padd121>, <Field (SAPRFXPG).xpg_unk1_len>, <Field (SAPRFXPG).xpg_unk1>]

class pysap.SAPRFC.SAPRFXPG_ENDBases: pysap.utils.fields.PacketNoPadded

SAP Started program packets SAPRFXPG_END.

aliastypes = [<class 'pysap.SAPRFC.SAPRFXPG_END'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPRFXPG_END).xpg_end_padd001>, <Field (SAPRFXPG_END).xpg_end_ecode_l_len>, <Field (SAPRFXPG_END).xpg_end_ecode_l>, <Field (SAPRFXPG_END).xpg_end_padd002>, <Field (SAPRFXPG_END).xpg_end_estat_l_len>, <Field (SAPRFXPG_END).xpg_end_estat_l>, <Field (SAPRFXPG_END).xpg_end_padd003>, <Field (SAPRFXPG_END).xpg_end_log_l_len>, <Field (SAPRFXPG_END).xpg_end_log_l>, <Field (SAPRFXPG_END).xpg_end_padd004>, <Field (SAPRFXPG_END).xpg_end_unk1_len>, <Field (SAPRFXPG_END).xpg_end_unk1>, <Field (SAPRFXPG_END).xpg_end_padd005>, <Field (SAPRFXPG_END).xpg_end_unk2_len>, <Field (SAPRFXPG_END).xpg_end_unk2>]

pysap.SAPRFC.appc_protocol_values = {3: 'CPIC'}RFC APPC Protocol values

pysap.SAPRFC.appc_rc_values = {0: 'CM_OK', 1: 'CM_ALLOCATE_FAILURE_NO_RETRY', 2: 'CM_ALLOCATE_FAILURE_RETRY', 3: 'CM_CONVERSATION_TYPE_MISMATCH', 5: 'CM_PIP_NOT_SPECIFIED_CORRECTLY', 6: 'CM_SECURITY_NOT_VALID', 7: 'CM_SYNC_LVL_NOT_SUPPORTED_SYS', 8: 'CM_SYNC_LVL_NOT_SUPPORTED_PGM', 9: 'CM_TPN_NOT_RECOGNIZED', 10: 'CM_TP_NOT_AVAILABLE_NO_RETRY', 11: 'CM_TP_NOT_AVAILABLE_RETRY', 17: 'CM_DEALLOCATED_ABEND', 18: 'CM_DEALLOCATED_NORMAL', 19: 'CM_PARAMETER_ERROR', 20: 'CM_PRODUCT_SPECIFIC_ERROR', 21: 'CM_PROGRAM_ERROR_NO_TRUNC', 22: 'CM_PROGRAM_ERROR_PURGING', 23: 'CM_PROGRAM_ERROR_TRUNC', 24: 'CM_PROGRAM_PARAMETER_CHECK', 25: 'CM_PROGRAM_STATE_CHECK', 26: 'CM_RESOURCE_FAILURE_NO_RETRY', 27: 'CM_RESOURCE_FAILURE_RERTY', 28: 'CM_UNSUCCESSFUL', 30: 'CM_DEALLOCATED_ABEND_SVC', 31: 'CM_DEALLOCATED_ABEND_TIMER', 32: 'CM_SVC_ERROR_NO_TRUNC', 33: 'CM_SVC_ERROR_PURGING', 34: 'CM_SVC_ERROR_TRUNC', 35: 'CM_OPERATION_INCOMPLETE', 36: 'CM_SYSTEM_EVENT', 37: 'CM_OPERATION_NOT_ACCEPTED', 38: 'CM_CONVERSATION_ENDING', 39: 'CM_SEND_RCV_MODE_NOT_SUPPORTED', 40: 'CM_BUFFER_TOO_SMALL', 41: 'CM_EXP_DATA_NOT_SUPPORTED', 42: 'CM_DEALLOC_CONFIRM_REJECT', 43: 'CM_ALLOCATION_ERROR', 44: 'CM_RETRY_LIMIT_EXCEEDED', 45: 'CM_NO_SECONDARY_INFORMATION', 46: 'CM_SECURITY_NOT_SUPPORTED', 47: 'CM_SECURITY_MUTUAL_FAILED', 48: 'CM_CALL_NOT_SUPPORTED', 49: 'CM_PARM_VALUE_NOT_SUPPORTED', 100: 'CM_TAKE_BACKOUT', 130: 'CM_DEALLOCATED_ABEND_BO', 131: 'CM_DEALLOCATED_ABEND_SVC_BO', 132: 'CM_DEALLOCATED_ABEND_TIMER_BO', 133: 'CM_RESOURCE_FAIL_NO_RETRY_BO', 134: 'CM_RESOURCE_FAILURE_RETRY_BO', 135: 'CM_DEALLOCATED_NORMAL_BO', 136: 'CM_CONV_DEALLOC_AFTER_SYNCPT', 137: 'CM_INCLUDE_PARTNER_REJECT_BO', 10001: 'CM_SAP_TIMEOUT_RETRY', 10002: 'CM_CANCEL_REQUEST'}RFC APPC Return Code values

pysap.SAPRFC.cpic_ctypes = {67: 'R_2', 69: 'STARTED_PRG', 73: 'R_3', 82: 'REGISTRED_PRG'}RFC CPIC CType values

pysap.SAPRFC.cpic_padd = {'cpic_RFC_f_padd': '\x00\x0b\x01\x02', 'cpic_cli_nbr1_padd': '\x01\x11\x01\x14', 'cpic_cli_nbr2_padd': '\x00\t\x014', 'cpic_convid_label_padd': '\x016\x05\x02', 'cpic_dest_padd': '\x00\x12\x00\x06', 'cpic_end_padd': '\x01\x04\xff\xff', 'cpic_host_sid_inbr_padd': '\x00\x18\x00\x08', 'cpic_ip_padd': '\x01\x06\x00\x07', 'cpic_ip_padd2': '\x00\x07\x00\x18', 'cpic_kernel1_padd': '\x00\x11\x00\x13', 'cpic_kernel2_padd': '\x00\x13\x00\x12', 'cpic_kernel3_padd': '\x05\x02\x00\x0b', 'cpic_program_padd': '\x00\x06\x010', 'cpic_rfc_type_padd': '\x00\x08\x00\x11', 'cpic_some_params2_padd': '\x011\x05\x14', 'cpic_some_params_0_padd': '\x05\x01', 'cpic_some_params_1_padd': '\x016', 'cpic_start_padd': '\x01\x01\x00\x08', 'cpic_suff_padd': '\x03\x02\x01\x04', 'cpic_th_struct_padd': '\x05\x03\x011', 'cpic_unk00_padd': '\x01\x03\x01\x06', 'cpic_unk01_padd': '\x01\x01\x01\x03', 'cpic_unk02_padd': '\x01\x01\x01\x01', 'cpic_unk1_padd': '\x01\x14\x01\x15', 'cpic_unk2_padd': '\x014\x05\x01', 'cpic_unk4_padd': '\x01\x02\x05\x03', 'cpic_unk6_padd': '\x05\x14\x04 ', 'cpic_unk7_padd': '\x04 \x05\x12', 'cpic_username1_padd': '\x010\x01\x11', 'cpic_username2_padd': '\x01\x15\x00\t'}RFC CPIC Padding values

pysap.SAPRFC.cpic_suff_padd = {'suff_padd1': '\x10\x04\x02', 'suff_padd10': '\x10\x04\x1d', 'suff_padd10k': '\x10\x04\t', 'suff_padd11': '\x10\x04\x1f', 'suff_padd12': '\x10\x04 ', 'suff_padd13': '\x10\x04!', 'suff_padd14': '\x10\x04$', 'suff_padd15': '\x10\x04$', 'suff_padd2': '\x10\x04\x0b', 'suff_padd3': '\x10\x04\x04', 'suff_padd4': '\x10\x04\r', 'suff_padd5': '\x10\x04\x16', 'suff_padd6': '\x10\x04\x17', 'suff_padd7': '\x10\x04\x19', 'suff_padd8': '\x10\x04\x1e', 'suff_padd9': '\x10\x04%'}RFC CPIC Stuff Padding values

pysap.SAPRFC.rfc_func_type_values = {0: 'F_NO_REQUEST', 1: 'F_INITIALIZE_CONVERSATION', 3: 'F_ACCEPT_CONVERSATION', 5: 'F_ALLOCATE', 7: 'F_SEND_DATA', 8: 'F_ASEND_DATA', 9: 'F_RECEIVE', 10: 'F_ARECEIVE', 11: 'F_DEALLOCATE', 13: 'F_SET_TP_NAME', 15: 'F_SET_PARTNER_LU_NAME', 17: 'F_SET_SECURITY_PASSWORD', 19: 'F_SET_SECURITY_USER_ID', 21: 'F_SET_SECURITY_TYPE', 23: 'F_SET_CONVERSATION_TYPE', 25: 'F_EXTRACT_TP_NAME', 27: 'F_FLUSH', 201: 'F_SAP_ALLOCATE', 202: 'F_SAP_INIT', 203: 'F_SAP_SEND', 204: 'F_ASAP_SEND', 205: 'F_SAP_SYNC', 206: 'F_SAP_PING', 207: 'F_SAP_REGTP', 208: 'F_SAP_UNREGTP', 209: 'F_SAP_ACCPTP', 210: 'F_SAP_UNACCPTP', 211: 'F_SAP_CANCTP', 212: 'F_SAP_SET_UID', 213: 'F_SAP_CANCEL', 214: 'F_SAP_CANCELED', 215: 'F_SAP_STOP_STREAMING', 216: 'F_SAP_CONT_STREAMING'}RFC Request Type values

pysap.SAPRFC.rfc_monitor_cmd_values = {1: 'NOOP', 2: 'DELETE_CONN', 3: 'CANCEL_CONN', 4: 'RST_SINGLE_ERR_CNT', 5: 'RST_ALL_ERR_CNT', 6: 'INCREASE_TRACE', 7: 'DECREASE_TRACE', 8: 'READ_SEC_INFO', 9: 'REFRESH_SEC_INFO', 10: 'READ_GWSYS_TBL', 11: 'READ_CONN_TBL', 12: 'READ_PROC_TBL', 13: 'READ_CONN_ATTR', 14: 'READ_MEMORY', 15: 'READ_REQ_BLK', 16: 'ACT_STATISTIC', 17: 'DEACT_STATISTIC', 18: 'READ_STATISTIC', 19: 'RESET_STATISTIC', 20: 'READ_PARAMETER', 25: 'DUMP_NIBUFFER', 32: 'RESET_NIBUFFER', 33: 'ACT_EXTPGM_TRACE', 34: 'DEACT_EXTPGM_TRACE', 35: 'ACT_CONN_TRACE', 36: 'DEACT_CONN_TRACE', 37: 'RESET_TRACE', 38: 'SUICIDE', 39: 'READ_SEC_INFO2', 40: 'CANCEL_REG_TP', 41: 'DUMP', 42: 'READ_GWSYS_TBL2', 43: 'CHANGE_PARAMETER', 44: 'GET_CONN_PARTNER', 45: 'DELETE_CLIENT', 46: 'DELETE_REMGW', 47: 'DISCONNECT', 48: 'ENABLE_RESTART', 49: 'DISABLE_RESTART', 50: 'NI_TRACE', 51: 'CLI_INFO', 52: 'GW_INFO', 53: 'CONVID_INFO', 54: 'GET_NO_REG_TP', 55: 'CV_INFO', 56: 'SO_KEEPALIVE', 57: 'READ_CONN_TBL2', 64: 'READ_GWSYS_TBL3', 65: 'RELOAD_ACL'}RFC Monitor Command values

4.2. Developer Interface 163

Page 168: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

pysap.SAPRFC.rfc_rfc_types = {50: 'R_2_CONN', 51: 'ABAP_CONN', 73: 'INTERNAL_CONN', 76: 'LOGIC_CONN', 77: 'CMC_CONN', 83: 'SNA_CPIC_CONN', 84: 'TCP_CONN', 88: 'ABAP_DRIVER_CONN'}RFC Type values

pysap.SAPRFC.rfc_start_type = {0: 'DEFAULT', 1: 'REMOTE_SHELL', 2: 'REXEC', 3: 'DISABLED', 4: 'SECURE_SHELL'}RFC Start Type values

pysap.SAPRFC.sap_rc_values = {}RFC Return Code values

pysap.SAPRouter module

exception pysap.SAPRouter.SAPRouteExceptionBases: exceptions.Exception

Exception for SAP Router routing errors

class pysap.SAPRouter.SAPRoutedStreamSocket(sock, route, talk_mode=None,router_version=None, keep_alive=True,base_cls=None)

Bases: pysap.SAPNI.SAPNIStreamSocket

Stream socket implementation for a connection routed through a SAP Router server. It works by wrap-ping a SAPNIStreamSocket and connecting first to the SAP Router given a route string or list ofSAPRouterRouteHop.

desc = 'NI Stream socket routed trough a SAP Router'

classmethod get_nisocket(host=None, port=None, route=None, password=None,talk_mode=None, router_version=None, **kwargs)

Helper function to obtain a SAPRoutedStreamSocket. If no route is specified, it returns a plainSAPNIStreamSocket. If no route is specified and the talk mode is raw, it returns a plain StreamSocket asit’s assumed that the NI layer is not desired.

Parameters

• host (C{string}) – target host to connect to if not specified in the route

• port (int) – target port to connect to if not specified in the route

• route (C{string} or list of SAPRouterRouteHop) – route to use for determiningthe SAP Router to connect

• password (C{string}) – target password if not specified in the route

• talk_mode (int) – the talk mode to use for requesting the route

• router_version (int) – the router version to use for requesting the route

• kwargs – arguments to pass to SAPRoutedStreamSocket constructor

Returns connected socket through the specified route

Return type SAPRoutedStreamSocket

Raises

• SAPRouteException – if the route request to the target host/port was not accepted bythe SAP Router

• socket.error – if the connection to the target host/port failed or the SAP Router re-turned an error

164 Chapter 4. Development guide

Page 169: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

recv()Receive a packet from the target host. If the talk mode in use is native and we’ve already set the route, thepacket received is a raw packet. Otherwise, the packet received is a NI layer packet in the same way theSAPNIStreamSocket works.

route_to(route, talk_mode)Make the route request to the target host/service.

Parameters

• route (list of SAPRouterRouteHop) – a route to specify to the SAP Router

• talk_mode (int) – the talk mode to use when routing

Raises

• SAPRouteException – if the route request to the target host/port was not accepted bythe SAP Router

• socket.error – if the connection to the target host/port failed or the SAP Router re-turned an error

send(packet)Send a packet. If the talk mode in use is native the packet sent is a raw packet. Otherwise, the packet is aNI layer packet in the same way the SAPNIStreamSocket works.

Parameters packet (Packet) – packet to send

class pysap.SAPRouter.SAPRouterBases: scapy.packet.Packet

SAP Router packet

This packet is used for general SAP Router packets. There are (at least) five types of SAP Router packets:

1. Route packets. For requesting the routing of a connection to a remote hosts. Thepacket contains some general information and a connection string with a list of routing hops(SAPRouterRouteHop).

2. Administration packets. This packet is used for the SAP Router to send administrative commands.It’s suppose to be used only from the hosts running the SAP Router or when an specific route isincluded in the routing table. Generally administration packets are not accepted from the externalbinding.

3. Error Information packets. Packets sent when an error occurred.

4. Control Message packets. Used to perform some control activities, like retrieving the currentSAPRouter version or to perform the SNC handshake. They have the same structure that error infor-mation packets.

5. Route accepted packet. Used to acknowledge a route request (“NI_PONG”).

Routed packets and some responses doesn’t fill in these five packet types. For identifying those cases, youshould check the type using the function router_is_known_type.

NI Versions found (unconfirmed):

• 30: Release 40C

• 36: Release <6.20

• 38: Release 7.00/7.10

• 39: Release 7.11

• 40: Release 7.20/7.21

4.2. Developer Interface 165

Page 170: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

SAPROUTER_ADMIN = 'ROUTER_ADM'

Cvar Constant for administration packets

Type C{string}

SAPROUTER_CONTROL = 'NI_RTERR'

Cvar Constant for control messages packets

Type C{string}

SAPROUTER_DEFAULT_VERSION = 40

SAPROUTER_ERROR = 'NI_RTERR'

Cvar Constant for error information packets

Type C{string}

SAPROUTER_PONG = 'NI_PONG'

Cvar Constant for route accepted packets

Type C{string}

SAPROUTER_ROUTE = 'NI_ROUTE'

Cvar Constant for route packets

Type C{string}

aliastypes = [<class 'pysap.SAPRouter.SAPRouter'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPRouter).type>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>]

router_type_values = ['ROUTER_ADM', 'NI_RTERR', 'NI_RTERR', 'NI_ROUTE', 'NI_PONG']

Cvar List of known packet types

Type list of C{string}

class pysap.SAPRouter.SAPRouterErrorBases: pysap.utils.fields.PacketNoPadded

SAP Router Protocol Error Text

This packet is used to describe an error returned by SAP Router.

aliastypes = [<class 'pysap.SAPRouter.SAPRouterError'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPRouterError).eyecatcher>, <Field (SAPRouterError).counter>, <Field (SAPRouterError).error>, <Field (SAPRouterError).return_code>, <Field (SAPRouterError).component>, <Field (SAPRouterError).release>, <Field (SAPRouterError).version>, <Field (SAPRouterError).module>, <Field (SAPRouterError).line>, <Field (SAPRouterError).detail>, <Field (SAPRouterError).error_time>, <Field (SAPRouterError).system_call>, <Field (SAPRouterError).errorno>, <Field (SAPRouterError).errorno_text>, <Field (SAPRouterError).error_count>, <Field (SAPRouterError).location>, <Field (SAPRouterError).XXX5>, <Field (SAPRouterError).XXX6>, <Field (SAPRouterError).XXX7>, <Field (SAPRouterError).XXX8>, <Field (SAPRouterError).eyecatcher>]

time_format = '%a %b %d %H:%M:%S %Y'

Cvar Format to use when building the time field

Type C{string}

class pysap.SAPRouter.SAPRouterInfoClientBases: pysap.utils.fields.PacketNoPadded

SAP Router Protocol Information Request Client info

This packet is used to return the information of a connected client.

aliastypes = [<class 'pysap.SAPRouter.SAPRouterInfoClient'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPRouterInfoClient).id>, <Field (SAPRouterInfoClient).flag_XXX1>, <Field (SAPRouterInfoClient).flag_XXX2>, <Field (SAPRouterInfoClient).flag_XXX3>, <Field (SAPRouterInfoClient).flag_XXX4>, <Field (SAPRouterInfoClient).flag_XXX5>, <Field (SAPRouterInfoClient).flag_traced>, <Field (SAPRouterInfoClient).flag_connected>, <Field (SAPRouterInfoClient).flag_routed>, <Field (SAPRouterInfoClient).connected_on>, <Field (SAPRouterInfoClient).address>, <Field (SAPRouterInfoClient).partner>, <Field (SAPRouterInfoClient).service>, <Field (SAPRouterInfoClient).XXX3>]

166 Chapter 4. Development guide

Page 171: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

class pysap.SAPRouter.SAPRouterInfoClientsBases: pysap.utils.fields.PacketNoPadded

SAP Router Protocol Information Request Client info list

This packet is used to return the list of current connected clients.

aliastypes = [<class 'pysap.SAPRouter.SAPRouterInfoClients'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPRouterInfoClients).clients>]

class pysap.SAPRouter.SAPRouterInfoServerBases: pysap.utils.fields.PacketNoPadded

SAP Router Protocol Information Request Server info

This packet is used to return information about the SAP Router

aliastypes = [<class 'pysap.SAPRouter.SAPRouterInfoServer'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPRouterInfoServer).pid>, <Field (SAPRouterInfoServer).ppid>, <Field (SAPRouterInfoServer).started_on>, <Field (SAPRouterInfoServer).port>, <Field (SAPRouterInfoServer).pport>]

class pysap.SAPRouter.SAPRouterNativeProxy(bind_address, bind_port, remote_address,remote_port, handler, target_address, tar-get_port, target_pass=None, talk_mode=0,backlog=5, keep_alive=True, options=None)

Bases: pysap.SAPNI.SAPNIProxy

SAP Router Native Proxy

Proxy implementation that routes traffic through a remote SAP Router server to a target host/port. It works bybinding a SAPNIStreamSocket and requesting the SAP Router a route to the target location. If the route isaccepted it keeps the listener open for connections and spawn a new SAPRouterNativeRouterHandlerinstance for each client.

Example usage:

proxy = SAPRouterNativeProxy(local_host, local_port,remote_host, remote_port,SAPRouterNativeRouterHandler,target_address=target_address,target_post=target_port,target_pass=target_pass)

proxy.handle_connection()

handle_connection()Block until a connection is received from the listener, request a route to forward the traffic through theremote SAP Router and handle the client using the provided handler class.

Returns the handler instance handling the request

Return type SAPNIProxyHandler

route()Requests a route to forward the traffic through the remote SAP Router.

Raises

• SAPRouteException – if the route request is denied

• Exception – if an error occurred when requesting the route

class pysap.SAPRouter.SAPRouterNativeRouterHandler(client, server, options=None)Bases: pysap.SAPNI.SAPNIProxyHandler

4.2. Developer Interface 167

Page 172: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

SAP Router Native Proxy Handler

Handles packets routed through a remote SAP Router. It works by bypassing the SAP NI layer in order to allownative traffic.

recv_send(local, remote, process)Receives data from one socket connection, process it and send to the remote connection.

Parameters

• local (SAPNIStreamSocket) – the local socket

• remote (SAPNIStreamSocket) – the remote socket

• process (function) – the function that process the incoming data

class pysap.SAPRouter.SAPRouterRouteHopBases: pysap.utils.fields.PacketNoPadded

SAP Router Protocol Route Hop

This packet is used to describe a hop in a route using the SAP Router.

aliastypes = [<class 'pysap.SAPRouter.SAPRouterRouteHop'>, <class 'pysap.utils.fields.PacketNoPadded'>, <class 'scapy.packet.Packet'>]

fields_desc = [<Field (SAPRouterRouteHop).hostname>, <Field (SAPRouterRouteHop).port>, <Field (SAPRouterRouteHop).password>]

classmethod from_hops(route_hops)Build a route string from a list of route hops.

Parameters route_hops (list of SAPRouterRouteHop) – route hops

Returns route string

Return type C{string}

classmethod from_string(route_string)Build a list of route hops from a route string. The format of a route string is:

(/H/host/S/service/W/pass)*

or for older versions (<4.0):

(/H/host/S/service/P/pass)*

Parameters route_string (C{string}) – route string

Returns route hops in the route string

Return type list of SAPRouterRouteHop

regex = <_sre.SRE_Pattern object>

Cvar Regular expression for matching route strings

Type regex

pysap.SAPRouter.get_router_version(connection)Helper function to retrieve the version of a remote SAP Router. It uses a control packet with the ‘version request’operation code. The version is obtained either from a valid ‘version response’ packet or from the error messagepacket if something happened.

Parameters connection (SAPNIStreamSocket) – connection with the SAP Router

Returns version

pysap.SAPRouter.router_adm_commands = {2: 'Information Request', 3: 'New Route Table Request', 4: 'Toggle Trace Request', 5: 'Stop Request', 6: 'Cancel Route Request', 7: 'Dump Buffers Request', 8: 'Flush Buffers Request', 9: 'Soft Shutdown Request', 10: 'Set Trace Peer', 11: 'Clear Trace Peer', 12: 'Trace Connection', 13: 'Trace Connection', 14: 'Hide Error Information Request'}Router Administration Command values

168 Chapter 4. Development guide

Page 173: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

pysap.SAPRouter.router_control_opcodes = {0: 'Error information', 1: 'Version request', 2: 'Version response', 5: 'Send Handle (5)', 6: 'Send Handle (6)', 8: 'Send Handle (8)', 70: 'SNC request', 71: 'SNC handshake complete'}Router Opcode values

pysap.SAPRouter.router_is_admin(pkt)Returns if the packet is a Admin packet.

Parameters pkt (SAPRouter) – packet to look at

Returns if the type of the packet is Admin

Return type bool

pysap.SAPRouter.router_is_control(pkt)Returns if the packet is a Control packet.

Parameters pkt (SAPRouter) – packet to look at

Returns if the type of the packet is Control

Return type bool

pysap.SAPRouter.router_is_error(pkt)Returns if the packet is a Error Information packet.

Parameters pkt (SAPRouter) – packet to look at

Returns if the type of the packet is Error

Return type bool

pysap.SAPRouter.router_is_known_type(pkt)Returns if the packet is of a known type (Admin, Route, Error or Pong).

Parameters pkt (SAPRouter) – packet to look at

Returns if the type of the packet is known

Return type bool

pysap.SAPRouter.router_is_pong(pkt)Returns if the packet is a Pong (route accepted) packet.

Parameters pkt (SAPRouter) – packet to look at

Returns if the type of the packet is Pong

Return type bool

pysap.SAPRouter.router_is_route(pkt)Returns if the packet is a Route packet.

Parameters pkt (SAPRouter) – packet to look at

Returns if the type of the packet is Route

Return type bool

pysap.SAPRouter.router_ni_talk_mode_values = {0: 'NI_MSG_IO', 1: 'NI_RAW_IO', 2: 'NI_ROUT_IO'}Router NI Talk mode values

pysap.SAPRouter.router_return_codes = {-104: 'Error in the SNC shift (NIEROUT_SNC_FAILURE)', -103: 'Error in external library (NIEROUT_EXTERN)', -102: 'Client not available (NIEROUT_NOCLIENT)', -101: 'Talkmode not allowed (NIEROUT_MODE_DENIED)', -100: 'Max. number of clients reached (NIEROUT_OVERFLOW)', -99: 'Information request refused (NIEROUT_INFO_DENIED)', -98: 'saprouter shutdown (NIEROUT_SHUTDOWN)', -97: 'Connection cancelled by administrator (NIEROUT_CANCELED)', -96: 'Invalid client version (NIEROUT_VERSION)', -95: 'Connection terminated (NIEROUT_CONN_BROKEN)', -94: 'Connect from source to destination not allowed (NIEROUT_PERM_DENIED)', -93: 'NI-internal errors (NIEROUT_INTERN)', -92: 'Connection setup failed (NIEROUT_CONN_REFUSED)', -91: 'Service unknown (NIEROUT_SERV_UNKNOWN)', -90: 'Host name unknown (NIEROUT_HOST_UNKNOWN)', -20: 'Requested package too large (NIETOO_BIG)', -19: 'queue limit reached, next package not accepted (NIEQUE_FULL)', -18: 'Opcode received (NIEOPCODE)', -17: 'Error in the SNC shift in the saprouter ==> (NIESNC_FAILURE)', -16: 'Local hostname invalid (NIEMYHOST_VERIFY)', -15: 'No free port in range (NIENOFREEPORT)', -14: 'Local hostname cannot be found (NIEMYHOSTNAME)', -13: 'Invalid version (NIEVERSION)', -12: 'Connection to partner via NiRouter not yet set up (NIECONN_PENDING)', -11: 'PING/PONG signal received (NIEPING)', -10: 'Connection setup failed (NIECONN_REFUSED)', -9: 'Wake-Up (without data) (NIEWAKEUP)', -8: 'Invalid parameters (NIEINVAL)', -7: 'Data range too small (NIETOO_SMALL)', -6: 'Connection to partner broken (NIECONN_BROKEN)', -5: 'Time limit reached (NIETIMEOUT)', -4: 'Service already used (NIESERV_USED)', -3: 'Service unknown (NIESERV_UNKNOWN)', -2: 'Host name unknown (NIEHOST_UNKNOWN)', -1: 'NI-internal error (NIEINTERN)'}Router Return Code values

4.2. Developer Interface 169

Page 174: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

pysap.SAPSNC module

class pysap.SAPSNC.SAPSNCFrameBases: 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)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 theSNC 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)Wraps an SNC frame if it’s possible. This is, if the frame type is data open. Adds the data to the frame andproperly 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

4.2.2 pysapcompress library

Library implementing SAP’s LZH and LZC compression algorithms.

exception pysapcompress.CompressError

exception pysapcompress.DecompressError

pysapcompress.compress()Compress a buffer using SAP’s compression algorithms.

Parameters

• in (str) – input buffer to compress

• algorithm (int) – algorithm to use

Returns tuple with return code, output length and output buffer

Return type tuple of int, int, string

Raises CompressError – if an error occurred during compression

170 Chapter 4. Development guide

Page 175: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

pysapcompress.decompress()Decompress a buffer using SAP’s compression algorithms.

Parameters

• in (str) – input buffer to decompress

• out_length (int) – length of the output to decompress

Returns tuple of return code, output length and output buffer

Return type tuple of int, int, string

Raises DecompressError – if an error occurred during decompression

4.2. Developer Interface 171

Page 176: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

172 Chapter 4. Development guide

Page 177: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

CHAPTER 5

Indices and tables

• genindex

• modindex

• search

173

Page 178: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

174 Chapter 5. Indices and tables

Page 179: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

Python Module Index

ppysap, 125pysap.SAPCAR, 131pysap.SAPCredv2, 136pysap.SAPDiag, 139pysap.SAPDiagClient, 143pysap.SAPDiagItems, 145pysap.SAPEnqueue, 146pysap.SAPIGS, 148pysap.SAPLPS, 149pysap.SAPMS, 150pysap.SAPNI, 154pysap.SAPPSE, 157pysap.SAPRFC, 161pysap.SAPRouter, 164pysap.SAPSNC, 170pysap.utils, 126pysap.utils.console, 126pysap.utils.crypto, 127pysap.utils.fields, 128pysapcompress, 170

175

Page 180: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

176 Python Module Index

Page 181: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

Index

Aadd_entry() (pysap.SAPIGS.SAPIGSTable static

method), 148add_file() (pysap.SAPCAR.SAPCARArchive method),

131addfield() (pysap.utils.fields.StrEncodedPaddedField

method), 129addfield() (pysap.utils.fields.StrFixedLenPaddedField

method), 130addfield() (pysap.utils.fields.StrNullFixedLenField

method), 130addfield() (pysap.utils.fields.StrNullFixedLenPaddedField

method), 130aliastypes (pysap.SAPCAR.SAPCARArchiveFilev200Format

attribute), 134aliastypes (pysap.SAPCAR.SAPCARArchiveFilev201Format

attribute), 135aliastypes (pysap.SAPCAR.SAPCARArchiveFormat at-

tribute), 135aliastypes (pysap.SAPCAR.SAPCARCompressedBlobFormat

attribute), 135aliastypes (pysap.SAPCAR.SAPCARCompressedBlockFormat

attribute), 135aliastypes (pysap.SAPCredv2.SAPCredv2 attribute), 137aliastypes (pysap.SAPCredv2.SAPCredv2_Cred at-

tribute), 137aliastypes (pysap.SAPCredv2.SAPCredv2_Cred_Cipher

attribute), 138aliastypes (pysap.SAPCredv2.SAPCredv2_Cred_LPS at-

tribute), 138aliastypes (pysap.SAPCredv2.SAPCredv2_Cred_Plain

attribute), 139aliastypes (pysap.SAPCredv2.SAPCredv2Cred attribute),

137aliastypes (pysap.SAPDiag.SAPDiag attribute), 140aliastypes (pysap.SAPDiag.SAPDiagDP attribute), 140aliastypes (pysap.SAPDiag.SAPDiagError attribute), 141aliastypes (pysap.SAPDiag.SAPDiagItem attribute), 141aliastypes (pysap.SAPDiag.SAPDiagItems attribute), 141

aliastypes (pysap.SAPDiagItems.SAPDiagAreaSize at-tribute), 145

aliastypes (pysap.SAPDiagItems.SAPDiagDyntAtom at-tribute), 145

aliastypes (pysap.SAPDiagItems.SAPDiagDyntAtomItemattribute), 145

aliastypes (pysap.SAPDiagItems.SAPDiagMenuEntriesattribute), 145

aliastypes (pysap.SAPDiagItems.SAPDiagMenuEntry at-tribute), 146

aliastypes (pysap.SAPDiagItems.SAPDiagSES attribute),146

aliastypes (pysap.SAPDiagItems.SAPDiagStep attribute),146

aliastypes (pysap.SAPDiagItems.SAPDiagSupportBitsattribute), 146

aliastypes (pysap.SAPDiagItems.SAPDiagUIEventSourceattribute), 146

aliastypes (pysap.SAPDiagItems.SAPDiagUserConnectattribute), 146

aliastypes (pysap.SAPDiagItems.SAPDiagWindowSizeattribute), 146

aliastypes (pysap.SAPEnqueue.SAPEnqueue attribute),147

aliastypes (pysap.SAPEnqueue.SAPEnqueueParam at-tribute), 147

aliastypes (pysap.SAPEnqueue.SAPEnqueueTracePatternattribute), 147

aliastypes (pysap.SAPIGS.SAPIGS attribute), 148aliastypes (pysap.SAPIGS.SAPIGSTable attribute), 149aliastypes (pysap.SAPLPS.SAP_LPS_Cipher attribute),

149aliastypes (pysap.SAPMS.SAPDPInfo1 attribute), 150aliastypes (pysap.SAPMS.SAPDPInfo2 attribute), 150aliastypes (pysap.SAPMS.SAPDPInfo3 attribute), 150aliastypes (pysap.SAPMS.SAPMS attribute), 151aliastypes (pysap.SAPMS.SAPMSAdmRecord attribute),

151aliastypes (pysap.SAPMS.SAPMSClient1 attribute), 151aliastypes (pysap.SAPMS.SAPMSClient2 attribute), 151

177

Page 182: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

aliastypes (pysap.SAPMS.SAPMSClient3 attribute), 151aliastypes (pysap.SAPMS.SAPMSClient4 attribute), 151aliastypes (pysap.SAPMS.SAPMSCounter attribute), 152aliastypes (pysap.SAPMS.SAPMSJ2EECluster attribute),

152aliastypes (pysap.SAPMS.SAPMSJ2EEHeader attribute),

152aliastypes (pysap.SAPMS.SAPMSJ2EEService at-

tribute), 152aliastypes (pysap.SAPMS.SAPMSLogon attribute), 152aliastypes (pysap.SAPMS.SAPMSProperty attribute),

153aliastypes (pysap.SAPMS.SAPMSStat3 attribute), 153aliastypes (pysap.SAPNI.SAPNI attribute), 154aliastypes (pysap.SAPPSE.PKCS12_PBE1_Parameters

attribute), 159aliastypes (pysap.SAPPSE.PKCS5_Algorithm_Identifier

attribute), 159aliastypes (pysap.SAPPSE.PKCS5_Salt_Parameter at-

tribute), 159aliastypes (pysap.SAPPSE.SAPPSE_Cont attribute), 160aliastypes (pysap.SAPPSE.SAPPSE_Obj attribute), 160aliastypes (pysap.SAPPSE.SAPPSE_Obj_CertList

attribute), 160aliastypes (pysap.SAPPSE.SAPPSE_Obj_PKList at-

tribute), 160aliastypes (pysap.SAPPSE.SAPPSE_Obj_PKRoot

attribute), 161aliastypes (pysap.SAPPSE.SAPPSE_Root_Key at-

tribute), 161aliastypes (pysap.SAPPSE.SAPPSEFile attribute), 159aliastypes (pysap.SAPPSE.SAPPSEv2_Enc_Cont at-

tribute), 161aliastypes (pysap.SAPPSE.SAPPSEv4_Enc_Cont at-

tribute), 161aliastypes (pysap.SAPRFC.DEF_FIELDS attribute), 161aliastypes (pysap.SAPRFC.SAPCPIC attribute), 161aliastypes (pysap.SAPRFC.SAPCPIC2 attribute), 162aliastypes (pysap.SAPRFC.SAPCPIC_CUT attribute),

162aliastypes (pysap.SAPRFC.SAPCPICPARAM attribute),

162aliastypes (pysap.SAPRFC.SAPCPICPARAM2 at-

tribute), 162aliastypes (pysap.SAPRFC.SAPCPICSUFFIX attribute),

162aliastypes (pysap.SAPRFC.SAPRFC attribute), 162aliastypes (pysap.SAPRFC.SAPRFCDTStruct attribute),

162aliastypes (pysap.SAPRFC.SAPRFCEXTEND attribute),

163aliastypes (pysap.SAPRFC.SAPRFCPING attribute), 163aliastypes (pysap.SAPRFC.SAPRFCTHStruct attribute),

163

aliastypes (pysap.SAPRFC.SAPRFXPG attribute), 163aliastypes (pysap.SAPRFC.SAPRFXPG_END attribute),

163aliastypes (pysap.SAPRouter.SAPRouter attribute), 166aliastypes (pysap.SAPRouter.SAPRouterError attribute),

166aliastypes (pysap.SAPRouter.SAPRouterInfoClient at-

tribute), 166aliastypes (pysap.SAPRouter.SAPRouterInfoClients at-

tribute), 167aliastypes (pysap.SAPRouter.SAPRouterInfoServer at-

tribute), 167aliastypes (pysap.SAPRouter.SAPRouterRouteHop at-

tribute), 168aliastypes (pysap.SAPSNC.SAPSNCFrame attribute),

170aliastypes (pysap.utils.fields.PacketNoPadded attribute),

129ANY (pysap.SAPPSE.ASN1_Class_PSE attribute), 157appc_protocol_values (in module pysap.SAPRFC), 163appc_rc_values (in module pysap.SAPRFC), 163ASN1_Class_PSE (class in pysap.SAPPSE), 157ASN1_codec (pysap.SAPCredv2.SAPCredv2 attribute),

137ASN1_codec (pysap.SAPCredv2.SAPCredv2_Cred at-

tribute), 137ASN1_codec (pysap.SAPCredv2.SAPCredv2_Cred_LPS

attribute), 138ASN1_codec (pysap.SAPCredv2.SAPCredv2_Cred_Plain

attribute), 139ASN1_codec (pysap.SAPCredv2.SAPCredv2Cred

attribute), 137ASN1_codec (pysap.SAPPSE.PKCS12_PBE1_Parameters

attribute), 158ASN1_codec (pysap.SAPPSE.PKCS5_Algorithm_Identifier

attribute), 159ASN1_codec (pysap.SAPPSE.PKCS5_Salt_Parameter

attribute), 159ASN1_codec (pysap.SAPPSE.SAPPSE_Cont attribute),

160ASN1_codec (pysap.SAPPSE.SAPPSE_Obj attribute),

160ASN1_codec (pysap.SAPPSE.SAPPSE_Obj_CertList at-

tribute), 160ASN1_codec (pysap.SAPPSE.SAPPSE_Obj_PKList at-

tribute), 160ASN1_codec (pysap.SAPPSE.SAPPSE_Obj_PKRoot at-

tribute), 160ASN1_codec (pysap.SAPPSE.SAPPSE_Root_Key at-

tribute), 161ASN1_codec (pysap.SAPPSE.SAPPSEFile attribute),

159ASN1_codec (pysap.SAPPSE.SAPPSEv2_Enc_Cont at-

tribute), 161

178 Index

Page 183: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

ASN1_codec (pysap.SAPPSE.SAPPSEv4_Enc_Cont at-tribute), 161

ASN1_PSE_v2_ENC_CONT_SEQUENCE (class inpysap.SAPPSE), 158

ASN1_PSE_v4_ENC_CONT_SEQUENCE (class inpysap.SAPPSE), 158

ASN1_root (pysap.SAPCredv2.SAPCredv2 attribute),137

ASN1_root (pysap.SAPCredv2.SAPCredv2_Cred at-tribute), 137

ASN1_root (pysap.SAPCredv2.SAPCredv2_Cred_LPSattribute), 138

ASN1_root (pysap.SAPCredv2.SAPCredv2_Cred_Plainattribute), 139

ASN1_root (pysap.SAPCredv2.SAPCredv2Cred at-tribute), 137

ASN1_root (pysap.SAPPSE.PKCS12_PBE1_Parametersattribute), 158

ASN1_root (pysap.SAPPSE.PKCS5_Algorithm_Identifierattribute), 159

ASN1_root (pysap.SAPPSE.PKCS5_Salt_Parameter at-tribute), 159

ASN1_root (pysap.SAPPSE.SAPPSE_Cont attribute),160

ASN1_root (pysap.SAPPSE.SAPPSE_Obj attribute), 160ASN1_root (pysap.SAPPSE.SAPPSE_Obj_CertList at-

tribute), 160ASN1_root (pysap.SAPPSE.SAPPSE_Obj_PKList at-

tribute), 160ASN1_root (pysap.SAPPSE.SAPPSE_Obj_PKRoot at-

tribute), 161ASN1_root (pysap.SAPPSE.SAPPSE_Root_Key at-

tribute), 161ASN1_root (pysap.SAPPSE.SAPPSEFile attribute), 159ASN1_root (pysap.SAPPSE.SAPPSEv2_Enc_Cont at-

tribute), 161ASN1_root (pysap.SAPPSE.SAPPSEv4_Enc_Cont at-

tribute), 161ASN1_tag (pysap.SAPPSE.ASN1F_PSE_v2_ENC_CONT_SEQUENCE

attribute), 157ASN1_tag (pysap.SAPPSE.ASN1F_PSE_v4_ENC_CONT_SEQUENCE

attribute), 157ASN1F_CHOICE_SAFE (class in pysap.utils.fields), 128ASN1F_PSE_v2_ENC_CONT_SEQUENCE (class in

pysap.SAPPSE), 157ASN1F_PSE_v4_ENC_CONT_SEQUENCE (class in

pysap.SAPPSE), 157

BBaseConsole (class in pysap.utils.console), 126BERcodec_PSE_v2_ENC_CONT_SEQUENCE (class in

pysap.SAPPSE), 158BERcodec_PSE_v4_ENC_CONT_SEQUENCE (class in

pysap.SAPPSE), 158

bind_diagitem() (in module pysap.SAPDiag), 141BIT_STRING (pysap.SAPPSE.ASN1_Class_PSE

attribute), 157BMP_STRING (pysap.SAPPSE.ASN1_Class_PSE at-

tribute), 157BOOLEAN (pysap.SAPPSE.ASN1_Class_PSE at-

tribute), 157ByteMultiEnumKeysField (class in pysap.utils.fields),

128

Ccalculate_checksum() (pysap.SAPCAR.SAPCARArchiveFile

static method), 132CHAR_STRING (pysap.SAPPSE.ASN1_Class_PSE at-

tribute), 157check_checksum() (pysap.SAPCAR.SAPCARArchiveFile

method), 132checksum (pysap.SAPCAR.SAPCARArchiveFile at-

tribute), 132cipher_algorithm (pysap.SAPCredv2.SAPCredv2_Cred

attribute), 137cipher_algorithm (pysap.SAPCredv2.SAPCredv2_Cred_LPS

attribute), 138CIPHER_ALGORITHM_3DES (in module

pysap.SAPCredv2), 136CIPHER_ALGORITHM_AES256 (in module

pysap.SAPCredv2), 136cipher_algorithms (in module pysap.SAPCredv2), 139cipher_format_version (pysap.SAPCredv2.SAPCredv2_Cred

attribute), 137cipher_format_version (pysap.SAPCredv2.SAPCredv2_Cred_LPS

attribute), 138clients_cls (pysap.SAPNI.SAPNIServer attribute), 155close() (pysap.SAPCAR.SAPCARArchive method), 131close() (pysap.SAPDiagClient.SAPDiagConnection

method), 144close() (pysap.SAPNI.SAPNIServerHandler method),

156cluster_no (pysap.SAPMS.SAPMSJ2EECluster at-

tribute), 152cluster_no (pysap.SAPMS.SAPMSJ2EEHeader at-

tribute), 152cluster_no_id (pysap.SAPMS.SAPMSJ2EECluster at-

tribute), 152common_name (pysap.SAPCredv2.SAPCredv2_Cred at-

tribute), 137common_name (pysap.SAPCredv2.SAPCredv2_Cred_LPS

attribute), 138complete_options() (pysap.utils.console.BaseConsole

method), 126compress() (in module pysapcompress), 170CompressError, 170connect() (pysap.SAPDiagClient.SAPDiagConnection

method), 144

Index 179

Page 184: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

count_from (pysap.utils.fields.PacketListStopFieldattribute), 129

COUNTER32 (pysap.SAPPSE.ASN1_Class_PSEattribute), 157

cpic_ctypes (in module pysap.SAPRFC), 163cpic_padd (in module pysap.SAPRFC), 163cpic_suff_padd (in module pysap.SAPRFC), 163create() (pysap.SAPCAR.SAPCARArchive method), 131cred_key_fmt (in module pysap.SAPCredv2), 139cred_key_lps_fallback (in module pysap.SAPLPS), 150

Ddecompress() (in module pysapcompress), 171DecompressError, 170decrypt() (pysap.SAPCredv2.SAPCredv2_Cred method),

137decrypt() (pysap.SAPCredv2.SAPCredv2_Cred_LPS

method), 138decrypt() (pysap.SAPLPS.SAP_LPS_Cipher method),

149decrypt() (pysap.SAPPSE.SAPPSEFile method), 159decrypt() (pysap.utils.crypto.PKCS12_PBES1 method),

127decrypt_encryption_key_dpapi()

(pysap.SAPLPS.SAP_LPS_Cipher method),149

decrypt_encryption_key_fallback()(pysap.SAPLPS.SAP_LPS_Cipher method),149

decrypt_encryption_key_tpm()(pysap.SAPLPS.SAP_LPS_Cipher method),150

decrypt_lps() (pysap.SAPPSE.SAPPSEFile method), 159decrypt_MSCryptProtect()

(pysap.SAPCredv2.SAPCredv2_Cred_Plainstatic method), 139

decrypt_non_lps() (pysap.SAPPSE.SAPPSEFilemethod), 159

decrypt_provider() (pysap.SAPCredv2.SAPCredv2_Cred_Plainmethod), 139

decrypt_simple() (pysap.SAPCredv2.SAPCredv2_Credmethod), 137

decrypt_with_header() (pysap.SAPCredv2.SAPCredv2_Credmethod), 138

DEF_FIELDS (class in pysap.SAPRFC), 161derive() (pysap.utils.crypto.PBKDF1 method), 127derive() (pysap.utils.crypto.PKCS12_PBKDF1 method),

127derive_key() (pysap.utils.crypto.PKCS12_PBES1

method), 127desc (pysap.SAPEnqueue.SAPEnqueueStreamSocket at-

tribute), 147desc (pysap.SAPNI.SAPNIStreamSocket attribute), 156

desc (pysap.SAPRouter.SAPRoutedStreamSocket at-tribute), 164

diag_appl_ids (in module pysap.SAPDiag), 141diag_appl_sids (in module pysap.SAPDiag), 141diag_atom_etypes (in module pysap.SAPDiagItems), 146diag_compress_values (in module pysap.SAPDiag), 141diag_guess_diagdp_header() (in module

pysap.SAPDiag), 141diag_item_appl_classes (in module pysap.SAPDiag), 141diag_item_classes (in module pysap.SAPDiag), 141diag_item_get_class() (in module pysap.SAPDiag), 141diag_item_get_length() (in module pysap.SAPDiag), 142diag_item_is_appl_appl4() (in module pysap.SAPDiag),

142diag_item_is_long() (in module pysap.SAPDiag), 142diag_item_is_short() (in module pysap.SAPDiag), 142diag_item_types (in module pysap.SAPDiag), 142diag_ui_event_control_values (in module

pysap.SAPDiagItems), 146diag_ui_event_navigation_data_values (in module

pysap.SAPDiagItems), 146diag_ui_event_type_values (in module

pysap.SAPDiagItems), 146do_compress() (pysap.SAPDiag.SAPDiag method), 140do_decompress() (pysap.SAPDiag.SAPDiag method),

140do_exit() (pysap.utils.console.BaseConsole method), 126do_help() (pysap.utils.console.BaseConsole method), 126do_history() (pysap.utils.console.BaseConsole method),

126do_options() (pysap.utils.console.BaseConsole method),

127do_script() (pysap.utils.console.BaseConsole method),

127dp_agent_type_values (in module pysap.SAPMS), 153dp_prio_values (in module pysap.SAPMS), 153dp_req_handler_values (in module pysap.SAPMS), 153dp_type_values (in module pysap.SAPMS), 153dp_worker_type_values (in module pysap.SAPMS), 153dpapi_decrypt_blob() (in module pysap.utils.crypto), 127

EEMBEDDED_PDF (pysap.SAPPSE.ASN1_Class_PSE

attribute), 157emptyline() (pysap.utils.console.BaseConsole method),

127encoding (pysap.utils.fields.StrEncodedPaddedField at-

tribute), 129encrypt() (pysap.utils.crypto.PKCS12_PBES1 method),

127enqueue_conn_admin_opcode_values (in module

pysap.SAPEnqueue), 147enqueue_dest_values (in module pysap.SAPEnqueue),

147

180 Index

Page 185: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

enqueue_param_values (in module pysap.SAPEnqueue),147

enqueue_server_admin_opcode_values (in modulepysap.SAPEnqueue), 147

enqueue_server_admin_trace_action_values (in modulepysap.SAPEnqueue), 147

enqueue_server_admin_trace_limit_values (in modulepysap.SAPEnqueue), 147

enqueue_server_admin_trace_thread_values (in modulepysap.SAPEnqueue), 147

enqueue_type_values (in module pysap.SAPEnqueue),147

ENUMERATED (pysap.SAPPSE.ASN1_Class_PSE at-tribute), 157

ERROR (pysap.SAPPSE.ASN1_Class_PSE attribute),157

evaluators (pysap.utils.fields.MutablePacketField at-tribute), 128

EXTERNAL (pysap.SAPPSE.ASN1_Class_PSE at-tribute), 157

extract() (pysap.SAPCAR.SAPCARArchiveFilev200Formatmethod), 134

extract_padding() (pysap.utils.fields.PacketNoPaddedmethod), 129

Ffd (pysap.SAPCAR.SAPCARArchive attribute), 131fields_desc (pysap.SAPCAR.SAPCARArchiveFilev200Format

attribute), 134fields_desc (pysap.SAPCAR.SAPCARArchiveFilev201Format

attribute), 135fields_desc (pysap.SAPCAR.SAPCARArchiveFormat at-

tribute), 135fields_desc (pysap.SAPCAR.SAPCARCompressedBlobFormat

attribute), 135fields_desc (pysap.SAPCAR.SAPCARCompressedBlockFormat

attribute), 135fields_desc (pysap.SAPCredv2.SAPCredv2 attribute),

137fields_desc (pysap.SAPCredv2.SAPCredv2_Cred at-

tribute), 138fields_desc (pysap.SAPCredv2.SAPCredv2_Cred_Cipher

attribute), 138fields_desc (pysap.SAPCredv2.SAPCredv2_Cred_LPS

attribute), 138fields_desc (pysap.SAPCredv2.SAPCredv2_Cred_Plain

attribute), 139fields_desc (pysap.SAPCredv2.SAPCredv2Cred at-

tribute), 137fields_desc (pysap.SAPDiag.SAPDiag attribute), 140fields_desc (pysap.SAPDiag.SAPDiagDP attribute), 140fields_desc (pysap.SAPDiag.SAPDiagError attribute),

141fields_desc (pysap.SAPDiag.SAPDiagItem attribute), 141

fields_desc (pysap.SAPDiag.SAPDiagItems attribute),141

fields_desc (pysap.SAPDiagItems.SAPDiagAreaSize at-tribute), 145

fields_desc (pysap.SAPDiagItems.SAPDiagDyntAtomattribute), 145

fields_desc (pysap.SAPDiagItems.SAPDiagDyntAtomItemattribute), 145

fields_desc (pysap.SAPDiagItems.SAPDiagMenuEntriesattribute), 145

fields_desc (pysap.SAPDiagItems.SAPDiagMenuEntryattribute), 146

fields_desc (pysap.SAPDiagItems.SAPDiagSES at-tribute), 146

fields_desc (pysap.SAPDiagItems.SAPDiagStep at-tribute), 146

fields_desc (pysap.SAPDiagItems.SAPDiagSupportBitsattribute), 146

fields_desc (pysap.SAPDiagItems.SAPDiagUIEventSourceattribute), 146

fields_desc (pysap.SAPDiagItems.SAPDiagUserConnectattribute), 146

fields_desc (pysap.SAPDiagItems.SAPDiagWindowSizeattribute), 146

fields_desc (pysap.SAPEnqueue.SAPEnqueue attribute),147

fields_desc (pysap.SAPEnqueue.SAPEnqueueParam at-tribute), 147

fields_desc (pysap.SAPEnqueue.SAPEnqueueTracePatternattribute), 147

fields_desc (pysap.SAPIGS.SAPIGS attribute), 148fields_desc (pysap.SAPIGS.SAPIGSTable attribute), 149fields_desc (pysap.SAPLPS.SAP_LPS_Cipher attribute),

150fields_desc (pysap.SAPMS.SAPDPInfo1 attribute), 150fields_desc (pysap.SAPMS.SAPDPInfo2 attribute), 150fields_desc (pysap.SAPMS.SAPDPInfo3 attribute), 150fields_desc (pysap.SAPMS.SAPMS attribute), 151fields_desc (pysap.SAPMS.SAPMSAdmRecord at-

tribute), 151fields_desc (pysap.SAPMS.SAPMSClient1 attribute),

151fields_desc (pysap.SAPMS.SAPMSClient2 attribute),

151fields_desc (pysap.SAPMS.SAPMSClient3 attribute),

151fields_desc (pysap.SAPMS.SAPMSClient4 attribute),

151fields_desc (pysap.SAPMS.SAPMSCounter attribute),

152fields_desc (pysap.SAPMS.SAPMSJ2EECluster at-

tribute), 152fields_desc (pysap.SAPMS.SAPMSJ2EEHeader at-

tribute), 152

Index 181

Page 186: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

fields_desc (pysap.SAPMS.SAPMSJ2EEService at-tribute), 152

fields_desc (pysap.SAPMS.SAPMSLogon attribute), 152fields_desc (pysap.SAPMS.SAPMSProperty attribute),

153fields_desc (pysap.SAPMS.SAPMSStat3 attribute), 153fields_desc (pysap.SAPNI.SAPNI attribute), 154fields_desc (pysap.SAPPSE.PKCS12_PBE1_Parameters

attribute), 159fields_desc (pysap.SAPPSE.PKCS5_Algorithm_Identifier

attribute), 159fields_desc (pysap.SAPPSE.PKCS5_Salt_Parameter at-

tribute), 159fields_desc (pysap.SAPPSE.SAPPSE_Cont attribute),

160fields_desc (pysap.SAPPSE.SAPPSE_Obj attribute), 160fields_desc (pysap.SAPPSE.SAPPSE_Obj_CertList at-

tribute), 160fields_desc (pysap.SAPPSE.SAPPSE_Obj_PKList

attribute), 160fields_desc (pysap.SAPPSE.SAPPSE_Obj_PKRoot at-

tribute), 161fields_desc (pysap.SAPPSE.SAPPSE_Root_Key at-

tribute), 161fields_desc (pysap.SAPPSE.SAPPSEFile attribute), 160fields_desc (pysap.SAPPSE.SAPPSEv2_Enc_Cont at-

tribute), 161fields_desc (pysap.SAPPSE.SAPPSEv4_Enc_Cont at-

tribute), 161fields_desc (pysap.SAPRFC.DEF_FIELDS attribute),

161fields_desc (pysap.SAPRFC.SAPCPIC attribute), 161fields_desc (pysap.SAPRFC.SAPCPIC2 attribute), 162fields_desc (pysap.SAPRFC.SAPCPIC_CUT attribute),

162fields_desc (pysap.SAPRFC.SAPCPICPARAM at-

tribute), 162fields_desc (pysap.SAPRFC.SAPCPICPARAM2 at-

tribute), 162fields_desc (pysap.SAPRFC.SAPCPICSUFFIX at-

tribute), 162fields_desc (pysap.SAPRFC.SAPRFC attribute), 162fields_desc (pysap.SAPRFC.SAPRFCDTStruct at-

tribute), 162fields_desc (pysap.SAPRFC.SAPRFCEXTEND at-

tribute), 163fields_desc (pysap.SAPRFC.SAPRFCPING attribute),

163fields_desc (pysap.SAPRFC.SAPRFCTHStruct at-

tribute), 163fields_desc (pysap.SAPRFC.SAPRFXPG attribute), 163fields_desc (pysap.SAPRFC.SAPRFXPG_END at-

tribute), 163fields_desc (pysap.SAPRouter.SAPRouter attribute), 166

fields_desc (pysap.SAPRouter.SAPRouterError at-tribute), 166

fields_desc (pysap.SAPRouter.SAPRouterInfoClient at-tribute), 166

fields_desc (pysap.SAPRouter.SAPRouterInfoClients at-tribute), 167

fields_desc (pysap.SAPRouter.SAPRouterInfoServer at-tribute), 167

fields_desc (pysap.SAPRouter.SAPRouterRouteHop at-tribute), 168

fields_desc (pysap.SAPSNC.SAPSNCFrame attribute),170

file_length (pysap.SAPCAR.SAPCARArchiveFilev200Formatattribute), 134

filemode() (in module pysap.SAPCAR), 136filename (pysap.SAPCAR.SAPCARArchive attribute),

131filename (pysap.SAPCAR.SAPCARArchiveFile at-

tribute), 132files (pysap.SAPCAR.SAPCARArchive attribute), 131files_names (pysap.SAPCAR.SAPCARArchive at-

tribute), 131format (pysap.utils.fields.IntToStrField attribute), 128from_archive_file() (pysap.SAPCAR.SAPCARArchiveFile

class method), 132from_file() (pysap.SAPCAR.SAPCARArchiveFile class

method), 133from_hops() (pysap.SAPRouter.SAPRouterRouteHop

class method), 168from_string() (pysap.SAPRouter.SAPRouterRouteHop

class method), 168

GGAUGE32 (pysap.SAPPSE.ASN1_Class_PSE attribute),

157GENERAL_STRING (pysap.SAPPSE.ASN1_Class_PSE

attribute), 157GENERALIZED_TIME (pysap.SAPPSE.ASN1_Class_PSE

attribute), 157get_class() (pysap.utils.fields.MutablePacketField

method), 128get_item() (pysap.SAPDiag.SAPDiag method), 140get_nisocket() (pysap.SAPNI.SAPNIStreamSocket class

method), 156get_nisocket() (pysap.SAPRouter.SAPRoutedStreamSocket

class method), 164get_request() (pysap.SAPNI.SAPNIServer method), 155get_router_version() (in module pysap.SAPRouter), 168get_support_data_item() (pysap.SAPDiagClient.SAPDiagConnection

method), 144get_terminal_name() (pysap.SAPDiagClient.SAPDiagConnection

static method), 144getfield() (pysap.utils.fields.PacketListStopField

method), 129

182 Index

Page 187: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

getfield() (pysap.utils.fields.StrEncodedPaddedFieldmethod), 129

getfield() (pysap.utils.fields.StrFixedLenPaddedFieldmethod), 130

getfield() (pysap.utils.fields.StrNullFixedLenFieldmethod), 130

getfield() (pysap.utils.fields.StrNullFixedLenPaddedFieldmethod), 131

GRAPHIC_STRING (pysap.SAPPSE.ASN1_Class_PSEattribute), 157

Hh2i() (pysap.utils.fields.StrEncodedPaddedField method),

129handle() (pysap.SAPNI.SAPNIServerHandler method),

156handle_connection() (pysap.SAPNI.SAPNIProxy

method), 154handle_connection() (pysap.SAPRouter.SAPRouterNativeProxy

method), 167handle_data() (pysap.SAPNI.SAPNIServerHandler

method), 156handle_error() (pysap.SAPNI.SAPNIServer method), 155http() (pysap.SAPIGS.SAPIGS static method), 148

Ii2count() (pysap.utils.fields.IntToStrField method), 128i2h() (pysap.utils.fields.StrEncodedPaddedField method),

129i2m() (pysap.utils.fields.IntToStrField method), 128i2m() (pysap.utils.fields.MutablePacketField method),

128i2repr() (pysap.utils.fields.StrNullFixedLenField

method), 130IA5_STRING (pysap.SAPPSE.ASN1_Class_PSE at-

tribute), 157icm_port (pysap.SAPMS.SAPMSJ2EECluster attribute),

152igs_req_adm (in module pysap.SAPIGS), 149igs_req_interpreter (in module pysap.SAPIGS), 149init() (pysap.SAPDiagClient.SAPDiagConnection

method), 144initialized (pysap.SAPDiagClient.SAPDiagConnection

attribute), 144INTEGER (pysap.SAPPSE.ASN1_Class_PSE attribute),

157interact() (pysap.SAPDiagClient.SAPDiagConnection

method), 144IntToStrField (class in pysap.utils.fields), 128IPADDRESS (pysap.SAPPSE.ASN1_Class_PSE at-

tribute), 157is_directory() (pysap.SAPCAR.SAPCARArchiveFile

method), 133

is_file() (pysap.SAPCAR.SAPCARArchiveFile method),133

is_filename_null_terminated(pysap.SAPCAR.SAPCARArchiveFilev200Formatattribute), 135

is_filename_null_terminated(pysap.SAPCAR.SAPCARArchiveFilev201Formatattribute), 135

ISO646_STRING (pysap.SAPPSE.ASN1_Class_PSE at-tribute), 157

Llast_response (pysap.SAPDiagClient.SAPDiagConnection

attribute), 144length (pysap.utils.fields.IntToStrField attribute), 128length_from (pysap.utils.fields.MutablePacketField at-

tribute), 128length_from (pysap.utils.fields.PacketListStopField at-

tribute), 129length_from (pysap.utils.fields.StrFixedLenPaddedField

attribute), 130length_from (pysap.utils.fields.StrNullFixedLenField at-

tribute), 130length_from (pysap.utils.fields.StrNullFixedLenPaddedField

attribute), 131LPS_DPAPI (pysap.SAPLPS.SAP_LPS_Cipher at-

tribute), 149lps_encryption_key_decryptor (in module

pysap.SAPLPS), 150LPS_FALLBACK (pysap.SAPLPS.SAP_LPS_Cipher at-

tribute), 149LPS_TPM (pysap.SAPLPS.SAP_LPS_Cipher attribute),

149lps_type (pysap.SAPCredv2.SAPCredv2_Cred attribute),

138lps_type (pysap.SAPCredv2.SAPCredv2_Cred_LPS at-

tribute), 138lps_type_str (pysap.SAPCredv2.SAPCredv2_Cred

attribute), 138lps_type_str (pysap.SAPCredv2.SAPCredv2_Cred_LPS

attribute), 138lps_types (pysap.SAPLPS.SAP_LPS_Cipher attribute),

150

Mm2i() (pysap.utils.fields.ASN1F_CHOICE_SAFE

method), 128m2i() (pysap.utils.fields.IntToStrField method), 128m2i() (pysap.utils.fields.MutablePacketField method),

128max_length (pysap.utils.fields.StrNullFixedLenField at-

tribute), 130ms_adm_opcode_values (in module pysap.SAPMS), 153

Index 183

Page 188: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

ms_adm_rzl_strg_type_values (in modulepysap.SAPMS), 153

ms_adm_type_values (in module pysap.SAPMS), 153ms_client_status_values (in module pysap.SAPMS), 153ms_domain_values (in module pysap.SAPMS), 153ms_dump_command_values (in module pysap.SAPMS),

153ms_errorno_values (in module pysap.SAPMS), 153ms_file_reload_values (in module pysap.SAPMS), 153ms_flag_values (in module pysap.SAPMS), 153ms_iflag_values (in module pysap.SAPMS), 153ms_logon_type_values (in module pysap.SAPMS), 153ms_opcode_error_values (in module pysap.SAPMS), 153ms_opcode_values (in module pysap.SAPMS), 154ms_property_id_values (in module pysap.SAPMS), 154MutablePacketField (class in pysap.utils.fields), 128

Nname (pysap.SAPPSE.ASN1_Class_PSE attribute), 158node_no (pysap.SAPMS.SAPMSJ2EECluster attribute),

152NONE (pysap.SAPPSE.ASN1_Class_PSE attribute), 158NULL (pysap.SAPPSE.ASN1_Class_PSE attribute), 158null_terminated (pysap.utils.fields.StrNullFixedLenField

attribute), 130NUMERIC_STRING (pysap.SAPPSE.ASN1_Class_PSE

attribute), 158

OOBJECT_DESCRIPTOR

(pysap.SAPPSE.ASN1_Class_PSE attribute),158

OID (pysap.SAPPSE.ASN1_Class_PSE attribute), 158open() (pysap.SAPCAR.SAPCARArchive method), 131open() (pysap.SAPCAR.SAPCARArchiveFile method),

133options (pysap.SAPNI.SAPNIServer attribute), 155

PPacketListStopField (class in pysap.utils.fields), 128PacketNoPadded (class in pysap.utils.fields), 129padd (pysap.utils.fields.StrEncodedPaddedField at-

tribute), 129padd (pysap.utils.fields.StrFixedLenPaddedField at-

tribute), 130padd (pysap.utils.fields.StrNullFixedLenPaddedField at-

tribute), 131PBKDF1 (class in pysap.utils.crypto), 127perm_mode (pysap.SAPCAR.SAPCARArchiveFile at-

tribute), 133permissions (pysap.SAPCAR.SAPCARArchiveFile at-

tribute), 133PKCS12_PBE1_Parameters (class in pysap.SAPPSE),

158

PKCS12_PBES1 (class in pysap.utils.crypto), 127PKCS12_PBKDF1 (class in pysap.utils.crypto), 127PKCS5_Algorithm_Identifier (class in pysap.SAPPSE),

159PKCS5_Salt_Parameter (class in pysap.SAPPSE), 159post_build() (pysap.SAPDiag.SAPDiag method), 140post_build() (pysap.SAPDiagItems.SAPDiagDyntAtomItem

method), 145post_build() (pysap.SAPEnqueue.SAPEnqueue method),

147postcmd() (pysap.utils.console.BaseConsole method),

127postloop() (pysap.utils.console.BaseConsole method),

127pre_dissect() (pysap.SAPDiag.SAPDiag method), 140precmd() (pysap.utils.console.BaseConsole method), 127preloop() (pysap.utils.console.BaseConsole method), 127PRINTABLE_STRING (pysap.SAPPSE.ASN1_Class_PSE

attribute), 158process_client() (pysap.SAPNI.SAPNIProxyHandler

method), 155process_server() (pysap.SAPNI.SAPNIProxyHandler

method), 155PROVIDER_MSCryptProtect

(pysap.SAPCredv2.SAPCredv2_Cred_Plainattribute), 139

providers (pysap.SAPCredv2.SAPCredv2_Cred_Plain at-tribute), 139

pse_file_path (pysap.SAPCredv2.SAPCredv2_Cred at-tribute), 138

pse_file_path (pysap.SAPCredv2.SAPCredv2_Cred_LPSattribute), 139

pysap (module), 125pysap.SAPCAR (module), 131pysap.SAPCredv2 (module), 136pysap.SAPDiag (module), 139pysap.SAPDiagClient (module), 143pysap.SAPDiagItems (module), 145pysap.SAPEnqueue (module), 146pysap.SAPIGS (module), 148pysap.SAPLPS (module), 149pysap.SAPMS (module), 150pysap.SAPNI (module), 154pysap.SAPPSE (module), 157pysap.SAPRFC (module), 161pysap.SAPRouter (module), 164pysap.SAPSNC (module), 170pysap.utils (module), 126pysap.utils.console (module), 126pysap.utils.crypto (module), 127pysap.utils.fields (module), 128pysapcompress (module), 170

184 Index

Page 189: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

RRandByteReduced (class in pysap.utils.fields), 129randval() (pysap.utils.fields.ByteMultiEnumKeysField

method), 128randval() (pysap.utils.fields.StrNullFixedLenField

method), 130RAW (pysap.SAPPSE.ASN1_Class_PSE attribute), 158raw() (pysap.SAPCAR.SAPCARArchive method), 132read() (pysap.SAPCAR.SAPCARArchive method), 132REAL (pysap.SAPPSE.ASN1_Class_PSE attribute), 158receive() (pysap.SAPDiagClient.SAPDiagConnection

method), 144recv() (pysap.SAPEnqueue.SAPEnqueueStreamSocket

method), 147recv() (pysap.SAPNI.SAPNIStreamSocket method), 156recv() (pysap.SAPRouter.SAPRoutedStreamSocket

method), 164recv_send() (pysap.SAPNI.SAPNIProxyHandler

method), 155recv_send() (pysap.SAPRouter.SAPRouterNativeRouterHandler

method), 168regex (pysap.SAPRouter.SAPRouterRouteHop attribute),

168RELATIVE_OID (pysap.SAPPSE.ASN1_Class_PSE at-

tribute), 158remain (pysap.utils.fields.StrEncodedPaddedField at-

tribute), 129rfc_func_type_values (in module pysap.SAPRFC), 163rfc_monitor_cmd_values (in module pysap.SAPRFC),

163rfc_rfc_types (in module pysap.SAPRFC), 163rfc_start_type (in module pysap.SAPRFC), 164route() (pysap.SAPRouter.SAPRouterNativeProxy

method), 167route_to() (pysap.SAPRouter.SAPRoutedStreamSocket

method), 165router_adm_commands (in module pysap.SAPRouter),

168router_control_opcodes (in module pysap.SAPRouter),

168router_is_admin() (in module pysap.SAPRouter), 169router_is_control() (in module pysap.SAPRouter), 169router_is_error() (in module pysap.SAPRouter), 169router_is_known_type() (in module pysap.SAPRouter),

169router_is_pong() (in module pysap.SAPRouter), 169router_is_route() (in module pysap.SAPRouter), 169router_ni_talk_mode_values (in module

pysap.SAPRouter), 169router_return_codes (in module pysap.SAPRouter), 169router_type_values (pysap.SAPRouter.SAPRouter

attribute), 166run() (pysap.utils.Worker method), 126

SSAP_LPS_Cipher (class in pysap.SAPLPS), 149SAP_LPS_Decryption_Error, 150sap_rc_values (in module pysap.SAPRFC), 164sapcar_archive_file_versions (in module

pysap.SAPCAR), 136SAPCAR_BLOCK_TYPE_COMPRESSED (in module

pysap.SAPCAR), 135SAPCAR_BLOCK_TYPE_COMPRESSED_LAST (in

module pysap.SAPCAR), 136SAPCAR_BLOCK_TYPE_UNCOMPRESSED (in mod-

ule pysap.SAPCAR), 136SAPCAR_BLOCK_TYPE_UNCOMPRESSED_LAST

(in module pysap.SAPCAR), 136SAPCAR_HEADER_MAGIC_STRING_BACKUP (in

module pysap.SAPCAR), 136SAPCAR_HEADER_MAGIC_STRING_STANDARD

(in module pysap.SAPCAR), 136sapcar_is_last_block() (in module pysap.SAPCAR), 136SAPCAR_TYPE_AS400 (in module pysap.SAPCAR),

136SAPCAR_TYPE_DIR (in module pysap.SAPCAR), 136SAPCAR_TYPE_FILE (in module pysap.SAPCAR), 136SAPCAR_TYPE_LINK (in module pysap.SAPCAR),

136SAPCAR_TYPE_SHORTCUT (in module

pysap.SAPCAR), 136SAPCAR_VERSION_200 (in module pysap.SAPCAR),

136SAPCAR_VERSION_201 (in module pysap.SAPCAR),

136SAPCARArchive (class in pysap.SAPCAR), 131SAPCARArchiveFile (class in pysap.SAPCAR), 132SAPCARArchiveFilev200Format (class in

pysap.SAPCAR), 134SAPCARArchiveFilev201Format (class in

pysap.SAPCAR), 135SAPCARArchiveFormat (class in pysap.SAPCAR), 135SAPCARCompressedBlobFormat (class in

pysap.SAPCAR), 135SAPCARCompressedBlockFormat (class in

pysap.SAPCAR), 135SAPCARInvalidChecksumException, 135SAPCARInvalidFileException, 135SAPCPIC (class in pysap.SAPRFC), 161SAPCPIC2 (class in pysap.SAPRFC), 161SAPCPIC_CUT (class in pysap.SAPRFC), 162SAPCPICPARAM (class in pysap.SAPRFC), 162SAPCPICPARAM2 (class in pysap.SAPRFC), 162SAPCPICSUFFIX (class in pysap.SAPRFC), 162SAPCredv2 (class in pysap.SAPCredv2), 136SAPCredv2_Cred (class in pysap.SAPCredv2), 137SAPCredv2_Cred_Cipher (class in pysap.SAPCredv2),

138

Index 185

Page 190: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

SAPCredv2_Cred_LPS (class in pysap.SAPCredv2), 138SAPCredv2_Cred_Plain (class in pysap.SAPCredv2),

139SAPCredv2_Decryption_Error, 139SAPCredv2Cred (class in pysap.SAPCredv2), 137SAPDiag (class in pysap.SAPDiag), 139SAPDiagAreaSize (class in pysap.SAPDiagItems), 145SAPDiagConnection (class in pysap.SAPDiagClient),

143SAPDiagDP (class in pysap.SAPDiag), 140SAPDiagDyntAtom (class in pysap.SAPDiagItems), 145SAPDiagDyntAtomItem (class in pysap.SAPDiagItems),

145SAPDiagError (class in pysap.SAPDiag), 140SAPDiagItem (class in pysap.SAPDiag), 141SAPDiagItems (class in pysap.SAPDiag), 141SAPDiagMenuEntries (class in pysap.SAPDiagItems),

145SAPDiagMenuEntry (class in pysap.SAPDiagItems), 145SAPDiagSES (class in pysap.SAPDiagItems), 146SAPDiagStep (class in pysap.SAPDiagItems), 146SAPDiagSupportBits (class in pysap.SAPDiagItems),

146SAPDiagUIEventSource (class in pysap.SAPDiagItems),

146SAPDiagUserConnect (class in pysap.SAPDiagItems),

146SAPDiagWindowSize (class in pysap.SAPDiagItems),

146SAPDPInfo1 (class in pysap.SAPMS), 150SAPDPInfo2 (class in pysap.SAPMS), 150SAPDPInfo3 (class in pysap.SAPMS), 150SAPEnqueue (class in pysap.SAPEnqueue), 146SAPEnqueueParam (class in pysap.SAPEnqueue), 147SAPEnqueueStreamSocket (class in

pysap.SAPEnqueue), 147SAPEnqueueTracePattern (class in pysap.SAPEnqueue),

147SAPIGS (class in pysap.SAPIGS), 148SAPIGSTable (class in pysap.SAPIGS), 148SAPMS (class in pysap.SAPMS), 150SAPMSAdmRecord (class in pysap.SAPMS), 151SAPMSClient1 (class in pysap.SAPMS), 151SAPMSClient2 (class in pysap.SAPMS), 151SAPMSClient3 (class in pysap.SAPMS), 151SAPMSClient4 (class in pysap.SAPMS), 151SAPMSCounter (class in pysap.SAPMS), 151SAPMSJ2EECluster (class in pysap.SAPMS), 152SAPMSJ2EEHeader (class in pysap.SAPMS), 152SAPMSJ2EEService (class in pysap.SAPMS), 152SAPMSLogon (class in pysap.SAPMS), 152SAPMSProperty (class in pysap.SAPMS), 152SAPMSStat3 (class in pysap.SAPMS), 153SAPNI (class in pysap.SAPNI), 154

SAPNI_PING (pysap.SAPNI.SAPNI attribute), 154SAPNI_PONG (pysap.SAPNI.SAPNI attribute), 154SAPNIClient (class in pysap.SAPNI), 154SAPNIProxy (class in pysap.SAPNI), 154SAPNIProxyHandler (class in pysap.SAPNI), 155SAPNIServer (class in pysap.SAPNI), 155SAPNIServerHandler (class in pysap.SAPNI), 156SAPNIServerThreaded (class in pysap.SAPNI), 156SAPNIStreamSocket (class in pysap.SAPNI), 156SAPPSE_Cont (class in pysap.SAPPSE), 160SAPPSE_Obj (class in pysap.SAPPSE), 160SAPPSE_Obj_CertList (class in pysap.SAPPSE), 160SAPPSE_Obj_PKList (class in pysap.SAPPSE), 160SAPPSE_Obj_PKRoot (class in pysap.SAPPSE), 160SAPPSE_Root_Key (class in pysap.SAPPSE), 161SAPPSEFile (class in pysap.SAPPSE), 159SAPPSEv2_Enc_Cont (class in pysap.SAPPSE), 161SAPPSEv4_Enc_Cont (class in pysap.SAPPSE), 161SAPRFC (class in pysap.SAPRFC), 162SAPRFCDTStruct (class in pysap.SAPRFC), 162SAPRFCEXTEND (class in pysap.SAPRFC), 162SAPRFCPING (class in pysap.SAPRFC), 163SAPRFCTHStruct (class in pysap.SAPRFC), 163SAPRFXPG (class in pysap.SAPRFC), 163SAPRFXPG_END (class in pysap.SAPRFC), 163SAPRoutedStreamSocket (class in pysap.SAPRouter),

164SAPRouteException, 164SAPRouter (class in pysap.SAPRouter), 165SAPROUTER_ADMIN (pysap.SAPRouter.SAPRouter

attribute), 165SAPROUTER_CONTROL

(pysap.SAPRouter.SAPRouter attribute),166

SAPROUTER_DEFAULT_VERSION(pysap.SAPRouter.SAPRouter attribute),166

SAPROUTER_ERROR (pysap.SAPRouter.SAPRouterattribute), 166

SAPROUTER_PONG (pysap.SAPRouter.SAPRouter at-tribute), 166

SAPROUTER_ROUTE (pysap.SAPRouter.SAPRouterattribute), 166

SAPRouterError (class in pysap.SAPRouter), 166SAPRouterInfoClient (class in pysap.SAPRouter), 166SAPRouterInfoClients (class in pysap.SAPRouter), 166SAPRouterInfoServer (class in pysap.SAPRouter), 167SAPRouterNativeProxy (class in pysap.SAPRouter), 167SAPRouterNativeRouterHandler (class in

pysap.SAPRouter), 167SAPRouterRouteHop (class in pysap.SAPRouter), 168SAPSNCFrame (class in pysap.SAPSNC), 170saptimestamp_to_datetime() (in module

pysap.utils.fields), 131

186 Index

Page 191: Release 0.1.17.dev0 Martin Gallo, SecureAuth Corporation · pysap Documentation, Release 0.1.17.dev0 Installation with pip Installing pysap is simple withpip, just run the following

pysap Documentation, Release 0.1.17.dev0

send() (pysap.SAPDiagClient.SAPDiagConnectionmethod), 144

send() (pysap.SAPNI.SAPNIStreamSocket method), 157send() (pysap.SAPRouter.SAPRoutedStreamSocket

method), 165send_message() (pysap.SAPDiagClient.SAPDiagConnection

method), 144SEQUENCE (pysap.SAPPSE.ASN1_Class_PSE at-

tribute), 158SET (pysap.SAPPSE.ASN1_Class_PSE attribute), 158setup() (pysap.SAPNI.SAPNIServerHandler method),

156shutdown_request() (pysap.SAPNI.SAPNIServer

method), 156size (pysap.SAPCAR.SAPCARArchiveFile attribute),

134sr() (pysap.SAPDiagClient.SAPDiagConnection

method), 145sr() (pysap.SAPNI.SAPNIStreamSocket method), 157sr_message() (pysap.SAPDiagClient.SAPDiagConnection

method), 145step (pysap.SAPDiagClient.SAPDiagConnection at-

tribute), 145stop (pysap.utils.fields.PacketListStopField attribute),

129stop() (pysap.SAPNI.SAPNIProxy method), 155stop() (pysap.utils.Worker method), 126stop_workers() (pysap.SAPNI.SAPNIProxyHandler

method), 155StrEncodedPaddedField (class in pysap.utils.fields), 129StrFixedLenPaddedField (class in pysap.utils.fields), 129STRING (pysap.SAPPSE.ASN1_Class_PSE attribute),

158StrNullFixedLenField (class in pysap.utils.fields), 130StrNullFixedLenPaddedField (class in pysap.utils.fields),

130

TT61_STRING (pysap.SAPPSE.ASN1_Class_PSE

attribute), 158tag (pysap.SAPPSE.ASN1_PSE_v2_ENC_CONT_SEQUENCE

attribute), 158tag (pysap.SAPPSE.ASN1_PSE_v4_ENC_CONT_SEQUENCE

attribute), 158tag (pysap.SAPPSE.BERcodec_PSE_v2_ENC_CONT_SEQUENCE

attribute), 158tag (pysap.SAPPSE.BERcodec_PSE_v4_ENC_CONT_SEQUENCE

attribute), 158time_format (pysap.SAPRouter.SAPRouterError at-

tribute), 166TIME_TICKS (pysap.SAPPSE.ASN1_Class_PSE

attribute), 158timestamp (pysap.SAPCAR.SAPCARArchiveFile

attribute), 134

timestamp_raw (pysap.SAPCAR.SAPCARArchiveFileattribute), 134

type (pysap.SAPCAR.SAPCARArchiveFile attribute),134

UUNIVERSAL_STRING (pysap.SAPPSE.ASN1_Class_PSE

attribute), 158unwrap_snc() (in module pysap.SAPSNC), 170UTC_TIME (pysap.SAPPSE.ASN1_Class_PSE at-

tribute), 158UTF8_STRING (pysap.SAPPSE.ASN1_Class_PSE at-

tribute), 158

Vv2_ENC_CONT (pysap.SAPPSE.ASN1_Class_PSE at-

tribute), 158v4_ENC_CONT (pysap.SAPPSE.ASN1_Class_PSE at-

tribute), 158verify() (pysap.utils.crypto.PBKDF1 method), 127verify() (pysap.utils.crypto.PKCS12_PBKDF1 method),

127version (pysap.SAPCAR.SAPCARArchive attribute),

132version (pysap.SAPCAR.SAPCARArchiveFile attribute),

134version (pysap.SAPCAR.SAPCARArchiveFilev200Format

attribute), 135version (pysap.SAPCAR.SAPCARArchiveFilev201Format

attribute), 135VIDEOTEX_STRING (pysap.SAPPSE.ASN1_Class_PSE

attribute), 158

WWorker (class in pysap.utils), 126wrap_snc() (in module pysap.SAPSNC), 170write() (pysap.SAPCAR.SAPCARArchive method), 132write_as() (pysap.SAPCAR.SAPCARArchive method),

132

Index 187