From 7b85542aeabf302bd02cde99bc2dca5e076e3b79 Mon Sep 17 00:00:00 2001 From: Jondy Zhao Date: Fri, 19 Jul 2019 09:59:53 +0800 Subject: [PATCH] Add verify code for advanced mode --- tests/advanced_mode/README.md | 32 ++++ tests/advanced_mode/foo-26.py | 3 + tests/advanced_mode/foo-27.py | 3 + tests/advanced_mode/foo-30.py | 3 + tests/advanced_mode/foo-31.py | 3 + tests/advanced_mode/foo-32.py | 3 + tests/advanced_mode/foo-33.py | 3 + tests/advanced_mode/foo-34.py | 3 + tests/advanced_mode/foo-35.py | 3 + tests/advanced_mode/foo-36.py | 3 + tests/advanced_mode/foo-37.py | 3 + tests/advanced_mode/foo.py | 5 + tests/advanced_mode/license.lic | 1 + tests/advanced_mode/pytransform.key | Bin 0 -> 476 bytes tests/advanced_mode/pytransform.py | 279 ++++++++++++++++++++++++++++ 15 files changed, 347 insertions(+) create mode 100644 tests/advanced_mode/README.md create mode 100644 tests/advanced_mode/foo-26.py create mode 100644 tests/advanced_mode/foo-27.py create mode 100644 tests/advanced_mode/foo-30.py create mode 100644 tests/advanced_mode/foo-31.py create mode 100644 tests/advanced_mode/foo-32.py create mode 100644 tests/advanced_mode/foo-33.py create mode 100644 tests/advanced_mode/foo-34.py create mode 100644 tests/advanced_mode/foo-35.py create mode 100644 tests/advanced_mode/foo-36.py create mode 100644 tests/advanced_mode/foo-37.py create mode 100644 tests/advanced_mode/foo.py create mode 100644 tests/advanced_mode/license.lic create mode 100644 tests/advanced_mode/pytransform.key create mode 100644 tests/advanced_mode/pytransform.py diff --git a/tests/advanced_mode/README.md b/tests/advanced_mode/README.md new file mode 100644 index 0000000..f433015 --- /dev/null +++ b/tests/advanced_mode/README.md @@ -0,0 +1,32 @@ +# Advanced Mode + +How to verify that Python interpreter works in advanced mode? + +Assume Python version is 2.7, and run in linux_x86_64 platform. + +If Python version is not 2.7, please download `foo-XY.py` as the corresponding Python version other than `foo-27.py`. + +1.Download the following files + + https://github.com/dashingsoft/pyarmor-core/tree/v5.3.0/tests/advanced_mode/foo-27.py + https://github.com/dashingsoft/pyarmor-core/tree/v5.3.0/tests/advanced_mode/pytransform.py + https://github.com/dashingsoft/pyarmor-core/tree/v5.3.0/tests/advanced_mode/pytransform.key + https://github.com/dashingsoft/pyarmor-core/tree/v5.3.0/tests/advanced_mode/license.lic + +2.Download the corresponding dynamic library by platform:: + + https://github.com/dashingsoft/pyarmor-core/tree/v5.3.0/tests/platforms/linux_x86_64/_pytransform.so + +Here are all available platforms + + https://github.com/dashingsoft/pyarmor-core/tree/v5.3.0/tests/platforms + +3.Run test scripts:: + + python foo-27.py + +In Windows, if it reports this error:: + + [Error 5] Access is denied + +It could be solved by granting the executable permission to the dynamic library `_pytransform.dll`. diff --git a/tests/advanced_mode/foo-26.py b/tests/advanced_mode/foo-26.py new file mode 100644 index 0000000..81e2ef2 --- /dev/null +++ b/tests/advanced_mode/foo-26.py @@ -0,0 +1,3 @@ +from pytransform import pyarmor_runtime +pyarmor_runtime() +__pyarmor__(__name__, __file__, b'\x50\x59\x41\x52\x4d\x4f\x52\x00\x00\x02\x06\x00\xd1\xf2\x0d\x0a\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x40\x00\x00\x00\xb6\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x62\x98\x8f\x64\x26\x21\xb5\x01\x36\xd8\x2e\xb8\xfd\xb7\xfa\xda\x54\x56\x88\x5b\x4d\x48\x7d\x22\x64\x2b\x66\xff\x5c\xf2\xc8\x69\x8d\x63\x26\x47\x4b\x23\xc0\x94\x29\x8f\x1d\xa9\x35\xd8\x5d\x82\x6d\xf1\xe2\x6c\x6f\x2c\xba\x31\xd6\xa7\xe6\x3a\xda\xa1\xd6\xa2\x99\xbe\x91\x16\x8d\x80\x67\x21\x29\xc2\x8f\xc9\x3d\xe3\xb0\x24\x0c\xda\xec\xec\x01\x0d\x9b\x61\x0f\xf5\x1d\x92\xb0\x21\x9c\x37\xa9\x07\x6e\xbb\x16\x5f\xfe\x46\x0e\xc1\x17\x2e\xca\x44\x47\xd3\x79\x03\x7e\xfc\x9e\x51\xf6\x0f\x3b\x84\x45\xea\xfe\x46\x28\xc0\xaf\x18\x24\x8b\xa9\xc4\x2c\xd5\x59\xb3\x89\x98\x1b\x22\x17\x46\x5d\x56\xa5\x6e\x44\x32\x2d\x10\x13\xed\xbd\xa1\xd8\xe3\x3b\xdf\xd4\x31\xed\x86\x9d\x38\x03\x7d\x11\x7b\x70\x93\x4c\x21\x21\xb2\x64\x92\x28\xbc\xbf\x47\xa7\xa4\x80\x62\x27\x05\x15\xef\xbc\xf3\x06\x7c\x80\x7d\x1b\x54\x70\x37\x20\x70\x1c\x0b\x0c\xc3\x0b\xab\x25\xc9\x6c\x73\x47\x03\xb1\xd4\x9c\xd0\x4a\xfc\xd0\x72\x53\xb5\xe9\x07\xce\xf1\x46\x25\xe2\xae\x56\x01\xb0\xf9\x57\xae\x26\x6d\x0a\x5e\xdd\xc1\x02\x97\x23\x93\x89\x70\xb7\x79\xb9\x37\x40\xc7\x7d\x71\x1e\x4f\x4d\xd7\xa6\x6b\x8f\x60\xd2\xbc\xfb\xc1\x23\xf4\xe6\xd7\x16\x70\x9b\x73\xcc\x86\xee\x4f\x70\x02\xf1\xab\x95\x0f\xb3\x33\x7d\xac\xf8\xb3\x86\x25\xd8\x20\xe3\xb7\x0f\x03\x1b\xb0\xbe\x6b\x9d\x94\xa8\x1a\x61\x35\xcd\x56\x25\xd4\x8f\x67\x57\x36\x61\x0d\x8a\x0d\xca\xa1\xdd\xd8\x98\xe1\x3a\x4a\xb2\x95\x4f\xd8\x93\xaa\x61\x03\x33\xf4\x4e\x93\x95\x11\x5d\x79\x75\xfc\x09\x62\x91\xa0\x8e\x40\x31\x9c\x8d\xf5\x35\xad\x73\x16\xf2\xb8\xe8\x49\x79\x89\xa8\x54\x1e\x4a\x5a\xaf\x2e\xd5\x7a\x5c\x74\x58\x1a\x1a\x86\x8b\xfc\x0b\xef\xdc\xe3\xa8\x24\x3c\x0a\xba\x64\x16\x73\x8e\x03\x98\xf7\x39\xcd\xe7\x49\x81\x80\x65\x42\x41\xa4\x71\xf1\x53\xa4\x91\xc3\x1c\x6e\x8c\xd9\xaf\x42\xd8\x9f\x68\x86\x52\xd3\xa1\xe8\x54\x3e\x9d\x88\xd2', 1) \ No newline at end of file diff --git a/tests/advanced_mode/foo-27.py b/tests/advanced_mode/foo-27.py new file mode 100644 index 0000000..ab12de6 --- /dev/null +++ b/tests/advanced_mode/foo-27.py @@ -0,0 +1,3 @@ +from pytransform import pyarmor_runtime +pyarmor_runtime() +__pyarmor__(__name__, __file__, b'\x50\x59\x41\x52\x4d\x4f\x52\x00\x00\x02\x07\x00\x03\xf3\x0d\x0a\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x40\x00\x00\x00\xb4\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x62\x98\x8f\x64\x26\x21\xb5\x01\x36\xd8\x2e\xb8\xfd\xb7\xfa\xda\x54\x56\x88\x5b\x4d\x48\x7d\x24\xbc\xdf\x87\x28\x3f\x51\x8b\x38\xa5\xa5\xc1\x20\x30\x1a\xa1\x18\xf4\xb2\x74\xe0\x22\x6c\xa4\x9f\x20\x59\x53\x28\x96\x89\xcd\x11\x96\xc7\xcd\x03\x1b\xbb\x90\x0c\xbe\x01\xd8\xcb\x42\xc8\x80\x8e\x4e\x37\x8b\x38\xd6\x7a\xaf\x2d\x7c\x4a\xbb\xb0\x59\xff\x2b\xbc\x86\x1c\x26\xc1\xad\xf8\x32\x36\x68\x29\xff\xd9\x47\x74\x03\xe3\x58\x61\xdf\xa6\x94\xb1\x01\xec\xff\x78\x1c\x24\xc2\x63\x85\x59\xcd\xd7\xa2\xa6\xb6\x45\xeb\x32\xd6\x06\x48\x17\xe0\x84\x33\xe0\x00\xf5\x61\x69\x76\xe1\xf2\xfe\xdc\xed\x21\xdc\x10\x78\x59\xdc\xd7\xb3\x58\x35\x91\x8b\x1d\xe2\x75\x03\x4e\x85\xa3\x58\xd6\x3d\x59\x04\xdb\x86\xc1\x55\xc8\xb7\x14\xfd\xdd\xed\xfb\x03\xbe\xeb\x2b\xbd\xbc\x15\xff\xa9\x87\x1c\x2c\xd0\x8a\x5c\x99\x84\xf3\xcd\xb9\x51\x3e\x1d\x8f\x7b\x82\x87\xcb\x52\x7d\x3c\xc8\xd0\x07\x94\x94\x15\x2b\xe6\x12\x00\xaa\xcc\x18\xbd\xe6\x15\x31\x39\x01\xb4\x18\xb6\xd1\x41\x63\x30\x21\x77\x07\x42\xa1\x4a\x11\xd6\x31\x90\x62\x79\x13\x4d\xf7\xba\xf2\x01\x76\xf7\x5f\x21\x45\x87\xe6\xa5\xf5\x13\x52\x04\xc8\x1c\xab\x1a\x2f\x79\x5c\xcf\x2b\x91\x6b\x55\x3e\x1d\xa6\xef\x1b\x4e\x36\xed\xfb\x50\x1a\x6c\x51\x54\x02\xf2\xfe\xc4\xc4\x29\x53\xa1\xf2\x69\xd1\x9e\x1d\xa6\x80\xf8\x6c\x4c\x7e\x81\x99\x08\xe1\x5a\x5d\x24\x00\xa1\x6a\x53\x99\x9d\xe7\x80\x60\xc8\xee\xb7\x5d\xf2\xd8\x49\xdb\xba\xac\xb0\x5b\xc6\x6f\x5c\x8e\x14\xc1\xf1\x66\xf8\xea\xc8\xea\x5e\xfd\xb0\x6b\x5a\x49\xc9\x28\x45\xcb\x5c\x50\xec\xb7\xf9\x83\xa8\xd2\xdd\xb5\x09\xf9\x90\x23\xb9\xf1\xba\x57\x4b\xdb\x99\xe3\x15\xca\x82\x84\x13\x00\x53\xe7\x9b\x13\xd7\x6a\x59\x81\x8c\xbf\xb4\xa1\xde\x3e\x71\x4b\xd0\xbd\xe0\xae\xda\x24\x78\xaf\x8b\x0a\xd6\x88\x78\x27\x1d\x39\x34\x6f\xe3\x3b\xad\x00\x27\x1d\xc9\x0a\x9b\xfd\xfb', 1) \ No newline at end of file diff --git a/tests/advanced_mode/foo-30.py b/tests/advanced_mode/foo-30.py new file mode 100644 index 0000000..e08c3f2 --- /dev/null +++ b/tests/advanced_mode/foo-30.py @@ -0,0 +1,3 @@ +from pytransform import pyarmor_runtime +pyarmor_runtime() +__pyarmor__(__name__, __file__, b'\x50\x59\x41\x52\x4d\x4f\x52\x00\x00\x03\x00\x00\x3b\x0c\x0d\x0a\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x40\x00\x00\x00\xce\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x62\x98\x8f\x64\x26\x21\xb5\x01\x36\xd8\x2e\xb8\xfd\xb7\xfc\xdc\x79\xb3\x16\xb7\xcf\x90\x1b\x67\x7f\xd5\xde\x83\x5d\xda\xcb\x89\xd8\x03\xfe\x33\xbc\xe7\xf2\x4b\x31\x80\x13\x95\x3d\x6a\xaa\xb4\x14\x6b\xe9\xbb\x36\x27\x17\xd3\x86\x78\xf8\x38\x7d\x33\xc7\x58\x8b\x13\x16\x9b\x16\x00\xa4\xfd\x9c\x09\x22\x0a\x56\x19\xec\x25\xfa\xda\xc5\xdf\x31\x4e\xbb\x1d\xd6\xa6\xaa\xc6\x23\x53\x68\x79\x6a\x90\xb0\x19\x4f\xd7\xe5\x82\x37\xe7\x77\xb8\x98\x12\xec\x11\x82\x32\x21\xad\xc9\xf6\x0b\x89\x65\xdc\x16\x79\xc7\xb5\xb8\xe9\x1f\x84\x98\xd7\x71\x5f\xe2\x35\x89\xc3\x85\x78\x50\x6f\x0c\xcb\xd4\x8c\x0d\x30\x79\xba\x5b\x83\xe0\x04\x0f\x25\x3f\xfc\x6b\x76\xae\xf9\x75\x95\x34\xaf\x56\xef\xc0\x85\xaf\x6e\x10\x99\x19\x85\xc8\x70\x34\x8a\x18\x6b\xd8\x13\xd6\xc1\x41\xa7\x00\xe4\x2d\xa0\x63\xd6\x53\xa3\x70\x75\xf0\x2e\x8f\x29\x1f\xda\x54\x21\x7a\xe6\xcd\xad\xb8\xfb\xe0\x61\x0d\x2e\x77\x91\x16\x5e\xc4\xdf\x9b\xb8\xfe\x1c\xd6\x44\x0a\x64\x2b\x69\x40\x4a\xa2\xfb\xc9\x3d\x6b\x91\x2c\x8d\xcd\x94\x59\x00\xb1\x36\xad\x46\xa2\xf7\x1e\x07\x72\x99\xcf\xca\x5b\xe7\xf8\xf8\x6a\x7a\x8a\x4f\x6c\xa6\x45\x71\xd6\x67\x3c\x0c\xe5\x0d\x41\x43\x1a\x64\xad\xf9\xeb\x75\x59\x46\x18\xc1\x56\xc6\x97\x4e\x27\x6c\xf3\xcd\x08\x00\x9c\x97\x6c\xe7\xe9\xe3\xd2\xa4\x7b\xad\x1c\xbf\x49\x51\x34\xcd\x49\x03\xe8\x21\xba\x28\x5d\x87\x3d\x4e\x45\xcf\xd1\x9f\x7b\xb7\x91\xf0\x6d\xa1\xf0\xf8\xba\xd9\xc4\x60\x4a\xe1\xb5\x90\x62\x98\xa9\x62\xab\x30\x54\x35\x78\x38\x07\x9a\x25\x9e\xfb\x54\x26\x15\xe0\xc3\xb2\x68\xd9\x16\x52\x1b\x22\x82\x03\xb8\x78\x19\x7e\x1d\xdf\x0c\xad\xc2\x5f\x15\x73\x7e\x80\x0b\x4a\x8c\x24\xdc\x33\x56\xa8\xb8\xff\x62\x8e\xa8\x0d\x46\xba\x89\x5f\x7c\xe0\x73\xb7\x9d\xf6\xb9\xc6\x1d\x62\x79\xe7\xaa\x39\x6b\x66\xf2\x31\x7a\xdb\x2e\x78\xcd\x78\xeb\x6b\x7f\x9a\x40\x96\xff\x48\x36\x19\x02\xec\xe9\xe5\x04\x67\xe4\x20\x16\xa7\xa3\xed\x6f\xc6\x99\xc8\x6e\xa1\x29\x41\x06\x69\xe9', 1) \ No newline at end of file diff --git a/tests/advanced_mode/foo-31.py b/tests/advanced_mode/foo-31.py new file mode 100644 index 0000000..7889a6e --- /dev/null +++ b/tests/advanced_mode/foo-31.py @@ -0,0 +1,3 @@ +from pytransform import pyarmor_runtime +pyarmor_runtime() +__pyarmor__(__name__, __file__, b'\x50\x59\x41\x52\x4d\x4f\x52\x00\x00\x03\x01\x00\x4f\x0c\x0d\x0a\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x40\x00\x00\x00\xd0\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x62\x98\x8f\x64\x26\x21\xb5\x01\x36\xd8\x2e\xb8\xfd\xb7\xfc\xdc\x79\xb3\x16\xb7\xcf\x90\x1b\x67\x7f\xd5\xde\x81\x5f\xda\xcb\x89\xfe\xbe\x30\xfc\x2f\xfc\xf0\x66\xe6\x71\xd8\x10\xf9\x4b\x7c\x4c\xe6\x0c\xc3\x5e\x6b\x85\xb6\xeb\x92\xda\x28\x90\xa4\x02\xcc\x3e\x24\x57\xf8\x8d\xdc\x27\x1c\x55\xed\xa3\x8e\x05\xa3\xb1\x80\x6c\x63\x08\x9c\x64\x9f\x35\xcf\x8c\x97\xa8\x21\xfc\xf9\xbb\x3e\x9d\xcb\x1e\x2f\x5b\x2d\x70\xfd\xfe\xd4\x97\x3e\x78\x09\x83\x62\x3a\x83\x1e\x2d\xb5\x29\xf8\x44\xad\x71\xb1\x1f\x96\x03\x32\xc1\x99\x62\xc2\x76\x4e\x17\xcc\x78\x9e\x44\x9e\x2f\x63\x6b\x69\xa9\xb4\xca\xc7\xda\x1b\x14\x82\x0c\x29\x17\x85\x2d\x11\xb2\x75\xbc\x86\xb1\x44\xea\x7a\xe7\x33\x47\x17\x38\xfc\x49\xe1\xdc\xd6\x28\xb7\x29\x2f\x39\xf9\x25\x21\x7e\xf2\x9d\x80\x66\x46\x11\x71\x06\xb1\xc2\x62\xc4\x10\x0e\x53\x57\x02\x2c\xf0\x7f\x0d\xfa\xf4\xb0\x56\x42\x5b\xed\x8a\xc2\x70\xc6\x44\x0d\x50\xe6\xf3\x56\x51\x1c\x29\xbe\xc1\xd9\xb5\x0f\x29\x0f\x38\xfd\x91\x7b\x69\xf7\xf5\xec\x62\x9a\x25\x41\x56\x34\xdf\x84\xdf\x6e\x61\xbc\x42\x45\x74\x5f\x93\x4a\xc0\x11\xb5\xf0\x9d\xc5\x22\x30\xb1\x43\xbe\x73\x13\x61\x44\xea\xdd\x32\xbc\x51\x35\xc7\x8c\x7a\xc5\xfc\xfe\x49\xc8\x25\x2d\x9a\x79\xaf\x6d\x74\x19\xef\x60\xfd\x72\x13\x89\x8f\x90\xe4\x1a\x14\x70\xff\x0f\x71\x21\x5e\x10\x79\x28\x86\x8b\xeb\xea\xa5\xe4\xc2\x3f\xae\xfd\x7c\x7a\x5f\x67\x05\x95\x30\x3b\x88\xd6\x9e\x08\x54\x01\xe8\x7f\xee\x1d\xc2\xa3\xbc\x35\x5f\x9a\xa2\x69\xcb\xc6\xc8\x16\x03\xd8\x41\x51\xdc\xe5\xe0\x0b\xad\x52\xc5\x6f\x91\x22\xef\xa1\x8a\x07\x18\xe4\x11\x49\x2f\xc0\x52\xf4\x92\x49\x03\x33\xb6\x17\x1e\xef\x5a\x25\x25\x6b\xfe\x39\x01\x18\xaa\x80\xb1\xa8\x32\xcf\x67\x48\xe6\x32\x29\x43\x6a\x05\xa8\xc1\xf1\x95\xd2\xa4\x73\x9c\xa3\x05\xda\x3b\xb0\x0a\xd1\xf1\x60\x94\x43\x33\x5b\x0d\xb4\x50\x8f\x5a\xcd\xb5\x31\x91\xec\x19\xe8\xa2\xc1\x73\x56\x31\x79\xd2\x97\xcd\x5f\x37\x3d\x12\x37\x68\xff\x27\xbc\x1e\x44\x27', 1) \ No newline at end of file diff --git a/tests/advanced_mode/foo-32.py b/tests/advanced_mode/foo-32.py new file mode 100644 index 0000000..4368a2b --- /dev/null +++ b/tests/advanced_mode/foo-32.py @@ -0,0 +1,3 @@ +from pytransform import pyarmor_runtime +pyarmor_runtime() +__pyarmor__(__name__, __file__, b'\x50\x59\x41\x52\x4d\x4f\x52\x00\x00\x03\x02\x00\x6c\x0c\x0d\x0a\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x40\x00\x00\x00\xd0\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x62\x98\x8f\x64\x26\x21\xb5\x01\x36\xd8\x2e\xb8\xfd\xb7\xfc\xdc\x79\xb3\x16\xb7\xcf\x90\x1b\x67\x7f\xd5\xde\x81\x5f\xda\xcb\x89\xfe\xbe\x30\xfc\x2f\xfc\xf0\x66\xe6\x71\xd8\x10\xf9\x4b\x7c\x4c\xe6\x0c\xc3\x5e\x6b\x85\xb6\xeb\x92\xda\x28\x90\xa4\x02\xcc\x3e\x24\x57\xf8\x8d\xdc\x27\x1c\x55\xed\xa3\x8e\x05\xa3\xb1\x80\x6c\x63\x08\x9c\x64\x9f\x35\xcf\x8c\x97\xa8\x21\xfc\xf9\xbb\x3e\x9d\xcb\x1e\x2f\x5b\x2d\x70\xfd\xfe\xd4\x97\x3e\x78\x09\x83\x62\x3a\x83\x1e\x2d\xb5\x29\xf8\x44\xad\x71\xb1\x1f\x96\x03\x32\xc1\x99\x62\xc2\x76\x4e\x17\xcc\x78\x9e\x44\x9e\x2f\x63\x6b\x69\xa9\xb4\xca\xc7\xda\x1b\x14\x82\x0c\x29\x17\x85\x2d\x11\xb2\x75\xbc\x86\xb1\x44\xea\x7a\xe7\x33\x47\x17\x38\xfc\x49\xe1\xdc\xd6\x28\xb7\x29\x2f\x39\xf9\x25\x21\x7e\xf2\x9d\x80\x66\x46\x11\x71\x06\xb1\xc2\x62\xc4\x10\x0e\x53\x57\x02\x2c\xf0\x7f\x0d\xfa\xf4\xb0\x56\x42\x5b\xed\x8a\xc2\x70\xc6\x44\x0d\x50\xe6\xf3\x56\x51\x1c\x29\xbe\xc1\xd9\xb5\x0f\x29\x0f\x38\xfd\x91\x7b\x69\xf7\xf5\xec\x62\x9a\x25\x41\x56\x34\xdf\x84\xdf\x6e\x61\xbc\x42\x45\x74\x5f\x93\x4a\xc0\x11\xb5\xf0\x9d\xc5\x22\x30\xb1\x43\xbe\x73\x13\x61\x44\xea\xdd\x32\xbc\x51\x35\xc7\x8c\x7a\xc5\xfc\xfe\x49\xc8\x25\x2d\x9a\x79\xaf\x6d\x74\x19\xef\x60\xfd\x72\x13\x89\x8f\x90\xe4\x1a\x14\x70\xff\x0f\x71\x21\x5e\x10\x79\x28\x86\x8b\xeb\xea\xa5\xe4\xc2\x3f\xae\xfd\x7c\x7a\x5f\x67\x05\x95\x30\x3b\x88\xd6\x9e\x08\x54\x01\xe8\x7f\xee\x1d\xc2\xa3\xbc\x35\x5f\x9a\xa2\x69\xcb\xc6\xc8\x16\x03\xd8\x41\x51\xdc\xe5\xe0\x0b\xad\x52\xc5\x6f\x91\x22\xef\xa1\x8a\x07\x18\xe4\x11\x49\x2f\xc0\x52\xf4\x92\x49\x03\x33\xb6\x17\x1e\xef\x5a\x25\x25\x6b\xfe\x39\x01\x18\xaa\x80\xb1\xa8\x32\xcf\x67\x48\xe6\x32\x29\x43\x6a\x05\xa8\xc1\xf1\x95\xd2\xa4\x73\x9c\xa3\x05\xda\x3b\xb0\x0a\xd1\xf1\x60\x94\x43\x33\x5b\x0d\xb4\x50\x8f\x5a\xcd\xb5\x31\x91\xec\x19\xe8\xa2\xc1\x73\x56\x31\x79\xd2\x97\xcd\x5f\x37\x3d\x12\x37\x68\xff\x27\xbc\x1e\x44\x27', 1) \ No newline at end of file diff --git a/tests/advanced_mode/foo-33.py b/tests/advanced_mode/foo-33.py new file mode 100644 index 0000000..2aabc6c --- /dev/null +++ b/tests/advanced_mode/foo-33.py @@ -0,0 +1,3 @@ +from pytransform import pyarmor_runtime +pyarmor_runtime() +__pyarmor__(__name__, __file__, b'\x50\x59\x41\x52\x4d\x4f\x52\x00\x00\x03\x03\x00\x9e\x0c\x0d\x0a\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x40\x00\x00\x00\xdd\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x62\x98\x8f\x64\x26\x21\xb5\x01\x36\xd8\x2e\xb8\xfd\xb7\xfc\xdc\x79\xb3\x16\xb7\xcf\x90\x1b\x67\x7f\xd5\xde\x84\x5a\xda\xcb\x89\x6d\x1c\x55\xb4\x59\xa4\x98\xf6\x39\x0a\x01\xe3\x0c\x11\xa4\x6d\x02\x6f\x9b\xd0\xa8\x00\xa2\xf9\xde\x71\xb5\x26\xb3\xf7\x72\x87\x25\x28\x0e\x5a\x8e\x90\x29\x2e\x1f\x0e\x2a\x88\x91\x07\x27\x01\xd0\x22\x40\x0f\x6f\xa3\xeb\xc8\x43\xa1\x9f\x99\x1e\xcf\xc1\x79\x85\xfe\xe0\x64\xd2\xf3\x77\x62\xcd\x65\x90\x89\x28\x63\x60\x6c\xd3\x53\xae\x9f\x26\x98\xdd\x50\x01\xc2\x09\xb2\x55\x5a\x9f\x13\xcc\x63\x5a\xbf\xdf\x70\x34\x68\x0a\x3c\x05\x13\x6c\x62\x65\x29\xb6\x8d\xe0\x66\xf2\x01\xe1\xf6\x1f\xd6\x32\x6b\x3b\x64\x97\xad\x4d\x6d\x2d\xc9\x16\xf0\x84\x84\x60\x6e\x7d\xb8\xc3\x58\x5d\x0c\x4d\xc2\x79\xf5\x25\x6a\x54\x89\x88\x6f\xa3\xa4\x98\xf0\xdc\xbf\xc1\x21\xfa\x86\xe1\x11\xe5\x60\x54\xf3\xf4\x45\xae\xd0\xe9\x89\x6f\xfc\xf8\x50\x19\x46\x77\x6a\x11\x9a\x9d\x93\xab\xf8\xed\x84\xbb\x8e\x84\x4e\xb8\xf8\x5a\x25\xa2\x7a\xfb\x39\xa9\x53\xe6\xd6\x99\x61\x2d\x3d\xc5\x77\x2a\x3d\xd0\x3b\xd7\xa4\x65\xf9\xd1\x46\xd7\x80\x8f\x30\x8e\x4f\x6a\x38\xb9\xb0\x2a\xff\x37\x5c\x1c\x09\xd8\xf7\xca\x7e\x6a\x02\xb0\x2b\x7b\x2c\xe0\x6b\x8a\x49\xcb\x27\xac\x17\xbd\xe9\x0a\x76\x8e\xea\x43\x04\x73\x3c\xdb\x63\xaa\x92\xb4\x8a\xa5\x4a\x48\xeb\x97\xc6\x92\xed\x05\xd9\xbc\x60\x69\x0b\x8b\x3f\x30\x03\x8d\x27\xb8\xfe\x63\xc2\x49\x6c\xe0\xf6\x60\x5d\x87\x37\xd2\xf7\x2b\x04\xd8\xc8\x9a\x21\xd8\x1d\x7b\xfe\x8d\xa5\xa3\xc3\x69\xaa\x50\x50\x5d\x71\x9c\xdc\x64\x5f\x60\x7b\x89\x73\xc1\xe3\x3e\x80\x71\xfd\x6b\xf2\x6b\xde\x07\xcb\xf7\x8d\x91\x28\x74\x2f\xc7\x7a\x71\xf0\xee\x6b\x4f\xd3\xbb\x9d\x93\x62\x85\x0b\x03\xc6\x5b\x1f\x51\xbf\x95\x3f\xa9\xa5\xf5\x16\xdc\x14\xd6\x44\xd7\x66\xe8\x87\xff\xd9\x20\x8d\x60\xd6\x80\xc7\x3b\x88\x14\x90\x1d\x3d\x26\x3f\x40\xa0\x26\x01\x77\x35\xfb\x88\x2f\x8b\x64\x04\xda\x3a\x94\x89\xe8\xda\x08\x01\xba\x5e\xa1\x3b\x1f\xeb\x18\xf1\xf2\x98\xea\xda\xf1\xa7\xf9\xdd\xdf\x85\x8f\xc8\x62', 1) \ No newline at end of file diff --git a/tests/advanced_mode/foo-34.py b/tests/advanced_mode/foo-34.py new file mode 100644 index 0000000..cdc4510 --- /dev/null +++ b/tests/advanced_mode/foo-34.py @@ -0,0 +1,3 @@ +from pytransform import pyarmor_runtime +pyarmor_runtime() +__pyarmor__(__name__, __file__, b'\x50\x59\x41\x52\x4d\x4f\x52\x00\x00\x03\x04\x00\xee\x0c\x0d\x0a\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x40\x00\x00\x00\x8e\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe3\x19\x6c\x87\x26\x42\xd6\x01\xd6\xd8\x8a\x18\x11\x3f\x44\xc7\x6e\x8b\x21\x2b\x4c\x95\x08\x3f\xed\x7f\xf7\x0f\x3e\xd7\xa4\x25\xbd\xd7\x30\xaa\x5c\xcb\x8e\xb4\x67\x28\xfa\x82\xc0\x3a\x21\xc1\x98\xdf\xcb\xd7\x88\x23\x62\x4b\xd6\x72\xfd\x9f\xd0\x01\xf8\x6a\x5d\xa6\xee\x65\xba\x75\x20\xfe\x53\xf7\xa7\xd5\x8d\x27\x6f\x67\x62\x3f\xc2\x97\x97\x12\xc8\xa7\xbb\xf5\x20\xa9\xb1\x1e\xbd\x1b\xb0\x73\xa2\xe6\x79\x98\xa8\xdd\x98\xd9\x72\xd5\xc8\x5a\xe5\xb3\x5d\x22\xec\x25\x15\xdd\x2b\xad\x80\x76\x3c\x0f\xd7\x7b\x17\x25\xf8\x57\x4d\x7f\x06\x1a\x8c\xb3\x20\xbb\xa5\x2d\x04\xb6\x3d\x9c\x60\x41\xe2\x11\x74\xef\xe9\xaf\xe2\xff\xf0\x0e\xcd\xea\xdf\xd8\xf5\xe1\xca\xd1\xb3\x72\x4b\x7b\xda\xdb\x95\x9e\x04\x17\xbe\xb6\x36\x02\xc3\x7d\xd6\x25\x44\x82\x06\x8c\x64\x9a\xab\x0d\x5e\x0c\xfb\xe1\x7f\xc5\xc0\x37\xb5\xe2\x78\xba\x72\x6d\x75\x26\x71\x5e\x7a\xac\x09\x74\x3a\x58\x37\x61\x06\x72\x81\x2f\xbf\xdc\xef\xae\x74\xf0\xe0\x8e\x50\x1c\x76\x53\xe3\x43\x7d\xf0\xab\x84\xb4\x85\x87\x29\xac\xbd\x4d\xde\x42\x02\xc1\xa2\x5f\xe1\x08\xbf\x93\x63\x6f\x5f\xe0\xb3\xf5\x17\x3a\xba\x0e\x23\xac\xe3\x8a\x7b\x0d\x98\x1f\xe3\x33\xc3\x63\x05\xe1\x7b\x91\xbc\x7c\x10\x02\x0a\x06\x11\x67\x2e\xcd\x4d\xae\xad\xfb\x29\x16\x03\x8b\x82\xae\x38\x18\x01\xb3\x4c\xa8\x4e\x1c\x7c\x7a\xfa\x13\x10\xe4\x14\x2a\x86\x6a\x46\xfd\xfc\xa3\x65\x74\x1f\xcc\xa3\x62\x8e\xa9\xe0\xa4\x29\x37\x4b\x7b\x7e\x75\xef\xd9\xae\xfb\x49\x1a\x4e\x3c\x92\x1f\x75\x1e\xc0\xa7\x76\x6f\xbd\x52\x8e\x89\xd1\x8c\xc2\x95\xc0\xce\x4a\x98\xf7\x4e\x1e\x87\xd8\xe1\xfb\x10\x2b\x07\xd2\x1d\x1f\x2b\xf7\x3c\x6d\x1d\x5e\x23\x00\x10\x48\xfb\xdc\x91\x7a\x7f\xf3\x10\xca', 1) \ No newline at end of file diff --git a/tests/advanced_mode/foo-35.py b/tests/advanced_mode/foo-35.py new file mode 100644 index 0000000..2925ad1 --- /dev/null +++ b/tests/advanced_mode/foo-35.py @@ -0,0 +1,3 @@ +from pytransform import pyarmor_runtime +pyarmor_runtime() +__pyarmor__(__name__, __file__, b'\x50\x59\x41\x52\x4d\x4f\x52\x00\x00\x03\x05\x00\x16\x0d\x0d\x0a\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x40\x00\x00\x00\x8b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe3\x19\x6c\x87\x26\x42\xd6\x01\xd6\xd8\x8a\x18\x11\x3f\x44\xc7\x6e\x8b\x21\x2b\x4c\x95\x08\x3f\xe8\x7a\xf7\x0f\x3e\xd7\xa4\x25\xf9\xdc\x35\xf2\xb3\xb4\xc0\x5e\x4a\x39\x97\xe1\x98\xe0\x0e\x39\x13\x03\xcc\xb3\x44\x2f\xe8\x13\x2a\xad\x9e\x7a\x68\xbc\x7c\xa1\xed\xe7\xde\x23\xc0\xe2\x21\x37\x16\xe1\x9a\x2e\xa9\xaa\xac\xdf\xf7\x17\x30\x27\x34\x93\x1d\xf9\xd6\x94\xe9\xec\x43\x05\x9b\xba\xfc\x04\x1d\xfb\x1e\xd3\xbb\x95\xb4\xe0\xf0\x39\x90\xa1\x06\x54\x97\xba\x4d\x90\xb0\x6f\x0e\xbc\x61\x7b\xa1\x6c\x73\x20\x8b\xb3\x36\xf6\xc6\xa7\xfd\x0a\x30\xd0\xac\x0e\xe3\xce\x1c\x9b\x68\xb7\xb9\xa5\x07\xe6\xed\x98\x11\x16\x73\x30\x2b\xde\xf2\x16\x21\xe1\xd9\x82\x31\x0b\x02\x8b\x99\xe0\x32\x0e\xe1\x37\xa3\xbc\xc6\x20\x84\xbc\xf3\xa7\x57\x82\xb7\xad\x74\xb3\x15\x1b\x16\xa9\x39\x9d\x81\x2f\xa4\x32\xcf\xed\x9e\xa6\xd0\x4b\x67\x30\xa7\x87\x6a\xf6\x0c\x96\xf0\x17\xda\x1c\x38\x8e\x94\xb9\xc7\xd5\xd7\x6c\x39\xa7\xbe\x32\x1f\xc4\xce\x26\x7b\x84\x6e\xd3\x97\xd5\xb5\x22\x1a\x37\xbf\x69\x15\x0e\x19\xc8\x78\xa2\x03\xfc\x6c\xc4\x1f\x1e\x31\xe8\xbb\x1d\xa8\xa4\x15\x8b\xc5\xad\xe5\x53\x85\x5c\xb7\x39\xe9\x0f\x70\x0c\x3e\xcc\x84\x2b\x9f\x1a\x33\xc1\x6b\xe2\x17\x2d\x7f\x2b\x44\xab\xbe\x21\x5f\xf7\xb4\x58\xb4\x4a\xab\xba\xe6\x3f\xea\x64\xb8\x69\x1a\x6b\x5e\x8a\xb6\x0e\x5c\x78\x43\xbb\x68\x35\x30\x3d\x27\x80\xbe\xe6\x55\xe3\xd9\x1e\x81\xbf\x37\xdc\xaa\x1c\x8a\xbe\x40\x7e\x70\x41\xec\x49\xc6\x0e\xeb\x31\x70\x3e\xd5\x02\x07\x01\x1d\xbe\x83\x5d\x90\x59\x1d\x18\x14\xd7\x55\x5d\x54\x5c\xcf\x77\x45\x36\x2d\xc8\x94\x7c\xd3\xd4\x8b\xc8\xe1\x60\xd8\xc2\x0a\x68\x4a\x99\xdd\x9f\x49\x20\xab\x45\xb5\x7e\x2d', 1) \ No newline at end of file diff --git a/tests/advanced_mode/foo-36.py b/tests/advanced_mode/foo-36.py new file mode 100644 index 0000000..96d305e --- /dev/null +++ b/tests/advanced_mode/foo-36.py @@ -0,0 +1,3 @@ +from pytransform import pyarmor_runtime +pyarmor_runtime() +__pyarmor__(__name__, __file__, b'\x50\x59\x41\x52\x4d\x4f\x52\x00\x00\x03\x06\x00\x33\x0d\x0d\x0a\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x40\x00\x00\x00\x80\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe3\x19\x6c\x87\x26\x42\xd6\x01\xd6\xd8\x8a\x18\x11\x3f\x44\xc7\x6e\x8b\x21\x2b\x4c\x95\x08\x3f\x91\x03\xf7\x0f\x3e\xd7\x27\x25\xf8\x34\xef\xf2\xf1\xba\x2c\xd5\x47\x3e\xb6\x1a\x94\xd0\x08\xc2\xca\xcd\x9c\x7c\x77\xd3\x0f\x70\xdf\x50\x8e\x4c\xeb\xc1\x96\x2b\x6e\x3e\xcf\x49\xbb\x79\xb9\x52\x71\xc5\x8a\x88\x90\x3f\x83\xa9\xa4\x44\x96\xaf\x0a\x15\xb7\x07\x3d\x54\x6d\x7e\x13\x98\x0d\x8f\x33\x6a\x08\x8a\xba\x80\x94\xd7\xf1\x28\xf2\x23\xf0\xed\x80\xd9\xbd\xc6\x28\xab\x41\x80\x53\xd4\xe4\xfc\x1d\x43\x22\xc8\xe9\x70\x6a\x1b\x8d\xd3\xfe\x68\xa2\x7c\xc3\x11\xc9\x9e\xc9\xd9\x63\xc5\xe5\x13\x06\x2e\x89\xf1\x60\x5f\xcc\xe4\xb0\x52\x16\x04\x5d\x14\x6b\x85\xa7\xe0\x96\xc7\x51\x5f\x6e\x21\x4d\xbb\x0d\xa6\xab\x73\xe7\xfa\x84\x4d\xde\xb8\x02\x3d\x46\x17\xbd\x54\xd0\x9d\xc6\xbb\x14\x90\x07\x37\x85\x8a\x1a\xff\x80\x5e\xb7\x11\xaf\xe1\xe3\x4c\x8b\xa8\x3b\x1d\xa8\x39\xa3\x87\xde\xf4\xd1\x29\x45\x95\x82\x11\x00\x81\x78\x28\x31\x19\x2f\xaf\x44\xa1\x4a\x95\xff\x09\x94\x3e\xcd\xa7\xac\x6c\xbd\x05\x00\xb9\x99\x66\xa4\x11\x7b\x0c\xb8\x81\x1d\x52\x3c\xe3\xd1\x7a\xd3\x5d\x38\x09\xd4\x17\xda\xd3\x14\x0d\x07\xa2\x61\x7f\x4f\xb7\x21\x3b\xb9\x83\x58\xac\x05\x09\xb9\xe7\xc9\x00\x15\x19\xa0\x43\xff\xc0\xd9\x4f\x9b\x75\x51\x03\x0e\x03\x5f\x68\x9c\x62\x5b\xac\x08\xa2\xd2\x29\x1b\x8c\x6d\x6d\xa3\x06\xdb\x3c\x1f\x12\xb7\xfe\xa8\x2b\x44\xa0\x52\x74\x83\x17\xf6\x57\x08\xf7\x22\x98\x5d\xaf\x6a\x87\xdd\x5b\xe6\x84\x64\x0e\x55\xcf\x50\x37\x66\xe9\x48\x76\x35\x7e\x9b\x46\xb1\x5f\xee\xfb\x73\xe0\x26\x8a\xf7\xa0\x34\x4a\x1f\xf5\xe9\x4a\xfe\x07\xab\x0e\xe1\xff', 1) \ No newline at end of file diff --git a/tests/advanced_mode/foo-37.py b/tests/advanced_mode/foo-37.py new file mode 100644 index 0000000..bb6a052 --- /dev/null +++ b/tests/advanced_mode/foo-37.py @@ -0,0 +1,3 @@ +from pytransform import pyarmor_runtime +pyarmor_runtime() +__pyarmor__(__name__, __file__, b'\x50\x59\x41\x52\x4d\x4f\x52\x00\x00\x03\x07\x00\x41\x0d\x0d\x0a\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x40\x00\x00\x00\x80\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe3\x19\x6c\x87\x26\x42\xd6\x01\xd6\xd8\x8a\x18\x11\x3f\x44\xc7\x6e\x8b\x21\x2b\x4c\x95\x08\x3f\x91\x03\xf7\x0f\x3e\xd7\x27\x25\xf8\x34\xef\xf2\xf1\xba\x2c\xd5\x47\x3e\xb6\x1a\x94\xd0\x08\xc2\xca\xcd\x9c\x7c\x77\xd3\x0f\x70\xdf\x50\x8e\x4c\xeb\xc1\x96\x2b\x6e\x3e\xcf\x49\xbb\x79\xb9\x52\x71\xc5\x8a\x88\x90\x3f\x83\xa9\xa4\x44\x96\xaf\x0a\x15\xb7\x07\x3d\x54\x6d\x7e\x13\x98\x0d\x8f\x33\x6a\x08\x8a\xba\x80\x94\xd7\xf1\x28\xf2\x23\xf0\xed\x80\xd9\xbd\xc6\x28\xab\x41\x80\x53\xd4\xe4\xfc\x1d\x43\x22\xc8\xe9\x70\x6a\x1b\x8d\xd3\xfe\x68\xa2\x7c\xc3\x11\xc9\x9e\xc9\xd9\x63\xc5\xe5\x13\x06\x2e\x89\xf1\x60\x5f\xcc\xe4\xb0\x52\x16\x04\x5d\x14\x6b\x85\xa7\xe0\x96\xc7\x51\x5f\x6e\x21\x4d\xbb\x0d\xa6\xab\x73\xe7\xfa\x84\x4d\xde\xb8\x02\x3d\x46\x17\xbd\x54\xd0\x9d\xc6\xbb\x14\x90\x07\x37\x85\x8a\x1a\xff\x80\x5e\xb7\x11\xaf\xe1\xe3\x4c\x8b\xa8\x3b\x1d\xa8\x39\xa3\x87\xde\xf4\xd1\x29\x45\x95\x82\x11\x00\x81\x78\x28\x31\x19\x2f\xaf\x44\xa1\x4a\x95\xff\x09\x94\x3e\xcd\xa7\xac\x6c\xbd\x05\x00\xb9\x99\x66\xa4\x11\x7b\x0c\xb8\x81\x1d\x52\x3c\xe3\xd1\x7a\xd3\x5d\x38\x09\xd4\x17\xda\xd3\x14\x0d\x07\xa2\x61\x7f\x4f\xb7\x21\x3b\xb9\x83\x58\xac\x05\x09\xb9\xe7\xc9\x00\x15\x19\xa0\x43\xff\xc0\xd9\x4f\x9b\x75\x51\x03\x0e\x03\x5f\x68\x9c\x62\x5b\xac\x08\xa2\xd2\x29\x1b\x8c\x6d\x6d\xa3\x06\xdb\x3c\x1f\x12\xb7\xfe\xa8\x2b\x44\xa0\x52\x74\x83\x17\xf6\x57\x08\xf7\x22\x98\x5d\xaf\x6a\x87\xdd\x5b\xe6\x84\x64\x0e\x55\xcf\x50\x37\x66\xe9\x48\x76\x35\x7e\x9b\x46\xb1\x5f\xee\xfb\x73\xe0\x26\x8a\xf7\xa0\x34\x4a\x1f\xf5\xe9\x4a\xfe\x07\xab\x0e\xe1\xff', 1) \ No newline at end of file diff --git a/tests/advanced_mode/foo.py b/tests/advanced_mode/foo.py new file mode 100644 index 0000000..00ff94d --- /dev/null +++ b/tests/advanced_mode/foo.py @@ -0,0 +1,5 @@ +def hello(): + print("Hello world!") + +if __name__ == '__main__': + hello() diff --git a/tests/advanced_mode/license.lic b/tests/advanced_mode/license.lic new file mode 100644 index 0000000..67c39e6 --- /dev/null +++ b/tests/advanced_mode/license.lic @@ -0,0 +1 @@ +HERhc2hpbmdzb2Z0IFB5c2hpZWxkIFByb2plY3Qlk6W630PQ3fvNMf9LXa2Z/FdwoVCzhcbpqNGCrKemcDxn1XUJRbgIUXywnc/WZrlr4mLks8EOthDV3x4eoFj2UIkEp5dyeOAr+F7unNMNfSis3Gx0IoHvpCe3aGQGvX/aS8tSMMR741qM08fu04U5w91rej7tPRL6UeQH2iY/Ew== \ No newline at end of file diff --git a/tests/advanced_mode/pytransform.key b/tests/advanced_mode/pytransform.key new file mode 100644 index 0000000000000000000000000000000000000000..cb6430c583e3f2dbba84343fd5072428314dd708 GIT binary patch literal 476 zcmV<20VDoE0gM0u00000000000002;2(LG3y=`-&`<13r(pAMVqRlE-^hF+yhOHVW zJ4-Q17E$>sRXRqvD=@o1a5W(#9H^~hfbeKVWHKX#E=8n(!R*4|z()Qvah_uT)%Zlg z2DH~8!v>v_{3i Sd%-P|Zvh@RpUJG1SuyxlBIbqw literal 0 HcmV?d00001 diff --git a/tests/advanced_mode/pytransform.py b/tests/advanced_mode/pytransform.py new file mode 100644 index 0000000..64b9b5c --- /dev/null +++ b/tests/advanced_mode/pytransform.py @@ -0,0 +1,279 @@ +# Because ctypes is new from Python 2.5, so pytransform doesn't work +# before Python 2.5 +# +from ctypes import cdll, c_char, c_char_p, c_int, c_void_p, \ + pythonapi, py_object, PYFUNCTYPE + +import os +import sys +import platform +import struct + +# +# Hardware type +# +HT_HARDDISK, HT_IFMAC, HT_IPV4, HT_IPV6, HT_DOMAIN = range(5) + +# +# Global +# +_pytransform = None +_get_error_msg = None + +class PytransformError(Exception): + pass + +def dllmethod(func): + def wrap(*args, **kwargs): + # args = [(s.encode() if isinstance(s, str) else s) for s in args] + result = func(*args, **kwargs) + if isinstance(result, int) and result != 0: + errmsg = _get_error_msg() + if not isinstance(errmsg, str): + errmsg = errmsg.decode() + raise PytransformError(errmsg) + return result + return wrap + +@dllmethod +def init_pytransform(): + major, minor = sys.version_info[0:2] + # Python2.5 no sys.maxsize but sys.maxint + # bitness = 64 if sys.maxsize > 2**32 else 32 + prototype = PYFUNCTYPE(c_int, c_int, c_int, c_void_p) + init_module = prototype(('init_module', _pytransform)) + return init_module(major, minor, pythonapi._handle) + +@dllmethod +def init_runtime(): + prototype = PYFUNCTYPE(c_int, c_int, c_int, c_int, c_int) + _init_runtime = prototype(('init_runtime', _pytransform)) + return _init_runtime(0, 0, 0, 0) + +@dllmethod +def encrypt_code_object(pubkey, co, flags): + prototype = PYFUNCTYPE(py_object, py_object, py_object, c_int) + dlfunc = prototype(('encrypt_code_object', _pytransform)) + return dlfunc(pubkey, co, flags) + +def generate_capsule(licfile): + prikey, pubkey, prolic = _generate_project_capsule() + capkey, newkey = _generate_pytransform_key(licfile, pubkey) + return prikey, pubkey, capkey, newkey, prolic + +@dllmethod +def _generate_project_capsule(): + prototype = PYFUNCTYPE(py_object) + dlfunc = prototype(('generate_project_capsule', _pytransform)) + return dlfunc() + +@dllmethod +def _generate_pytransform_key(licfile, pubkey): + prototype = PYFUNCTYPE(py_object, c_char_p, py_object) + dlfunc = prototype(('generate_pytransform_key', _pytransform)) + return dlfunc(licfile.encode() if sys.version_info[0] == 3 else licfile, + pubkey) + +@dllmethod +def generate_license_file(filename, priname, rcode, start=-1, count=1): + prototype = PYFUNCTYPE(c_int, c_char_p, c_char_p, c_char_p, c_int, c_int) + dlfunc = prototype(('generate_project_license_files', _pytransform)) + return dlfunc(filename.encode(), priname.encode(), rcode.encode(), + start, count) if sys.version_info[0] == 3 \ + else dlfunc(filename, priname, rcode, start, count) + +@dllmethod +def get_registration_code(): + prototype = PYFUNCTYPE(py_object) + dlfunc = prototype(('get_registration_code', _pytransform)) + return dlfunc() + +def get_expired_days(): + prototype = PYFUNCTYPE(py_object) + dlfunc = prototype(('get_expired_days', _pytransform)) + return dlfunc() + +def get_hd_info(hdtype, size=256): + t_buf = c_char * size + buf = t_buf() + if (_pytransform.get_hd_info(hdtype, buf, size) == -1): + raise PytransformError(_get_error_msg()) + return buf.value.decode() + +def show_hd_info(): + return _pytransform.show_hd_info() + +def get_license_info(): + info = { + 'expired': 'Never', + 'restrict_mode': 'Enabled', + 'HARDDISK': 'Any', + 'IFMAC': 'Any', + 'IFIPV4': 'Any', + 'DOMAIN': 'Any', + 'CODE': '', + } + rcode = get_registration_code().decode() + if rcode is None: + raise PytransformError(_get_error_msg()) + index = 0 + if rcode.startswith('*TIME:'): + from time import ctime + index = rcode.find('\n') + info['expired'] = ctime(float(rcode[6:index])) + index += 1 + + if rcode[index:].startswith('*FLAGS:'): + info['restrict_mode'] = 'Disabled' + index += len('*FLAGS:') + 1 + + prev = None + start = index + for k in ['HARDDISK', 'IFMAC', 'IFIPV4', 'DOMAIN', 'FIXKEY', 'CODE']: + index = rcode.find('*%s:' % k) + if index > -1: + if prev is not None: + info[prev] = rcode[start:index] + prev = k + start = index + len(k) + 2 + info['CODE'] = rcode[start:] + + return info + +def get_license_code(): + return get_license_info()['CODE'] + +def format_platname(platname=None): + if platname is None: + plat = platform.system().lower() + bitness = struct.calcsize('P'.encode()) * 8 + platname = '%s%s' % (plat, bitness) + mach = platform.machine().lower() + return platname if mach in ( + 'intel', 'x86', 'i386', 'i486', 'i586', 'i686', + 'x64', 'x86_64', 'amd64' + ) else os.path.join(platname, mach) + +# Load _pytransform library +def _load_library(path=None, is_runtime=0, platname=None): + path = os.path.dirname(__file__) if path is None \ + else os.path.normpath(path) + + plat = platform.system().lower() + if plat == 'linux': + filename = os.path.abspath(os.path.join(path, '_pytransform.so')) + elif plat == 'darwin': + filename = os.path.join(path, '_pytransform.dylib') + elif plat == 'windows': + filename = os.path.join(path, '_pytransform.dll') + elif plat == 'freebsd': + filename = os.path.join(path, '_pytransform.so') + else: + raise PytransformError('Platform %s not supported' % plat) + + if not os.path.exists(filename): + if is_runtime: + raise PytransformError('Could not find "%s"' % filename) + libpath = os.path.join(path, 'platforms', format_platname(platname)) + filename = os.path.join(libpath, os.path.basename(filename)) + if not os.path.exists(filename): + raise PytransformError('Could not find "%s"' % filename) + + try: + m = cdll.LoadLibrary(filename) + except Exception as e: + raise PytransformError('Load %s failed:\n%s' % (filename, e)) + + # Removed from v4.6.1 + # if plat == 'linux': + # m.set_option(-1, find_library('c').encode()) + + if not os.path.abspath('.') == os.path.abspath(path): + m.set_option(1, path.encode() if sys.version_info[0] == 3 else path) + + # Required from Python3.6 + m.set_option(2, sys.byteorder.encode()) + + if sys.flags.debug: + m.set_option(3, c_char_p(1)) + m.set_option(4, c_char_p(not is_runtime)) + + # Disable advanced mode if required + # m.set_option(5, c_char_p(1)) + + return m + +def pyarmor_init(path=None, is_runtime=0, platname=None): + global _pytransform + global _get_error_msg + _pytransform = _load_library(path, is_runtime, platname) + _get_error_msg = _pytransform.get_error_msg + _get_error_msg.restype = c_char_p + return init_pytransform() + +def pyarmor_runtime(path=None): + try: + if pyarmor_init(path, is_runtime=1) == 0: + init_runtime() + except PytransformError as e: + print(e) + sys.exit(1) + +# +# Deprecated functions from v5.1 +# +@dllmethod +def encrypt_project_files(proname, filelist, mode=0): + prototype = PYFUNCTYPE(c_int, c_char_p, py_object, c_int) + dlfunc = prototype(('encrypt_project_files', _pytransform)) + return dlfunc(proname.encode(), filelist, mode) + +def generate_project_capsule(licfile): + prikey, pubkey, prolic = _generate_project_capsule() + capkey = _encode_capsule_key_file(licfile) + return prikey, pubkey, capkey, prolic + +@dllmethod +def _encode_capsule_key_file(licfile): + prototype = PYFUNCTYPE(py_object, c_char_p, c_char_p) + dlfunc = prototype(('encode_capsule_key_file', _pytransform)) + return dlfunc(licfile.encode(), None) + +@dllmethod +def encrypt_files(key, filelist, mode=0): + t_key = c_char * 32 + prototype = PYFUNCTYPE(c_int, t_key, py_object, c_int) + dlfunc = prototype(('encrypt_files', _pytransform)) + return dlfunc(t_key(*key), filelist, mode) + +@dllmethod +def generate_module_key(pubname, key): + t_key = c_char * 32 + prototype = PYFUNCTYPE(py_object, c_char_p, t_key, c_char_p) + dlfunc = prototype(('generate_module_key', _pytransform)) + return dlfunc(pubname.encode(), t_key(*key), None) + +# +# Compatible for PyArmor v3.0 +# +@dllmethod +def old_init_runtime(systrace=0, sysprofile=1, threadtrace=0, threadprofile=1): + '''Only for old version, before PyArmor 3''' + pyarmor_init(is_runtime=1) + prototype = PYFUNCTYPE(c_int, c_int, c_int, c_int, c_int) + _init_runtime = prototype(('init_runtime', _pytransform)) + return _init_runtime(systrace, sysprofile, threadtrace, threadprofile) + +@dllmethod +def import_module(modname, filename): + '''Only for old version, before PyArmor 3''' + prototype = PYFUNCTYPE(py_object, c_char_p, c_char_p) + _import_module = prototype(('import_module', _pytransform)) + return _import_module(modname.encode(), filename.encode()) + +@dllmethod +def exec_file(filename): + '''Only for old version, before PyArmor 3''' + prototype = PYFUNCTYPE(c_int, c_char_p) + _exec_file = prototype(('exec_file', _pytransform)) + return _exec_file(filename.encode())