如何打开和编辑加密的 perl 脚本?
How to open and edit encrypted perl script?
我有一个加密的 perl 脚本。只有安装了 Filter::decrypt 才能编译此脚本。我有那个过滤器,我安装了它,脚本编译没有问题,但现在我想用一些文本编辑器打开那个脚本并编辑它。
有人可以帮助我并告诉我该怎么做吗?
从根本上讲 - 很难使脚本不可读,原因很简单,因为 perl 是一种解释型语言。究竟如何解开一些东西更多的是一个问题,它首先是如何纠缠在一起的。
所以我建议作为第一个停靠点 - 浏览 Mastering Perl
,其中有一整章是关于反汇编 perl 代码的。
但是,如果您只查看 Filter::decrypt
模块页面,它会指出该模块根本无法涵盖的几个地方 - 如果您控制了 perl 解释器,您只能真正 'protect' 编写代码首先。然而,它暗示的是:
Strip the Perl binary to remove all symbols.
Build the decrypt extension using static linking. If the extension is provided as a dynamic module, there is nothing to stop someone from linking it at run time with a modified Perl binary.
Do not build Perl with -DDEBUGGING. If you do then your source can be retrieved with the -Dp
command line option.
The sample filter contains logic to detect the DEBUGGING option.
Do not build Perl with C debugging support enabled.
Do not implement the decryption filter as a sub-process (like the cpp source filter). It is possible to peek into the pipe that connects to the sub-process.
Check that the Perl Compiler isn't being used.
There is code in the BOOT: section of decrypt.xs that shows how to detect the presence of the Compiler. Make sure you include it in your module.
Assuming you haven't taken any steps to spot when the compiler is in use and you have an encrypted Perl script called "myscript.pl", you can get access the source code inside it using the perl Compiler backend, like this
perl -MO=Deparse myscript.pl
Note that even if you have included the BOOT: test, it is still possible to use the Deparse module to get the source code for individual subroutines.
所以:
perl -MO=Deparse yourscript
perl -Dp yourscript
如果这些不起作用 - 查看 Filter::decrypt
的本地副本并对其进行更改,以便打印解密结果。
最佳选择:只需编辑未加密的副本并重新安装即可。
备选方案:使用 decr
(Filter::decrypt 附带)解密加密文件。
我有一个加密的 perl 脚本。只有安装了 Filter::decrypt 才能编译此脚本。我有那个过滤器,我安装了它,脚本编译没有问题,但现在我想用一些文本编辑器打开那个脚本并编辑它。
有人可以帮助我并告诉我该怎么做吗?
从根本上讲 - 很难使脚本不可读,原因很简单,因为 perl 是一种解释型语言。究竟如何解开一些东西更多的是一个问题,它首先是如何纠缠在一起的。
所以我建议作为第一个停靠点 - 浏览 Mastering Perl
,其中有一整章是关于反汇编 perl 代码的。
但是,如果您只查看 Filter::decrypt
模块页面,它会指出该模块根本无法涵盖的几个地方 - 如果您控制了 perl 解释器,您只能真正 'protect' 编写代码首先。然而,它暗示的是:
Strip the Perl binary to remove all symbols.
Build the decrypt extension using static linking. If the extension is provided as a dynamic module, there is nothing to stop someone from linking it at run time with a modified Perl binary.
Do not build Perl with -DDEBUGGING. If you do then your source can be retrieved with the
-Dp
command line option.The sample filter contains logic to detect the DEBUGGING option.
Do not build Perl with C debugging support enabled.
Do not implement the decryption filter as a sub-process (like the cpp source filter). It is possible to peek into the pipe that connects to the sub-process.
Check that the Perl Compiler isn't being used.
There is code in the BOOT: section of decrypt.xs that shows how to detect the presence of the Compiler. Make sure you include it in your module.
Assuming you haven't taken any steps to spot when the compiler is in use and you have an encrypted Perl script called "myscript.pl", you can get access the source code inside it using the perl Compiler backend, like this
perl -MO=Deparse myscript.pl
Note that even if you have included the BOOT: test, it is still possible to use the Deparse module to get the source code for individual subroutines.
所以:
perl -MO=Deparse yourscript
perl -Dp yourscript
如果这些不起作用 - 查看 Filter::decrypt
的本地副本并对其进行更改,以便打印解密结果。
最佳选择:只需编辑未加密的副本并重新安装即可。
备选方案:使用 decr
(Filter::decrypt 附带)解密加密文件。