Support Platforms

The core of PyArmor is written by C, the prebuilt dynamic librariesinclude the common platforms and some embeded platforms.

Some of them are distributed with PyArmor source package. In these platforms,pyarmor could run without downloading anything:

windows.x86windows.x86_64linux.x86linux.x86_64darwin.x86_64

For the other platforms, when first runpyarmor, it will download thecorresponding dynamic library from the remote server automatically, and save itto~/.pyarmor/platforms/SYSTEM/ARCH/N/,SYSTEM.ARCH is one ofStandardPlatform Names.N isfeatures number, which explained below. Here listall the other supported platforms:

darwin.aarch64ios.aarch64linux.armlinux.armv6linux.armv7linux.aarch32linux.aarch64linux.ppc64android.aarch64android.armv7android.x86android.x86_64uclibc.armv7centos6.x86_64freebsd.x86_64musl.x86_64musl.armmusl.mips32musl.aarch64poky.x86

For Linux platforms, the first identifier stands for libc used in thisplatform.linux stands forglibc,centos6 forglibc < 2.14,android for static libc,musl anduclibc as it is. Note that Dockerbased on Alpine Linux, its identifier ismusl, notlinux.

Super Mode uses the extension modulepytransform directly, and itwill be saved in the path~/.pyarmor/platforms/SYSTEM/ARCH/N/pyXY. Forexample,linux/x86_64/11/py38.

Table-3. The Prebuilt Extensions For Super Mode
NameArchFeaturePython VersionsRemark
darwinx86_641127, 37, 38, 39, 310 
darwinaarch641138, 39, 310Apple Silicon
iosaarch641138, 39 
linuxx86_641127, 37, 38, 39, 310 
linuxx86, aarch64, aarch32, armv71127, 37, 38, 39 
centos6x86_641127Linux with glibc < 2.14 and UCS2
windowsx86_641127, 37, 38, 39, 310 
windowsx8611, 2527, 37, 38, 39 
windowsx86_642527, 37, 38, 39 

In some platforms,pyarmor doesn’t know its standard name, just download theright one and save it in the path~/.pyarmor/platforms/SYSTEM/ARCH/N/. Runthe commandpyarmor-ddownload in this platform, and check the output log,it can help you find where to save the download file.

If you’re not sure this dynamic library is right for this platform, check it byldd to print the dependent system libraries. For example:

ldd/path/to/_pytransform.so

If there is no anyone available and you’d like to runpyarmor in thisplatform, click heresubmit a feature request for new platform

Features

There may be serveral dynamic libraries with different features in eachplatform. The platform name with feature number combines an unique name.

Each feature has its own bit

  • 1: Anti-Debug
  • 2: JIT
  • 4: ADV, advanced mode
  • 8: SUPER, super mode
  • 16: VM, vm protection mode

For example,windows.x86_64.7 means anti-debug(1), JIT(2) and advancedmode(4) supported, its feature number is 7 = 1 + 2 + 4.windows.x86_64.0means no any feature, so highest speed.

ForSuper Mode, there is an extra part to mark Python version. Forexample,windows.x86.11.py37, feature number 11 = 1 + 2 + 8

Note that zero feature dynamic library isn’t compatible with any featuredlibrary. For security reason, the zero feature library uses different alogrithmto obfuscate the scripts. So the platformwindows.x86_64.7 can not share thesame obfuscated scripts with platformlinux.armv7.0.

Note

In Apple M1, dynamic libraris with feature 2JIT will be killed by Pythoninterpreter. Try to resign executable withcom.apple.security.cs.allow-jitentitlement, it may fix the problem. Refer to

https://developer.apple.com/documentation/security/hardened_runtime

Standard Platform Names

These names are used in the commandobfuscate,build,runtime,download to specify platform.

  • windows.x86
  • windows.x86_64
  • linux.x86
  • linux.x86_64
  • darwin.x86_64
  • vs2015.x86
  • vs2015.x86_64
  • linux.arm
  • linux.armv6
  • linux.armv7
  • linux.aarch32
  • linux.aarch64
  • android.aarch64
  • android.armv7
  • android.x86
  • android.x86_64
  • uclibc.armv7
  • linux.ppc64
  • darwin.arm64
  • freebsd.x86_64
  • musl.x86_64
  • musl.arm
  • musl.mips32
  • linux.mips64
  • linux.mips64el
  • poky.x86

