温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

利用screw怎么对php源代码进行加密

发布时间:2020-12-21 16:54:36 来源:亿速云 阅读:191 作者:Leah 栏目:开发技术

这篇文章将为大家详细讲解有关利用screw怎么对php源代码进行加密,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。

安装环境
系统:centos 5.3
软件:Apache 2.2.9
PHP 5.2.10
以上环境全部是自己下载配置安装的。具体的Apache+php+mysql安装方法请从网上搜索。
安装
1.用tar解压缩 tar -zxvf php_screw-1.5.tar.gz
2.进入php_screw-1.5目录开始安装
cd php_screw-1.5
phpize
关于phpize ,它在php5-dev扩展模块中 只要安装php5-dev模块就行了。
./confiugre
3.设置自己用来加密的密码

复制代码 代码如下:


vi my_screw.h
 -- Please change the encryption SEED key (pm9screw_mycryptkey) into the
    values according to what you like.
    The encryption will be harder to break, if you add more values to the
    encryption SEED array. However, the size of the SEED is unrelated to
    the time of the decrypt processing.
 *  If you can read and understand the source code, to modify an original
        encryption logic will be possible. But in general, this should not
        be necessary.
   OPTIONAL: Encrypted scripts get a stamp added to the beginning of the
        file. If you like, you may change this stamp defined by
        PM9SCREW and PM9SCREW_LEN in php_screw.h. PM9SCREW_LEN must
        be less than or equal to the size of PM9SCREW.


4.编译
make
5.拷贝modules目录下的php_screw.so文件到/usr/lib/php5/extension目录下
cp modules/php_screw.so /usr/lib/php5/extension/
6.编辑php.ini文件
在php.ini文件里,加入如下语句
extension=php_screw.so
7.重新启动Apache
/srv/apache/bin/apachectl restart
8.编译加密工具
cd tools
make
9.将tools目录下加密用的工具screw拷贝到适当目录
cp screw /usr/bin/
经过以上的10步,就已经把php_screw-1.5全部安装完成了。并且现在的php也已经支持解释加密过的php文件了
使用
1.现写一个要加密的php文件。
我写了如下的一个用来测试php速度的test.php文件

复制代码 代码如下:


<?
$a=0;
$t=time();
for($i=0;$i<5000000;$i++)
  {$a=$a*$i;}
$t1=time();
echo "<p>";
echo "It used:";
echo $t1-$t;
echo "seconds";
?>


将上面的test.php文件放到/var/www/目录下。通过浏览器访问,将显示出php在大量计算时的速度(粗略估计)
2.将我们写的php文件加密
cd /var/www/
screw test.php
我们加密后,现在目录下的test.php文件就是我们已经加密的了。而源文件被改名为test.php.screw存放了。
我们现在再测试一下test.php,看看能否正常使用?速度如何?
我比较了一下,加密前后的速度大概一样,基本没有太多的损失。
3.批处理加密文件
在debian, apache2, php5上测试过对.html文件加密后,能正确解析;
php_screw如何对当前目录下,对目录下包含的文件,以及包含目录下的文件进行整体加密
find ./ -name "*.php"-print|xargs -n1 screw //加密所有的.php文件
find ./ -name "*.screw" -print/xargs -n1 rm //删除所有的.php源文件的备份文件

关于利用screw怎么对php源代码进行加密就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI