Skip to content

PHP source code encrypt module (PHP源码加密模块)

Notifications You must be signed in to change notification settings

hoytluo/php-beast

This branch is 135 commits behind liexusong/php-beast:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
xusong.lie
Aug 30, 2016
624cea5 · Aug 30, 2016
Jul 5, 2016
May 3, 2016
Aug 30, 2016
May 6, 2015
Jun 8, 2013
Jun 8, 2013
Aug 15, 2016
May 17, 2016
May 17, 2016
May 17, 2016
Aug 30, 2016
May 12, 2014
Sep 6, 2013
Aug 9, 2016
May 5, 2016
May 4, 2016
Aug 11, 2016
Aug 2, 2016
Jul 5, 2016
Jun 8, 2013
May 4, 2016
May 3, 2016
May 17, 2016
May 20, 2016
Jul 5, 2016
Aug 30, 2016
Aug 2, 2016
Jun 22, 2014

Repository files navigation

        ____  __  ______     ____  _________   ___________      ___ ___
       / __ \/ / / / __ \   / __ )/ ____/   | / ___/_  __/     ___   ___
      / /_/ / /_/ / /_/ /  / __  / __/ / /| | \__ \ / /       ___     ___
     / ____/ __  / ____/  / /_/ / /___/ ___ |___/ // /       ___       ___
    /_/   /_/ /_/_/      /_____/_____/_/  |_/____//_/       ___         ___
此模块可以用于商业用途, 版权归原作者.
QQ交流群:239243332
安装此扩展必须使用非线程安全版本,否则可能出错!!!

php-beast可以自定义加密模块,加密模块编写教程: 点击

编译安装如下:


$ wget https://github.com/liexusong/php-beast/archive/master.zip
$ unzip master.zip
$ cd php-beast-master
$ phpize
$ ./configure
$ sudo make && make install

编译好之后修改php.ini配置文件, 加入配置项: extension=beast.so, 重启php-fpm

温馨提示: 可以设置较大的缓存提高效率

使用php-beast的性能:

不使用php-beast的性能:

配置项:


 beast.cache_size = size
 beast.log_file = "path_to_log"
 beast.enable = On
 beast.encrypt_handler = "des-algo"

支持的模块有:

 1. AES
 2. DES
 3. Base64

通过测试环境:


 Nginx + Fastcgi + (PHP-5.2.x ~ PHP-5.6.x)

注意

如果出现502错误,一般是由于GCC版本太低导致,请先升级GCC再安装本模块。

怎么加密项目

安装完 php-beast 后可以使用 tools 目录下的 encode_files.php 来加密你的项目。使用 encode_files.php 之前先修改 tools 目录下的 configure.ini 文件,如下:

; source path
src_path = ""

; destination path
dst_path = ""

; expire time
expire = ""

src_path 是要加密项目的路径,dst_path 是保存加密后项目的路径,expire 是设置项目可使用的时间 (expire 的格式是:YYYY-mm-dd HH:ii:ss)。 修改完 configure.ini 文件后就可以使用命令 php encode_files.php 开始加密项目。


制定自己的php-beast

php-beast 有多个地方可以定制的,以下一一列出:

1. 使用 header.c 文件可以修改 php-beast 加密后的文件头结构,这样网上的解密软件就不能认识我们的加密文件,就不能进行解密,增加加密的安全性。

2. php-beast 提供只能在指定的机器上运行的功能。要使用此功能可以在 networkcards.c 文件添加能够运行机器的网卡号,例如:

char *allow_networkcards[] = {
	"fa:16:3e:08:88:01",
    NULL,
};

这样设置之后,php-beast 扩展就只能在 fa:16:3e:08:88:01 这台机器上运行。另外要注意的是,由于有些机器网卡名可能不一样,所以如果你的网卡名不是 eth0 的话,可以在 php.ini 中添加配置项: beast.networkcard = "xxx" 其中 xxx 就是你的网卡名,也可以配置多张网卡,如:beast.networkcard = "eth0,eth1,eth2"

3. 使用 php-beast 时最好不要使用默认的加密key,因为扩展是开源的,如果使用默认加密key的话,很容易被人发现。所以最好编译的时候修改加密的key,aes模块 可以在 aes_algo_handler.c 文件修改,而 des模块 可以在 des_algo_handler.c 文件修改。


作者: liexusong(280259971@qq.com)。

my book:《PHP核心技术与最佳实践此书有详细的PHP扩展编写教程

如果本项目能够帮到你的话请支持一下:

支付宝:

微信:


About

PHP source code encrypt module (PHP源码加密模块)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 96.3%
  • M4 2.4%
  • Other 1.3%