Giter VIP home page Giter VIP logo

pysap's Introduction

pysap - Python library for crafting SAP's network protocols packets

Build Status Code Health Latest Version

Copyright (C) 2015 by Martin Gallo, Core Security

The library was designed and developed by Martin Gallo from the Security Consulting Services team of Core Security.

Version 0.1.7 (May 2015)

Overview

SAP Netweaver [1] is a technology platform for building and integrating SAP business applications. Communication between components uses different network protocols. While some of them are standard and well-known protocols, others are proprietaries and public information is not available.

This Python library provides modules for crafting and sending packets using SAP's NI, Message Server, Router, RFC, SNC, Enqueue and Diag protocols. The modules are based on Scapy [2] and are based on information acquired at researching the different protocols and services. Detailed information about the research can be found at [3], [4], [5], [6] and [7].

Features

This tool counts with the following components:

  • SAPNI module

    Scapy class for the SAP NI (Network Interface protocol). It also includes a Stream Socket implementation for the SAP NI protocol, as well as a base proxy and server implementations.

  • SAPDiag module

    Contain Scapy classes for craft and dissect Diag DP headers, Diag packets and items. The main class is SAPDiag, that is in charge of handling compression/decompression of payload items and serve as a container for them.

  • SAPDiagItems module

    Some classes for craft and dissect common Diag items.

  • SAPDiagClient module

    Basic class for establishing a connection with an application server.

  • SAPEnqueue module

    Scapy classes for the Enqueue protocol.

  • SAPRouter module

    Scapy classes for the different SAP Router packets (route, control, error and admin messages).

  • SAPMS module

    Scapy classes for the Message Server protocol.

  • SAPSNC module

    Basic class to serve as container of SNC Frames found in SAP Router and SAP Diag packets.

  • Examples

    Example and proof of concept scripts to illustrate the use of the different modules and protocols: login brute force, gather information on the application server, intercept communications, a rogue Diag server implementation, test of Denial of Server issues [4], a Message Server monitor implementation, listener/messager for Message Server, SAP Router internal networks scanner and port forwarder, etc.

Installation & Build

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
wxPython (http://www.wxpython.org/)
fau_timer (https://code.google.com/p/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 [2] library for crafting packets. Epydoc is also required for building the API documentation. 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

  • Some scapy installations also requires the following steps:

    Edit the file supersocket.py (located for example on /usr/local/lib/python2.7/dist-packages/scapy/supersocket.py)

    Add the line from scapy.packet import Padding

  • Additionally, runnnig Scapy on Windows might require some patching:

    Edit the file supersocket.py

    Add the line import arch at the end of the file

    See this scapy issue for more details.

Documentation

Documentation of the API can be build using:

$ python setup.py doc

A build is also available at http://pythonhosted.org/pysap/.

Example uses

Examples can be found in the examples directory.

License

This library is distributed under the GPLv2 license. Check the COPYING file for more details.

References

[1] http://www.sap.com/platform/netweaver/index.epx

[2] http://www.secdev.org/projects/scapy/

[3] http://corelabs.coresecurity.com/index.php?module=Wiki&action=view&type=tool&name=pysap

[4] http://www.coresecurity.com/content/sap-netweaver-dispatcher-multiple-vulnerabilities

[5] http://www.coresecurity.com/content/SAP-netweaver-msg-srv-multiple-vulnerabilities

[6] http://corelabs.coresecurity.com/index.php?module=Wiki&action=view&type=publication&name=Uncovering_SAP_vulnerabilities

[7] http://corelabs.coresecurity.com/index.php?module=Wiki&action=view&type=publication&name=saps_network_protocols_revisited

Contact

Whether you want to report a bug or give some suggestions on this package, drop us a few lines at [email protected] or contact the author email [email protected].

pysap's People

Contributors

invisiblethreat avatar martingalloar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.