Skip to main content

A package to convert Python code to Cython for Security and Obfuscation

Project description

🗂️ py2cy

py2cy is a library designed to convert Python source code into Cython format, enabling the transformation of .py files into .so files on Linux and .pyd files on Windows. Additionally, it aids in obfuscating the code, making reverse engineering more challenging.

🏃 Quickstart

Installing the package

pip install py2cy

Arrange the configuration file setup.cfg for your projects

######CYTHON CONFIGURATIONS######
#threads for cythonize in linux
[NThreads]
nThreads=4

#path of the folder to be obfuscated
[SourcePath]
pkg_for_obfuscation=<<path of the project to be obfuscated>>

#files to be excluded from cythonization, comma separated values, must have file extension
[FilesToExclude]
files_to_exclude=abc.py,bde.py

#comma separated values
[PkgsToExclude]
pkgs_to_exclude=package1,package2

#If this is set, both exclude conditions metioned above will be ignored,#comma separated values
[FilesToInclude]
files_to_include=test1.py,test2.py

#If this is set, both exclude conditions above will be ignored,#comma separated values
[PkgsToInclude]
pkgs_to_include=
###############################

▶️ Execute

After the above configuration invoke py2cy in the command line interface as below

py2cy <<path of the setup.cfg>>

or

py2cy #invoke from the current working directory where setup.cfg is present

Once the execution gets completed, a package with same name suffixed with _cython gets generated next to the actual source code.

Based on the configuration set in setup.cfg, respective files are cythonized.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py2cy-0.0.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py2cy-0.0.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file py2cy-0.0.1.tar.gz.

File metadata

  • Download URL: py2cy-0.0.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for py2cy-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a1c221d77302b6a1108505d9fd95e76a0160812888d57bc25ca4f74934743fce
MD5 64ad48c1cd5f1e3b3c9259b7d6e05ed7
BLAKE2b-256 8e47975953e2272b84157ab21e3b1288836ebabac8a956827e90a796d014fba5

See more details on using hashes here.

File details

Details for the file py2cy-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: py2cy-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for py2cy-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 88dc5b8020b18d88e4afb17c144271484953da90911b9422ba551f481bee1ef3
MD5 7a127248c3fc69b61adfda16a8539829
BLAKE2b-256 24f5d2c34c663070373fa73c1d759f0b7d9da273cae8f1a3fe83fc46bf6ec782

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page