Closed PINTO0309 closed 1 year ago
First run pyarmor -d reg .pyarmor/pyarmor-device-regfile-60xx.7.zip
to check log, it will show both machine id in license file and current machine id.
Pyarmor 8.3.x introduces a new machine id which ignore virtual network (for example, docker bridge), it should keep same, please check it by this
python3 -c 'from pyarmor.cli.core import pytransform3
print("machine id", pytransform3.get_hd_info(16))'
And check whether it changes after reboot.
If it really changes, I'll build a debug version to check this issue.
I have the same issue:
System info:
Linux benjaminyde 6.2.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jul 13 16:27:29 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
Before reboot:
After reboot:
Thanks.
Obviously the values seem to change from boot to boot. Already, the key has changed so many times that the initial value of the authentication file generated is not known.
Before reboot
>>> from pyarmor.cli.core import pytransform3
>>> print('machine id', pytransform3.get_hd_info(16))
machine id b'g394a57c2bb501cd18d5aca3663291be1'
After reboot
>>> from pyarmor.cli.core import pytransform3
>>> print('machine id', pytransform3.get_hd_info(16))
machine id b'g00618c470d6fc3c443fa22d9137a8a9e'
pyarmor -d reg
pyarmor -d reg .pyarmor/pyarmor-device-regfile-60xx.7.zip
INFO Python 3.10.12
INFO Pyarmor 8.3.4 (trial), 000000, non-profits
INFO Platform linux.x86_64
DEBUG native platform linux.x86_64
DEBUG home path: /home/xxxxx/.pyarmor
INFO register ".pyarmor/pyarmor-device-regfile-60xx.7.zip"
DEBUG extracting license.lic
DEBUG extracting .pyarmor_capsule.zip
DEBUG group license for machines: ['tokens/gded88c2d25f7e6ee9afbd8ca371eb297']
DEBUG got machine id: g00618c470d6fc3c443fa22d9137a8a9e
DEBUG got machine id: beb84be1b3356cb971dde70ab80e789a6
ERROR could not get docker host machine id
Traceback (most recent call last):
File "/home/xxxxx/.local/lib/python3.10/site-packages/pyarmor/cli/register.py", line 194, in _get_docker_hostname
s.connect((host, port))
socket.gaierror: [Errno -2] Name or service not known
ERROR could not get docker host machine id
Please also report os (it seems all of them are linux), physical device or virtual machine. Do not report if it's docker container.
What else do you want to know about the OS other than what I initially wrote?
OS (Moderate line breaks.)
$ uname -a
Linux ubuntu2204 6.2.0-26-generic
#26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC
Thu Jul 13 16:27:29 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/issue
Ubuntu 22.04.3 LTS \n \l
I have build debug version pytransform3.so
to track machine info, if machine id is changed after reboot, please download it from
https://pyarmor.dashingsoft.com/downloads/temp/libs/cp3.9/pytransform3.so
If you're using other Python version, replace cp3.9
with corresponding version.
Then run this twice, before reboot and after reboot
python3.9 -c"import pytransform3
print(pytransform3.get_hd_info(16))"
Compare console output, and report which items are changed.
Okay. I'm out of town and will try the day after tomorrow.
deepdev@deepdev-H270-Gaming-3:~$ uname -a
Linux deepdev-H270-Gaming-3 6.2.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jul 13 16:27:29 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
https://pyarmor.dashingsoft.com/downloads/temp/libs/cp3.9/pytransform3.so
This link is invalid. Error 404 not found
This link works in my machine.
@jondy
I just got home from a 2-day business trip to a distant place and immediately tried to download the file from the URL you provided, but I get an HTTP 404 and can't seem to access it.
https://pyarmor.dashingsoft.com/downloads/temp/libs/cp3.9/pytransform3.so https://pyarmor.dashingsoft.com/downloads/temp/libs/cp3.10/pytransform3.so
@alikaz3mi @PINTO0309 Please try it again, I fix the access right error.
@jondy
eno1
is corrupted.disk info
information is acquired is broken. (I don't know if the order has anything to do with it.)Left: Before reboot Right: After reboot
Before Reboot:
01:node name : deepdev-H270-Gaming-3
02:enp6s0 : e0d5^02e41f
03:disk info : wwn-0x5000000000000000-part1
04:disk info : ata-860_EVO_250GB_CS_0123459948-part1
05:disk info : wwn-0x50014ee20b6b2f7e-part1
06:disk info : ata-WDC_WD10EURX-63C57Y0_WD-WCC4J7KCZ790-part1
07:disk info : wwn-0x50014ee20b6b2f7e-part2
08:disk info : ata-WDC_WD10EURX-63C57Y0_WD-WCC4J7KCZ790-part2
09:disk info : ata-WDC_WD10EURX-63C57Y0_WD-WCC4J7KCZ790
10:disk info : wwn-0x50014ee20b6b2f7e
11:disk info : ata-860_EVO_250GB_CS_0123459948-part2
12:disk info : wwn-0x5000000000000000-part2
13:disk info : wwn-0x5000000000000000
14:disk info : ata-860_EVO_250GB_CS_0123459948
b'ga8f79979e618d37ccdf2f1148ac5406b'
After reboot:
01:node name : deepdev-H270-Gaming-3
02:enp6s0 : e0d5^02e41f
03:disk info : ata-860_EVO_250GB_CS_0123459948-part1
04:disk info : wwn-0x5000000000000000-part1
05:disk info : wwn-0x50014ee20b6b2f7e-part1
06:disk info : ata-WDC_WD10EURX-63C57Y0_WD-WCC4J7KCZ790-part1
07:disk info : wwn-0x50014ee20b6b2f7e-part2
08:disk info : ata-WDC_WD10EURX-63C57Y0_WD-WCC4J7KCZ790-part2
09:disk info : ata-WDC_WD10EURX-63C57Y0_WD-WCC4J7KCZ790
10:disk info : wwn-0x50014ee20b6b2f7e
11:disk info : ata-860_EVO_250GB_CS_0123459948-part2
12:disk info : wwn-0x5000000000000000-part2
13:disk info : ata-860_EVO_250GB_CS_0123459948
14:disk info : wwn-0x5000000000000000
b'g518eb645dd9d9d4e4ae0967486901032'
It seems that the order of some of the disk infos has changed
@alikaz3mi
Got it, thanks, it will be fixed in next release
@alikaz3mi
Got it, thanks, it will be fixed in next release
before next release, how to get around this issue?
If machine id is changed after reboot, there is no workaround.
The fixed version will be released in 24 hours.
I have updated to the newest version of pyarmor. But I am still getting different machine ids:
01:node name : deepdev-H270-Gaming-3
02:enp6s0 : e0d5^02e41f
03:disk info : wwn-0x5000000000000000-part1
04:disk info : ata-860_EVO_250GB_CS_0123459948-part1
05:disk info : wwn-0x50014ee20b6b2f7e-part2
06:disk info : ata-WDC_WD10EURX-63C57Y0_WD-WCC4J7KCZ790-part2
07:disk info : wwn-0x50014ee20b6b2f7e-part1
08:disk info : ata-WDC_WD10EURX-63C57Y0_WD-WCC4J7KCZ790-part1
09:disk info : wwn-0x50014ee20b6b2f7e
10:disk info : ata-WDC_WD10EURX-63C57Y0_WD-WCC4J7KCZ790
11:disk info : wwn-0x5000000000000000-part2
12:disk info : ata-860_EVO_250GB_CS_0123459948-part2
13:disk info : wwn-0x5000000000000000
14:disk info : ata-860_EVO_250GB_CS_0123459948
b'g23cb61b0b7fd21a527b031b901bf6bb1'
After reboot:
01:node name : deepdev-H270-Gaming-33
02:enp6s0 : e0�5e02e41f
03:disk info : ata-860_EVO_250GB_CS_0123459948-part31
04:disk info : wwn-0x5000000000000000-part31
05:disk info : wwn-0x50014ee20b6b2f7e-part31
06:disk info : ata-WDC_WD10EURX-63C57Y0_WD-WCC4J7KCZ790-part31
07:disk info : wwn-0x50014ee20b6b2f7e-part32
08:disk info : ata-WDC_WD10EURX-63C57Y0_WD-WCC4J7KCZ790-part32
09:disk info : wwn-0x50014ee20b6b2f765
10:disk info : ata-WDC_WD10EURX-63C57Y0_WD-WCC4J7KCZ7930
11:disk info : wwn-0x5000000000000000-part32
12:disk info : ata-860_EVO_250GB_CS_0123459948-part32
13:disk info : ata-860_EVO_250GB_CS_01234599438
14:disk info : wwn-0x50000000000000030
b'g5a1ac30a15c75c4b08e8d482d8b8e3c6'
I also tested with 8.3.5 and it also still changes when rebooting
Device info:
Linux benjaminyde 6.2.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jul 13 16:27:29 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
@BenjaminYde
Could you download debug version pytransform3.so
above, and report what changes?
I tried upgrading the version but the situation did not change. Maybe the next version?
Install pyarmor 8.3.5
pip install pyarmor -U
Installing collected packages: pyarmor.cli.core, pyarmor
Attempting uninstall: pyarmor.cli.core
Found existing installation: pyarmor.cli.core 4.3.1
Uninstalling pyarmor.cli.core-4.3.1:
Successfully uninstalled pyarmor.cli.core-4.3.1
Attempting uninstall: pyarmor
Found existing installation: pyarmor 8.3.4
Uninstalling pyarmor-8.3.4:
Successfully uninstalled pyarmor-8.3.4
Successfully installed pyarmor-8.3.5 pyarmor.cli.core-4.3.3
Before reboot (debug)
import pytransform3
print(pytransform3.get_hd_info(16))
01:node name : ubuntu20034
02:eno1 : 2c�5d�4291
03:disk info : wwn-0x50014800000000030
04:disk info : ata-HL-DT-ST_DVDRAM_GH24NSD5_KL7L1ID36339
05:disk info : nvme-INTEL_SSDPEKNW020T9_BTNR03440K4V2P0C-part31
06:disk info : nvme-eui.0000000001000000e4d25c1c10d75201-part31
07:disk info : wwn-0x5000c500d591eaec-part31
08:disk info : ata-ST2000DM008-2FR102_WK308FMM-part31
09:disk info : ata-ST2000DM008-2FR102_WK308FM4d
10:disk info : wwn-0x5000c500d591eae63
11:disk info : nvme-INTEL_SSDPEKNW020T9_BTNR03440K4V2P0C-part32
12:disk info : nvme-eui.0000000001000000e4d25c1c10d75201-part32
13:disk info : nvme-INTEL_SSDPEKNW020T9_BTNR03440K4V2P043
14:disk info : nvme-eui.0000000001000000e4d25c1c10d752031
b'g1d448f11f1c8296a81e28d79f02f3c47'
After reboot (debug)
import pytransform3
print(pytransform3.get_hd_info(16))
01:node name : ubuntu20034
02:eno1 : 2c�5d�4291
03:disk info : ata-HL-DT-ST_DVDRAM_GH24NSD5_KL7L1ID36339
04:disk info : wwn-0x50014800000000030
05:disk info : nvme-eui.0000000001000000e4d25c1c10d75201-part31
06:disk info : nvme-INTEL_SSDPEKNW020T9_BTNR03440K4V2P0C-part31
07:disk info : ata-ST2000DM008-2FR102_WK308FMM-part31
08:disk info : wwn-0x5000c500d591eaec-part31
09:disk info : ata-ST2000DM008-2FR102_WK308FM4d
10:disk info : wwn-0x5000c500d591eae63
11:disk info : nvme-INTEL_SSDPEKNW020T9_BTNR03440K4V2P0C-part32
12:disk info : nvme-eui.0000000001000000e4d25c1c10d75201-part32
13:disk info : nvme-eui.0000000001000000e4d25c1c10d752031
14:disk info : nvme-INTEL_SSDPEKNW020T9_BTNR03440K4V2P043
b'g2108e19d6b57b574a053417168eb5eec'
pyarmor 8.3.5 + cli
from pyarmor.cli.core import pytransform3
print(pytransform3.get_hd_info(16))
b'g2108e19d6b57b574a053417168eb5eec'
from pyarmor.cli.core import pytransform3
print(pytransform3.get_hd_info(16))
b'g00570b22a948997453ed062205b55272'
And in Pyarmor 8.3.5, test machine id with get_hd_info(20)
, not get_hd_info(16)
.
Looks good. But you haven't updated your debug .so file, have you?
from pyarmor.cli.core import pytransform3
print(pytransform3.get_hd_info(20))
b'k859b55c52119dfe46955e46341e8d865'
import pytransform3
print(pytransform3.get_hd_info(20))
01:node name : ubuntu20034
02:eno1 : 2c�5d�4291
03:disk info : wwn-0x50014800000000030
04:disk info : ata-HL-DT-ST_DVDRAM_GH24NSD5_KL7L1ID36339
05:disk info : nvme-INTEL_SSDPEKNW020T9_BTNR03440K4V2P0C-part31
06:disk info : nvme-eui.0000000001000000e4d25c1c10d75201-part31
07:disk info : wwn-0x5000c500d591eaec-part31
08:disk info : ata-ST2000DM008-2FR102_WK308FMM-part31
09:disk info : nvme-eui.0000000001000000e4d25c1c10d75201-part32
10:disk info : nvme-INTEL_SSDPEKNW020T9_BTNR03440K4V2P0C-part32
11:disk info : wwn-0x5000c500d591eae63
12:disk info : ata-ST2000DM008-2FR102_WK308FM4d
13:disk info : nvme-eui.0000000001000000e4d25c1c10d752031
14:disk info : nvme-INTEL_SSDPEKNW020T9_BTNR03440K4V2P043
b'k00570b22a948997453ed062205b55272'
from pyarmor.cli.core import pytransform3
print(pytransform3.get_hd_info(20))
b'k859b55c52119dfe46955e46341e8d865'
import pytransform3
print(pytransform3.get_hd_info(20))
01:node name : ubuntu20034
02:eno1 : 2c�5d�4291
03:disk info : wwn-0x50014800000000030
04:disk info : ata-HL-DT-ST_DVDRAM_GH24NSD5_KL7L1ID36339
05:disk info : nvme-INTEL_SSDPEKNW020T9_BTNR03440K4V2P0C-part31
06:disk info : nvme-eui.0000000001000000e4d25c1c10d75201-part31
07:disk info : wwn-0x5000c500d591eaec-part31
08:disk info : ata-ST2000DM008-2FR102_WK308FMM-part31
09:disk info : ata-ST2000DM008-2FR102_WK308FM4d
10:disk info : wwn-0x5000c500d591eae63
11:disk info : nvme-eui.0000000001000000e4d25c1c10d75201-part32
12:disk info : nvme-INTEL_SSDPEKNW020T9_BTNR03440K4V2P0C-part32
13:disk info : nvme-eui.0000000001000000e4d25c1c10d752031
14:disk info : nvme-INTEL_SSDPEKNW020T9_BTNR03440K4V2P043
b'kc249013b05bea2210f544cff53984715'
Review the flow with the license administrator and if all is well, close this issue. Please wait a moment.
But you haven't updated your debug .so file, have you?
No, I really didn't updated it. But it's enough to find the problem.
Obfuscation succeeded with the Group
license still in place after reboot. Thank you very much.
I would like to restore the 7 licenses that have expired without being used...
If possible...
pyarmor gen make_thresholded_relu.py
INFO Python 3.10.12
INFO Pyarmor 8.3.5 (group), 006079, xxx
INFO Platform linux.x86_64
INFO search inputs ...
INFO find script make_thresholded_relu.py
INFO find 1 top resources
INFO start to generate runtime files
INFO target platforms {'linux.x86_64'}
INFO write dist/pyarmor_runtime_006079/pyarmor_runtime.so
INFO patch runtime file
INFO generate runtime files OK
INFO start to obfuscate scripts
INFO process resource "make_thresholded_relu"
INFO obfuscating file make_thresholded_relu.py
INFO write dist/make_thresholded_relu.py
INFO obfuscate scripts OK
I have the same with my licenses... I can use them once but when rebooted they are useless.
I have tested with get_hd_info(20)
before reboot:
print(pytransform3.get_hd_info(20))"
01:node name : deepdev-H270-Gaming-33
02:enp6s0 : e0�5e02e41f
03:disk info : ata-860_EVO_250GB_CS_0123459948-part31
04:disk info : wwn-0x5000000000000000-part31
05:disk info : wwn-0x50014ee20b6b2f7e-part31
06:disk info : ata-WDC_WD10EURX-63C57Y0_WD-WCC4J7KCZ790-part31
07:disk info : wwn-0x50014ee20b6b2f7e-part32
08:disk info : ata-WDC_WD10EURX-63C57Y0_WD-WCC4J7KCZ790-part32
09:disk info : wwn-0x50014ee20b6b2f765
10:disk info : ata-WDC_WD10EURX-63C57Y0_WD-WCC4J7KCZ7930
11:disk info : wwn-0x5000000000000000-part32
12:disk info : ata-860_EVO_250GB_CS_0123459948-part32
13:disk info : ata-860_EVO_250GB_CS_01234599438
14:disk info : wwn-0x50000000000000030
b'k5a1ac30a15c75c4b08e8d482d8b8e3c6'
but from pyarmor.cli.core import Pytransform3
gave a different machine id :
machine id is "b'kcf899c8d241d00b8649f38df8b2bbd6b'"
After reboot:
print(pytransform3.get_hd_info(20))"
01:node name : deepdev-H270-Gaming-33
02:enp6s0 : e0�5e02e41f
03:disk info : wwn-0x5000000000000000-part31
04:disk info : ata-860_EVO_250GB_CS_0123459948-part31
05:disk info : wwn-0x50014ee20b6b2f7e-part32
06:disk info : ata-WDC_WD10EURX-63C57Y0_WD-WCC4J7KCZ790-part32
07:disk info : wwn-0x50014ee20b6b2f7e-part31
08:disk info : ata-WDC_WD10EURX-63C57Y0_WD-WCC4J7KCZ790-part31
09:disk info : ata-WDC_WD10EURX-63C57Y0_WD-WCC4J7KCZ7930
10:disk info : wwn-0x50014ee20b6b2f765
11:disk info : ata-860_EVO_250GB_CS_0123459948-part32
12:disk info : wwn-0x5000000000000000-part32
13:disk info : wwn-0x50000000000000030
14:disk info : ata-860_EVO_250GB_CS_01234599438
b'k2f44b635562f36892c7a8fb1bf1022f6'
and the python cli:
kcf899c8d241d00b8649f38df8b2bbd6b
Although the value from python cli are equal, I am still unable to use the licensed version of pyarmor.
@alikaz3mi
This may not help you, but I'm posting it just in case.
I discarded the license file with id=7
that I was using for verification in the very first comment that posted this issue, and verified it with a new license file with id=8
generated using pyarmor 8.3.5, and TOKEN remained fixed after the reboot.
You will probably need to generate a new file using the latest pyarmor 8.3.5, as the specification appears to be that TOKEN is embedded in the file that is first generated on the physical device side. Note that the id already used cannot be reused.
The 7 unused licenses I issued for verification are not available.
Past licenses remain inactive, but will be closed.
Why is this issue closed? My problem hasn't been solved yet. @jondy. I have generated and tested pyarmor with new license file.
I see. Sorry about that.
@alikaz3mi
Could you describe problem with shell commands and console log?
Also describe in which machine (is docker, or pyhysic device) to run shell command
And is system python or other python interperter.
Please run pyarmor -d reg xxx
to register Pyarmor.
I am using the systems default python, my machine is a physical desktop PC. Have you seen the get_hd_info(20) that I reported above? It seems that some of the fields are still changing.
Here's the log for registering the 9th license.
deepdev@deepdev-H270-Gaming-3:~$ pyarmor -d reg pyarmor-device-regfile-6070.9.zip
INFO Python 3.10.12
INFO Pyarmor 8.3.5 (group), 006070, dashboard
INFO Platform linux.x86_64
DEBUG native platform linux.x86_64
DEBUG home path: /home/deepdev/.pyarmor
INFO register "pyarmor-device-regfile-6070.9.zip"
DEBUG extracting license.lic
DEBUG extracting .pyarmor_capsule.zip
DEBUG group license for machines: ['tokens/kcf899c8d241d00b8649f38df8b2bbd6b']
DEBUG got machine id: kcf899c8d241d00b8649f38df8b2bbd6b
DEBUG extracting tokens/kcf899c8d241d00b8649f38df8b2bbd6b
INFO This license registration information:
License Type : pyarmor-group
License No. : pyarmor-vax-006070
License To : HEMSCap
License Product : dashboard
BCC Mode : Yes
RFT Mode : Yes
Notes
* Offline obfuscation
@alikaz3mi
This bug is fixed in v8.3.5, the temporary uploaded files are still old.
Please test all by Pyarmor 8.3.5
ERROR invalid license token, try to run `pyarmor reg` to register license again
deepdev@deepdev-H270-Gaming-3:~/PycharmProjects/dashboard_project/dashboard_setup$ cat pyarmor.error.log ^C
deepdev@deepdev-H270-Gaming-3:~/PycharmProjects/dashboard_project/dashboard_setup$ pyarmor -v
Pyarmor 8.3.5 (group), 006070, dashboard
License Type : pyarmor-group
License No. : pyarmor-vax-006070
License To : HEMSCap
License Product : dashboard
BCC Mode : Yes
RFT Mode : Yes
Notes
* Offline obfuscation
deepdev@deepdev-H270-Gaming-3:~/PycharmProjects/dashboard_project/dashboard_setup$ cat pyarmor.error.log
1715429 MainProcess 2023-09-03 08:20:01,195
Traceback (most recent call last):
File "/home/deepdev/.local/lib/python3.10/site-packages/pyarmor/cli/__main__.py", line 702, in main
File "/home/deepdev/.local/lib/python3.10/site-packages/pyarmor/cli/__main__.py", line 690, in main_entry
File "/home/deepdev/.local/lib/python3.10/site-packages/pyarmor/cli/__main__.py", line 229, in cmd_gen
File "/home/deepdev/.local/lib/python3.10/site-packages/pyarmor/cli/generate.py", line 156, in process
File "/home/deepdev/.local/lib/python3.10/site-packages/pyarmor/cli/generate.py", line 119, in _obfuscate_scripts
File "/home/deepdev/.local/lib/python3.10/site-packages/pyarmor/cli/core/__init__.py", line 103, in generate_obfuscated_script
File "<maker>", line 665, in generate_obfuscated_script
File "/home/deepdev/.local/lib/python3.10/site-packages/pyarmor/cli/__init__.py", line 16, in process
File "<maker>", line 504, in process
File "<maker>", line 510, in coserialize
File "<maker>", line 555, in _build_ast_body
RuntimeError: invalid license token, try to run `pyarmor reg` to register license again
@alikaz3mi
Could you test the following command with same pyarmor
?
pyarmor -d reg pyarmor-group-device-9.zip
touch foo.py
pyarmor -d gen --enable-bcc foo.py
Please provide full commands and full log.
And I'm curious why you just provide only error log but not provide full commands to reproduce the issue as I have told you in previous comments.
And why not try pyarmor reg
again just like error message suggestion? Eevn it failed, also report error message which could help fix the problem and save both your time and my time.
It could not help to fix the problem only say pyarmor doesn't work but not provide enough information.
I'd try to do mo best for solving this issue
deepdev@deepdev-H270-Gaming-3:~$ pyarmor -d reg pyarmor-device-regfile-6070.10.zip
INFO Python 3.10.12
INFO Pyarmor 8.3.5 (group), 006070, dashboard
INFO Platform linux.x86_64
DEBUG native platform linux.x86_64
DEBUG home path: /home/deepdev/.pyarmor
INFO register "pyarmor-device-regfile-6070.10.zip"
DEBUG extracting license.lic
DEBUG extracting .pyarmor_capsule.zip
DEBUG group license for machines: ['tokens/kcf899c8d241d00b8649f38df8b2bbd6b']
DEBUG got machine id: kcf899c8d241d00b8649f38df8b2bbd6b
DEBUG extracting tokens/kcf899c8d241d00b8649f38df8b2bbd6b
INFO This license registration information:
License Type : pyarmor-group
License No. : pyarmor-vax-006070
License To : HEMSCap
License Product : dashboard
BCC Mode : Yes
RFT Mode : Yes
Notes
* Offline obfuscation
deepdev@deepdev-H270-Gaming-3:~$ touch foo.py
deepdev@deepdev-H270-Gaming-3:~$ pyarmor -d gen --enable-bcc foo.py
INFO Python 3.10.12
INFO Pyarmor 8.3.5 (group), 006070, dashboard
INFO Platform linux.x86_64
DEBUG native platform linux.x86_64
DEBUG home path: /home/deepdev/.pyarmor
DEBUG command options: {'no_runtime': False, 'enable_bcc': True, 'inputs': ['foo.py']}
DEBUG install plugin: CodesignPlugin
DEBUG install plugin: DarwinUniversalPlugin
INFO search inputs ...
INFO find script foo.py
INFO find 1 top resources
INFO start to generate runtime files
INFO target platforms {'linux.x86_64'}
INFO write dist/pyarmor_runtime_006070/pyarmor_runtime.so
INFO patch runtime file
DEBUG patching runtime data at 747712
DEBUG patch runtime file OK
DEBUG call post runtime plugin <class 'pyarmor.cli.plugin.CodesignPlugin'>
INFO generate runtime files OK
INFO start to obfuscate scripts
INFO process resource "foo"
INFO obfuscating file foo.py
DEBUG process inline marker
DEBUG parse script
INFO start to generate bcc code ...
INFO no bcc code generated
DEBUG process co
DEBUG patch co
INFO write dist/foo.py
INFO obfuscate scripts OK
DEBUG call post build plugin <class 'pyarmor.cli.plugin.DarwinUniversalPlugin'>
If using same pyarmor, and same logon user, it should no problem.
Could you obfuscate your real scripts by first pyarmor -d reg pyarmor-group-device-xxxx.10.zip
then pyarmor -d gen ...
?
If it still failed, please paste all the logs of pyarmor -d reg...
, and partly logs of pyarmor -d gen...
(about the first 20 lines and last 20 lines)
For two days now, I've been struggling with the activation of a group license. In my case, print(pytransform3.get_hd_info(20)) returns a new value every time, even without rebooting. If you run print(pytransform3.get_hd_info(20)) three times in a row, it will output different strings. Why use such complex mechanisms that are unreliable and require so many manipulations?
Apart from pyarmor, I also have a license for sourceguardian (a similar tool for protecting PHP code). The guys used a mechanism much simpler than this one. And it works reliably and flawlessly. Everything here is as simple as possible.
sourceguardian:
build:
context: .
dockerfile: Dockerfile-sourceguardian
volumes:
- /var/run/docker.sock:/var/run/sourceguardian-docker.sock
- ./src:/src
The external docker.sock is mounted inside the container, and as far as I understand, it generates a machine ID from the external Docker machine.
@jondy Does pyarmor have file count limitation? Because it works everywhere, except one project which contains 300 files.
First 20 lines:
deepdev@deepdev-H270-Gaming-3:~/PycharmProjects/dashboard_project/dashboard_setup$ pyarmor -d gen -O dapi -r dashboard_api/
INFO Python 3.10.12
INFO Pyarmor 8.3.5 (group), 006070, dashboard
INFO Platform linux.x86_64
DEBUG native platform linux.x86_64
DEBUG home path: /home/deepdev/.pyarmor
DEBUG command options: {'recursive': True, 'output': 'dapi', 'no_runtime': False, 'inputs': ['dashboard_api']}
DEBUG install plugin: CodesignPlugin
DEBUG install plugin: DarwinUniversalPlugin
INFO search inputs ...
INFO find package at dashboard_api
INFO find 1 top resources
INFO start to generate runtime files
INFO target platforms {'linux.x86_64'}
INFO write dapi/pyarmor_runtime_006070/pyarmor_runtime.so
INFO patch runtime file
DEBUG patching runtime data at 747712
DEBUG patch runtime file OK
DEBUG call post runtime plugin <class 'pyarmor.cli.plugin.CodesignPlugin'>
INFO generate runtime files OK
INFO start to obfuscate scripts
INFO process resource "dashboard_api"
INFO obfuscating file config.py
DEBUG process inline marker
DEBUG parse script
DEBUG process co
DEBUG patch co
INFO write dapi/dashboard_api/config.py
INFO obfuscating file manage.py
DEBUG process inline marker
DEBUG parse script
DEBUG process co
DEBUG patch co
INFO write dapi/dashboard_api/manage.py
INFO obfuscating file main.py
DEBUG process inline marker
DEBUG parse script
DEBUG process co
DEBUG patch co
INFO write dapi/dashboard_api/main.py
INFO obfuscating file config-3.py
DEBUG process inline marker
DEBUG parse script
DEBUG process co
DEBUG patch co
INFO write dapi/dashboard_api/config-3.py
INFO obfuscating file test_configuration.py
Last 20 lines:
INFO write dapi/dashboard_api/data_matrix_app/domain/entities/package.py
INFO obfuscating file collected_information.py
DEBUG process inline marker
DEBUG parse script
DEBUG process co
DEBUG patch co
INFO write dapi/dashboard_api/data_matrix_app/domain/entities/collected_information.py
INFO obfuscating file shape.py
DEBUG process inline marker
DEBUG parse script
DEBUG process co
DEBUG patch co
INFO write dapi/dashboard_api/data_matrix_app/domain/entities/shape.py
INFO obfuscating file box.py
DEBUG process inline marker
DEBUG parse script
DEBUG process co
DEBUG patch co
INFO write dapi/dashboard_api/data_matrix_app/domain/entities/box.py
INFO obfuscating file source.py
DEBUG process inline marker
DEBUG parse script
DEBUG process co
DEBUG patch co
INFO write dapi/dashboard_api/data_matrix_app/domain/entities/source.py
INFO obfuscating file __init__.py
DEBUG process inline marker
DEBUG parse script
DEBUG process co
DEBUG patch co
INFO write dapi/dashboard_api/api/__init__.py
INFO obfuscating file apps.py
DEBUG process inline marker
DEBUG parse script
DEBUG process co
DEBUG patch co
INFO write dapi/dashboard_api/api/apps.py
INFO obfuscating file log.py
DEBUG process inline marker
DEBUG parse script
DEBUG process co
DEBUG patch co
DEBUG unknown error, please check pyarmor.error.log
ERROR invalid license token, try to run `pyarmor reg` to register license again
pyarmor error log:
312145 MainProcess 2023-09-10 09:30:34,724
Traceback (most recent call last):
File "/home/deepdev/.local/lib/python3.10/site-packages/pyarmor/cli/__main__.py", line 702, in main
File "/home/deepdev/.local/lib/python3.10/site-packages/pyarmor/cli/__main__.py", line 690, in main_entry
File "/home/deepdev/.local/lib/python3.10/site-packages/pyarmor/cli/__main__.py", line 229, in cmd_gen
File "/home/deepdev/.local/lib/python3.10/site-packages/pyarmor/cli/generate.py", line 156, in process
File "/home/deepdev/.local/lib/python3.10/site-packages/pyarmor/cli/generate.py", line 119, in _obfuscate_scripts
File "/home/deepdev/.local/lib/python3.10/site-packages/pyarmor/cli/core/__init__.py", line 103, in generate_obfuscated_script
File "<maker>", line 665, in generate_obfuscated_script
File "/home/deepdev/.local/lib/python3.10/site-packages/pyarmor/cli/__init__.py", line 16, in process
File "<maker>", line 504, in process
File "<maker>", line 510, in coserialize
File "<maker>", line 555, in _build_ast_body
RuntimeError: invalid license token, try to run `pyarmor reg` to register license again
pyarmor -d reg ...:
deepdev@deepdev-H270-Gaming-3:~$ pyarmor -d reg pyarmor-device-regfile-6070.10.zip
INFO Python 3.10.12
INFO Pyarmor 8.3.5 (group), 006070, dashboard
INFO Platform linux.x86_64
DEBUG native platform linux.x86_64
DEBUG home path: /home/deepdev/.pyarmor
INFO register "pyarmor-device-regfile-6070.10.zip"
DEBUG extracting license.lic
DEBUG extracting .pyarmor_capsule.zip
DEBUG group license for machines: ['tokens/kcf899c8d241d00b8649f38df8b2bbd6b']
DEBUG got machine id: kcf899c8d241d00b8649f38df8b2bbd6b
DEBUG extracting tokens/kcf899c8d241d00b8649f38df8b2bbd6b
INFO This license registration information:
License Type : pyarmor-group
License No. : pyarmor-vax-006070
License To : HEMSCap
License Product : dashboard
BCC Mode : Yes
RFT Mode : Yes
Notes
* Offline obfuscation
@alikaz3mi
Pyarmor has no file count limitation, it's very strange.
Please help to do a few test?
/home/deepdev/.pyarmor/.license.token
changed?pyarmor reg ...
/home/deepdev/.pyarmor/.license.token
to token.bak
/home/deepdev/.pyarmor/.license.token
with token.bak
log.py
failed, try to obfuscate this file onlypyarmor reg ...
log.py
by pyarmor gen /path/to/log.py
The last time it changed was when I ran pyarmor reg
.
deepdev@deepdev-H270-Gaming-3:~/.pyarmor$ ls -la
total 36
drwxrwxr-x 4 deepdev deepdev 4096 aug 21 09:42 .
drwxr-x--- 67 deepdev deepdev 4096 sep 10 12:18 ..
drwxrwxr-x 2 deepdev deepdev 4096 aug 8 11:29 docker
drwxrwxr-x 3 deepdev deepdev 4096 sep 3 08:18 group
-rw-rw-r-- 1 deepdev deepdev 197 sep 10 09:30 license.lic
-rw-rw-r-- 1 deepdev deepdev 509 sep 10 09:30 .license.token
-rw-rw-r-- 1 deepdev deepdev 2835 sep 10 09:30 .pyarmor_capsule.zip
-rw-rw-r-- 1 deepdev deepdev 943 sep 10 09:30 pyarmor.debug.log
-rw-rw-r-- 1 deepdev deepdev 5 aug 21 09:42 rft_exclude_table
After that, I have ran pyarmor gen
for multiple times and it hasn't changed since then.
Doing The steps as requested:
deepdev@deepdev-H270-Gaming-3:~$ pyarmor -d reg pyarmor-device-regfile-6070.10.zip
INFO Python 3.10.12
INFO Pyarmor 8.3.5 (group), 006070, dashboard
INFO Platform linux.x86_64
DEBUG native platform linux.x86_64
DEBUG home path: /home/deepdev/.pyarmor
INFO register "pyarmor-device-regfile-6070.10.zip"
DEBUG extracting license.lic
DEBUG extracting .pyarmor_capsule.zip
DEBUG group license for machines: ['tokens/kcf899c8d241d00b8649f38df8b2bbd6b']
DEBUG got machine id: kcf899c8d241d00b8649f38df8b2bbd6b
DEBUG extracting tokens/kcf899c8d241d00b8649f38df8b2bbd6b
INFO This license registration information:
License Type : pyarmor-group
License No. : pyarmor-vax-006070
License To : HEMSCap
License Product : dashboard
BCC Mode : Yes
RFT Mode : Yes
Notes
* Offline obfuscation
I was able to obfuscat the log.py with ease
deepdev@deepdev-H270-Gaming-3:~/PycharmProjects/dashboard_project/dashboard_setup$ pyarmor -d gen -O dapi -r dashboard_api/core/models/log.py
INFO Python 3.10.12
INFO Pyarmor 8.3.5 (group), 006070, dashboard
INFO Platform linux.x86_64
DEBUG native platform linux.x86_64
DEBUG home path: /home/deepdev/.pyarmor
DEBUG command options: {'recursive': True, 'output': 'dapi', 'no_runtime': False, 'inputs': ['dashboard_api/core/models/log.py']}
DEBUG install plugin: CodesignPlugin
DEBUG install plugin: DarwinUniversalPlugin
INFO search inputs ...
INFO find script dashboard_api/core/models/log.py
INFO find 1 top resources
INFO start to generate runtime files
INFO target platforms {'linux.x86_64'}
INFO write dapi/pyarmor_runtime_006070/pyarmor_runtime.so
INFO patch runtime file
DEBUG patching runtime data at 747712
DEBUG patch runtime file OK
DEBUG call post runtime plugin <class 'pyarmor.cli.plugin.CodesignPlugin'>
INFO generate runtime files OK
INFO start to obfuscate scripts
INFO process resource "log"
INFO obfuscating file log.py
DEBUG process inline marker
DEBUG parse script
DEBUG process co
DEBUG patch co
DEBUG special co "RERAISE" at <frozen log>:63:save_log_to_db
INFO write dapi/log.py
INFO obfuscate scripts OK
DEBUG call post build plugin <class 'pyarmor.cli.plugin.DarwinUniversalPlugin'>
Although, the error indicates that I have to re-register, but pyarmor -v indicates that my license is still valid. Also, I am able to obfuscate any other file
@alikaz3mi
Got it. I'll do some tests to check it.
@alikaz3mi
I did some tests, but can't reproduce it.
Do you use other options except -r
? And do you use any pyarmor cfg
to change default options?
No, I haven't used any other cfg:
INFO Python 3.10.12
INFO Pyarmor 8.3.5 (group), 006070, dashboard
INFO Platform linux.x86_64
------------------------------------------------------------
Section: pyarmor
Current options
major = 8
minor = 3
patch = 5
cli.core = 4.3.2
timeout = 6
regurl = https://api.dashingsoft.com/pr...
buyurl = https://order.mycommerce.com/p...
Global options
Local options
------------------------------------------------------------
Section: logging
Current options
debug_logfile = .pyarmor/pyarmor.debug.log
trace_logfile = .pyarmor/pyarmor.trace.log
Global options
Local options
------------------------------------------------------------
Section: finder
Current options
recursive = 0
excludes = */__pycache__
pyexts = .py .pyw
data_files = 0
findall = 0
Global options
Local options
------------------------------------------------------------
Section: builder
Current options
encoding = utf-8
enable_trace = 0
enable_themida = 0
import_prefix = 0
bootstrap_file = __file__
exclude_co_names = <lambda> <listcomp> <setcomp> ...
exclude_restrict_modules = __init__
outer_keyname = pyarmor.rkey
inline_plugin_marker = pyarmor
plugins = CodesignPlugin DarwinUniversal...
jit_iv_threshold = 100
rft_enables = builtin import function class ...
rft_auto_exclude = 1
rft_auto_export = 1
rft_dev_mode = 0
group_device_flag = 20
optimize = -1
type_comments = false
trace_rft = 0
enable_jit = 0
enable_bcc = 0
enable_rft = 0
assert_call = 0
assert_import = 0
mix_str = 0
mix_coname = 0
mix_localnames = 1
mix_argnames = 0
obf_module = 1
obf_code = 1
wrap_mode = 1
restrict_module = 1
import_check_license = 0
clear_module_co = 1
clear_frame_locals = 0
rft_mix_import_name = 0
Global options
Local options
------------------------------------------------------------
Section: runtime
Current options
universal = 0
package_name_format = pyarmor_runtime_{suffix}
simple_extension_name = 1
outer = 0
on_error = 0
nts = pool.ntp.org
nts_timeout = 3
timer = 0
messages = messages.cfg:utf-8
Global options
Local options
------------------------------------------------------------
Section: pack
Current options
strip = 0
no_matched_pyc = error
Global options
Local options
------------------------------------------------------------
Section: bcc
Current options
unsupported_functions = exec eval super locals __asser...
unsupported_nodes = AsyncFunctionDef AsyncFor Asyn...
call_function_ex = 0
trace_lineno = 0
keep_nest_name = 0
ignore_lambda = 0
enable_pure_function = 1
enable_comprehension = 1
Global options
Local options
------------------------------------------------------------
Section: mix.str
Current options
threshold = 8
Global options
Local options
------------------------------------------------------------
Section: assert.call
Current options
auto_mode = and
Global options
Local options
------------------------------------------------------------
Section: assert.import
Current options
auto_mode = and
Global options
Local options
@alikaz3mi
After I check the source, how about remove the cached tokens and request one again:
rm -rf rm .pyarmor/group/tokens
pyarmor reg -g 10 pyarmor-regfile-6xxx.zip
pyarmor reg pyarmor-group-device-10.zip
pyarmor gen -r /path/to/src
I have done all of the steps. But issue still remained. Nothing changed.
DEBUG process co
DEBUG patch co
INFO write dapi/dashboard_api/data_matrix_app/domain/entities/source.py
INFO obfuscating file __init__.py
DEBUG process inline marker
DEBUG parse script
DEBUG process co
DEBUG patch co
INFO write dapi/dashboard_api/api/__init__.py
INFO obfuscating file apps.py
DEBUG process inline marker
DEBUG parse script
DEBUG process co
DEBUG patch co
INFO write dapi/dashboard_api/api/apps.py
INFO obfuscating file log.py
DEBUG process inline marker
DEBUG parse script
DEBUG process co
DEBUG patch co
DEBUG unknown error, please check pyarmor.error.log
ERROR invalid license token, try to run `pyarmor reg` to register license again
@alikaz3mi
Could you provide a mini project to reproduce this issue, and send it with reproduce steps to pyarmor@163.com?
@alikaz3mi
And try a clean uninstallation, make sure there is no your own data in ~/.pyarmor
, then
mv ~/.pyarmor backup.pyarmor
mv .pyarmor backup.local.pyarmor
pip uninstall pyarmor
pip uninstall pyarmor.cli.core
rm /path/to/package/pyarmor/src
then
pip install pyarmor
pyarmor reg -g 10
pyarmor reg -g 10 xxxx.zip
pyarmor reg pyarmor-group-device-10.zip
pyarmor gen -r /path/to/src
@alikaz3mi
Finally, i reproduce it by obfuscating the whole Python system library.
I'll check it and fix it in next release.
@alikaz3mi
Sorry, I made a mistake, it's still not reproduced.
The error is invalid token
, not invalid license token
INFO obfuscating file py2_test_grammar.py
ERROR invalid token (<frozen python3.lib2to3.tests.data.py2_test_grammar>, line 31)
1. Summary
An error is displayed during the initial authentication stage and the license activation fails.
I have isolated and verified the situation in detail and report it here. We recently procured a
group
license.2. Environment
3. Details
pyarmor
on my working machine. Not in Docker.pyarmor-group-device.7
to thepyarmor
license administrator on our team to generate a filepyarmor-device-regfile-60xx.7.zip
for thegroup
license authorization.pyarmor
in a Docker container, so I am installing pyarmor directly on the host PC.Here, I dare not use the pyarmor authentication file right away, but first list only the NW adapter information and basic information about the hard disk.
Again, list the hardware information. As a matter of course, the virtual Mac address of the installed Docker service changes each time the host PC is rebooted, unless special changes are made. By the way, my host PC is not equipped with wireless, so I only use the wired IP address of
eno1
.Here, the initial certification procedure is performed for the first time.
docker host machine id
. Note that the license file generated by the administrator withdevice id=7
at this point cannot be used for authentication in any way. In other words, before we started using pyarmor, we lost 7 licenses out of a total number of licenses with a limit of 100 deployments. Sacrifice 7 licenses to report this issue.In other words, as long as I use
pyarmor 8.3.4
, I seem to lose my license every time I reboot my PC. It is quite fatal.