If not sure which platform it is, download this helper scriptget_platform_name.pyand run it in the target machine:

pythonget_platform_name.py

Note

New platforms in different versions

  • v5.9.3: android.armv7
  • v5.9.4: uclibc.armv7
  • v6.3.1: musl.x86_64, musl.arm, musl.mips32, linux.mips64, linux.mips64el
  • v6.6.1: android.x86, android.x86_64

Downloading Dynamic Library By Manual

If the machine is not connected to internet, use commanddownload to thecorresponding dynamic libraries in other machine, then copy them in the rightlocation. By default all the download files are stored in the~/.pyarmor/platforms, copy the whole folder to target machine.

Important

The following way only work before v6.7.0. Since v6.7.0, the trial versioncould not download the latest version.

First make sure there is platform index fileplatforms/index.json. If not,run anypyarmor command in target machine, it raises exception. For example:

pyarmor.pyo--advanced2foo.pyINFOPyArmorVersion6.4.2INFOTargetplatforms:NativeINFOGettingremotefile:https://github.com/dashingsoft/pyarmor-core/raw/r34.8/platforms/index.jsonINFOCouldnotgetfilefromhttps://github.com/dashingsoft/pyarmor-core/raw/r34.8/platforms:<urlopenerrortimedout>INFOGettingremotefile:https://pyarmor.dashingsoft.com/downloads/r34.8/index.jsonINFOCouldnotgetfilefromhttps://pyarmor.dashingsoft.com/downloads/r34.8:<urlopenerrortimedout>ERRORNoplatformlistfile/data/user/.pyarmor/platforms/index.jsonfound

There are 2 available urls in the log message, download one of them from othermachine, for example:

https://pyarmor.dashingsoft.com/downloads/r34.8/index.json

And copy it to the prompt path in target machine:

/data/user/.pyarmor/platforms/index.json

Next runpyarmor command in target machine again, this time it will prompt thedownload file and target path. For example:

pyarmoro--advanced2foo.py...INFOUsecapsule:/root/.pyarmor/.pyarmor_capsule.zipINFOOutputpathis:/root/supervisor/distINFOTagetplatforms:[]INFOUpdatetargetplatformsto:[u'linux.x86_64.11.py27']INFOGeneratingsuperruntimelibrarytodistINFOSearchlibraryforplatform:linux.x86_64.11.py27INFOFoundavailablelibraries:[u'linux.x86_64.11.py27']INFOTargetpathforlinux.x86_64.11.py27:/home/jondy/.pyarmor/platforms/linux/x86_64/11/py27INFODownloadinglibraryfileforlinux.x86_64.11.py27...INFOGettingremotefile:https://github.com/dashingsoft/pyarmor-core/raw/r34.8/platforms/linux.x86_64.11.py27/pytransform.soINFOCouldnotgetfilefromhttps://github.com/dashingsoft/pyarmor-core/raw/r34.8/platforms:<urlopenerror[Errno111]Connectionrefused>INFOGettingremotefile:https://pyarmor.dashingsoft.com/downloads/r34.8/linux.x86_64.11.py27/pytransform.soINFOCouldnotgetfilefromhttps://pyarmor.dashingsoft.com/downloads/r34.8:<urlopenerror[Errno111]Connectionrefused>ERRORDownloadlibraryfilefailed

Download it as before, for example

https://github.com/dashingsoft/pyarmor-core/raw/r34.8/platforms/linux.x86_64.11.py27/pytransform.so

And copy it to the path in the lineINFOTargetpath. Here it is:

/home/jondy/.pyarmor/platforms/linux/x86_64/11/py27

Before PyArmor 6.5.5, no target path line. Save it to~/.pyarmor/platforms/plus platform path. For example, the target path of platformlinux.x86_64.11.py27 is~/.pyarmor/platforms/linux/x86_64/11/py27.

All the available dynamic libraries are stored in the repospyarmor-core

https://github.com/dashingsoft/pyarmor-core

Each pyarmor version has the corresponding tag, for example, PyArmor 6.4.2 ->tag “r34.8”. Switch this tag and download fiels fromplatforms.