You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

py2cy

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

py2cy

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

0.0.1
pipPyPI
Maintainers
1

🗂️ 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.

Keywords

cython

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts