Skip to content

Full Migration pysap from Python 2.7 to Python 3#84

Draft
vah13 wants to merge 1 commit intoOWASP:masterfrom
redrays-io:master
Draft

Full Migration pysap from Python 2.7 to Python 3#84
vah13 wants to merge 1 commit intoOWASP:masterfrom
redrays-io:master

Conversation

@vah13
Copy link
Copy Markdown
Contributor

@vah13 vah13 commented Mar 26, 2026

Full migration of the pysap library to Python 3 with support for Python 3.9 through 3.12 on Linux, macOS and Windows.

Core changes:

  • Replaced deprecated Python 2 imports (cStringIO, SocketServer, Queue)
  • Ported the pysapcompress C extension to the Python 3 module API
  • Fixed string vs bytes handling across all SAP protocol modules
  • Updated the cryptographic routines for proper bytes operations
  • Resolved scapy 2.7 compatibility issues with duplicate field names

Infrastructure:

  • Modernized the CI/CD pipeline to test against Python 3.9-3.12
  • Updated all dependency versions for Python 3 compatibility
  • Adapted the full test suite to work with Python 3 semantics

Copy link
Copy Markdown
Collaborator

@codeHorse87 codeHorse87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @vah13 thanks a lot for the PR which looks very promissing. I'm currently quite occupied to conduct a comprehensive review, as well as I'm missing some permission on the repo atm.
I'm not sure if @martingalloar meanwhile can support with the code review meanwhile? I'll do my very best to create a test setup and check with a SAP testing environment.

@vah13
Copy link
Copy Markdown
Contributor Author

vah13 commented Mar 26, 2026

Hello, I can share with you the demo environment of SAP S4 2025 for testing.

@kloris
Copy link
Copy Markdown

kloris commented Mar 26, 2026

@vah13, thanks! Currently totally occupied but when there is some time later I will definitely test with it. Long awaited this thing so thanks for doing this

@JonathanStross
Copy link
Copy Markdown

@codeHorse87 - connect on this? Maybe I can support

@codeHorse87
Copy link
Copy Markdown
Collaborator

Hello, I can share with you the demo environment of SAP S4 2025 for testing.

Hi @vah13 thanks for offering. It's not about an SAP system as such but configuring the different test scenarios such as HANA SAML Auth and similar. However, it seems @default-eshu executed full testing and code review including the dependencies already.
@default-eshu can you confirm this?

@codeHorse87
Copy link
Copy Markdown
Collaborator

@codeHorse87 - connect on this? Maybe I can support

Hi @JonathanStross ,
Thanks for offering! It would be great if we can split the efforts starting with the existing example scripts. I'm going to start with the message server scripts ms_*

@vah13 vah13 force-pushed the master branch 3 times, most recently from d36f33f to 4a10a7d Compare March 30, 2026 14:57
Copy link
Copy Markdown
Collaborator

@codeHorse87 codeHorse87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version fixing for dependencies updated on request and confirmed.
build and test script verified and tested successfully.
smaller changes reviewed

Full migration of the pysap library to Python 3 with support for Python 3.9 through 3.12 on Linux, macOS and Windows.

Core changes:
- Replaced deprecated Python 2 imports (cStringIO, SocketServer, Queue)
- Ported the pysapcompress C extension to the Python 3 module API
- Fixed string vs bytes handling across all SAP protocol modules
- Updated the cryptographic routines for proper bytes operations
- Resolved scapy 2.7 compatibility issues with duplicate field names

Infrastructure:
- Modernized the CI/CD pipeline to test against Python 3.9-3.12
- Updated all dependency versions for Python 3 compatibility
- Adapted the full test suite to work with Python 3 semantics
@martingalloar
Copy link
Copy Markdown
Collaborator

It's great to see so many traction this big effort! First of all, thank you very @vah13 for the big code push!

Since this is going to require some testing, to make sure at the very least the major use cases doesn't break, it's going to require some testing. We cannot expect that we'll get the 100% of the use cases, example scripts and protocols working on the first pass, but we should strive to get it closer to there.

I initially started a GitHub project to track that, but since the way the repository is hosted as part of the OWASP organization, it's only visible to certain users with access to that repo, and cannot be made public. I'd suggest we build some sort of quick testing table to document the effort, we can use a Wiki or just this tracking ticket.

We can also use the #pysap channel in Discord to coordinate any effort.

@codeHorse87
Copy link
Copy Markdown
Collaborator

Quick update
I'm done with the code review and testing part of the smaller changes. Looks good so far.
What takes more time is class PKCS12_PBKDF1 and the C++ pysapcompress to have them fully understood.
I'm planning to prepare additional test setups tomorrow for initial test of all example scripts and have the review completed during eastern.

Copy link
Copy Markdown
Collaborator

@codeHorse87 codeHorse87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all good. I filed #85 to address some issues with the user guide. Other open tasks are the setup of a new github workflow for build and test.
Local build and test and initial but not comprehensive functional testing don't issue any new findings yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

6 participants