Giter Club home page Giter Club logo

php-beast's Introduction

        ____  __  ______     ____  _________   ___________
       / __ \/ / / / __ \   / __ )/ ____/   | / ___/_  __/
      / /_/ / /_/ / /_/ /  / __  / __/ / /| | \__ \ / /
     / ____/ __  / ____/  / /_/ / /___/ ___ |___/ // /
    /_/   /_/ /_/_/      /_____/_____/_/  |_/____//_/

贡献者名字:
@imaben (windows版本提供者)  https://github.com/imaben
@pinguo-niulingyun (PHP7版本提供者) https://github.com/pinguo-niulingyun

QQ交流群:239243332

Windows DLL:下载地址

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.log_user = "user"
 beast.log_level = "debug"
 beast.enable = On

beast.log_level支持参数:

 1. DEBUG
 2. NOTICE
 3. ERROR

支持的模块有:

 1. AES
 2. DES
 3. Base64

通过测试环境:


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

怎么加密项目

加密方案1

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

; source path
src_path = ""

; destination path
dst_path = ""

; expire time
expire = ""

; encrypt type (selection: DES, AES, BASE64)
encrypt_type = "DES"

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

加密方案2

使用beast_encode_file()函数加密文件,函数原型如下:
beast_encode_file(string $input_file, string $output_file, int expire_timestamp, int encrypt_type)

1. $input_file: 要加密的文件
2. $output_file: 输出的加密文件路径
3. $expire_timestamp: 文件过期时间戳
4. $encrypt_type: 加密使用的算法(支持:BEAST_ENCRYPT_TYPE_DES、BEAST_ENCRYPT_TYPE_AES)

制定自己的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 文件修改。


开启debug模式

可以在configure时加上 --enable-beast-debug 选项来开启debug模式。开启debug模式后需要在php.ini配置文件中加入配置项:beast.debug_pathbeast.debug_modebeast.debug_mode 用于指定是否使用debug模式,而 beast.debug_path 用于输出解密后的php脚本源码。这样就可以在 beast.debug_path 目录中看到php-beast解密后的源代码,可以方便知道扩展解密是否正确。

开启禁止执行未加密的脚本

可以在configure时加上 --enable-execute-normal-script=off 选项来禁止执行未加密的PHP脚本。


函数列表

1. beast_encode_file(): 用于加密一个文件

2. beast_avail_cache(): 获取可以缓存大小

3. beast_support_filesize(): 获取beast支持的最大可加密文件大小

4. beast_file_expire(): 获取一个文件的过期时间

5. beast_clean_cache(): 清空beast的所有缓存(如果有文件更新, 可以使用此函数清空缓存)


常见问题

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

2. Windows:IIS环境下FastCGI进程异常退出:尝试将IIS的运行用户从ApplicationPoolIdentity改为LocalSystem


我们的公众号


php-beast's People

Contributors

citizen233 avatar imaben avatar liexusong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-beast's Issues

对于使用方法有些疑惑,可能导致代码轻易被破解。。

我在查看您的代码时发现解密之行是通过劫持 zend_compile_file 方法,在其执行之前用明文代码替换了原本的密文字符串。为了验证这个猜测,我在compile_file(compile_file位于zend_language_scanner.c,是zend_compile_file的实体方法)这个方法中加了几行代码用于输出测试文件:

ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSRMLS_DC)
{
  。。省略无关内容。。
	if (open_file_for_scanning(file_handle TSRMLS_CC)==FAILURE) {
  。。省略无关内容。。
		compilation_successful=0;
	} else {

// 此处为增加的代码
FILE *fh = fopen("/tmp/mytest.log", "ab+");
fprintf(fh, "filename: %s\n\n%s\n\n",file_handle->filename,file_handle->handle.stream.mmap.buf);
fclose(fh);
// 增加的代码结束

		init_op_array(op_array, ZEND_USER_FUNCTION, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
  。。省略无关内容。。
	return retval;
}

然后我重新编译php,使用以下命令生成加密文件:
/php56/bin/php /php-beast-master/tools/encode_file.php --oldfile test.php --newfile test2.php --encrypt DES --expire "2017-10-10 10:10:10"

查看test2.php已是加密的乱码了。

启动php-fpm,并访问一次test2.php。

然后 cat /tmp/mytest.log

得到结果为

filename: /website/userdata/site/xf.php56/public/test2.php

<?php
echo "test code"; 

确实是一开始的明文代码。

因此这个破解的方式并不需要得到加密插件的源代码或者key。

太轻易的破解让我感觉这个加密太水了。。又或者是我使用的方式不对?

使用beast_cache_status出错

在一个文件中调用beast_cache_status() 出错:
Fatal error: Call to undefined function beast_cache_status() in /...

php 5.4.14 使用不了,出现段错误。

php encrypt_project.php
Reading symbols for shared libraries ++++++++++++++++................................................ done
Reading symbols for shared libraries . done
Reading symbols for shared libraries ....................... done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x00000000019de590
0x0000000100f914fc in hash_lookup (htb=0x19de590, key=0x7fff5fbffcc4 "encrypt_project.php", retval=0x7fff5fbfe978) at hash.c:229
229 index = hash(key, strlen(key), 0) % tableSize[htb->size];

CodeIgniter框架下源码加密后找不到类

代码用的CI框架,加密models层或者controller层的代码后,报错 Class 'web\models\User_model' not found
是因为使用了namespace的缘故吗?有没有办法解决此问题?请教各位!

php encrypt_project.php 或者调用beast_encode_file()均出现段错误

[root@cloudstack php-beast-master]# php -f test.php
Segmentation fault (core dumped)
[root@cloudstack php-beast-master]# php -f encrypt_project.php
PHP Warning: mkdir(): No such file or directory in /root/php-beast-master/encrypt_project.php on line 13
[failed] failed to call `mkdir()' function
Segmentation fault (core dumped)

qq20131121150610

windows版本下会出现循环输出问题

PHP版本5.6,对应beast版本php 5.6.x vc11 x86 nts

如果代码里面有require或者命名空间使用语法use,则会出错。

例如:

<?php

echo '1234';

require __DIR__ . '/_release.inc.php';

?>

会循环输出1234

make出错

gcc版本: version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2.1)
php版本: php 5.6.13

错误报告:
In file included from /opt/downloads/php-beast-master/beast.c:37:0:
/usr/local/php/include/php/main/php_globals.h:30:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘int’
extern PHPAPI int core_globals_id;
^
In file included from /usr/local/php/include/php/Zend/zend_alloc.h:27:0,
from /usr/local/php/include/php/Zend/zend.h:252,
from /opt/downloads/php-beast-master/beast.c:34:
/opt/downloads/php-beast-master/beast.c: In function ‘filter_code_comments’:
/usr/local/php/include/php/Zend/../TSRM/TSRM.h:167:18: error: ‘tsrm_ls’ undeclared (first use in this function)
#define TSRMLS_C tsrm_ls
^
/opt/downloads/php-beast-master/beast.c:189:30: note: in expansion of macro ‘TSRMLS_C’
php_output_start_default(TSRMLS_C);
^
/usr/local/php/include/php/Zend/../TSRM/TSRM.h:167:18: note: each undeclared identifier is reported only once for each function it appears in
#define TSRMLS_C tsrm_ls
^
/opt/downloads/php-beast-master/beast.c:189:30: note: in expansion of macro ‘TSRMLS_C’
php_output_start_default(TSRMLS_C);
^
/opt/downloads/php-beast-master/beast.c:203:5: warning: implicit declaration of function ‘zend_strip’ [-Wimplicit-function-declaration]
zend_strip(TSRMLS_C);
^
In file included from /usr/local/php/include/php/main/php.h:398:0,
from /opt/downloads/php-beast-master/beast.c:44:
/opt/downloads/php-beast-master/beast.c: In function ‘encrypt_file’:
/usr/local/php/include/php/main/php_streams.h:298:72: warning: passing argument 2 of ‘_php_stream_write’ from incompatible pointer type [-Wincompatible-pointer-types]
#define php_stream_write(stream, buf, count) _php_stream_write(stream, (buf), (count) TSRMLS_CC)
^
/opt/downloads/php-beast-master/beast.c:293:5: note: in expansion of macro ‘php_stream_write’
php_stream_write(output_stream, &dumplen, INT_SIZE);
^
/usr/local/php/include/php/main/php_streams.h:296:15: note: expected ‘const char _’ but argument is of type ‘int *’
PHPAPI size_t _php_stream_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC);
^
/usr/local/php/include/php/main/php_streams.h:298:72: warning: passing argument 2 of ‘_php_stream_write’ from incompatible pointer type [-Wincompatible-pointer-types]
#define php_stream_write(stream, buf, count) _php_stream_write(stream, (buf), (count) TSRMLS_CC)
^
/opt/downloads/php-beast-master/beast.c:294:5: note: in expansion of macro ‘php_stream_write’
php_stream_write(output_stream, &expireval, INT_SIZE);
^
/usr/local/php/include/php/main/php_streams.h:296:15: note: expected ‘const char *’ but argument is of type ‘int *’
PHPAPI size_t php_stream_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC);
^
/opt/downloads/php-beast-master/beast.c: In function ‘segmentfault_deadlock_fix’:
/opt/downloads/php-beast-master/beast.c:679:12: warning: implicit declaration of function ‘backtrace’ [-Wimplicit-function-declaration]
size = backtrace(array, 10);
^
/opt/downloads/php-beast-master/beast.c:680:12: warning: implicit declaration of function ‘backtrace_symbols’ [-Wimplicit-function-declaration]
info = backtrace_symbols(array, size);
^
/opt/downloads/php-beast-master/beast.c:680:10: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
info = backtrace_symbols(array, size);
^
/opt/downloads/php-beast-master/beast.c: In function ‘zif_beast_encode_file’:
/opt/downloads/php-beast-master/beast.c:941:50: warning: passing argument 2 of ‘php_parse_date’ from incompatible pointer type [-Wincompatible-pointer-types]
expire = php_parse_date(expire_datetime, &now);
^
In file included from /opt/downloads/php-beast-master/beast.c:48:0:
/usr/local/php/include/php/ext/date/php_date.h:185:20: note: expected ‘long int *’ but argument is of type ‘int *’
PHPAPI signed long php_parse_date(char *string, signed long *now);
^
/opt/downloads/php-beast-master/beast.c: In function ‘validate_networkcard’:
/opt/downloads/php-beast-master/beast.c:741:9: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
fgets(buf, 128, fp);
^
Makefile:180: recipe for target 'beast.lo' failed
make: *
* [beast.lo] Error 1

undefined function beast_encode_file()

`
~/Project/php-beast-master/tools$ sudo php encode_files.php
PHP Notice: Use of undefined constant BEAST_ENCRYPT_TYPE_DES - assumed 'BEAST_ENCRYPT_TYPE_DES' in /home/ninja/Project/php-beast-master/tools/encode_files.php on line 127
Source code path: /var/www/www/web_werouter/app
Destination code path: /home/ninja/Project/
Expire time: 2017-03-09 10:40:00
------------- start process -------------
PHP Fatal error: Uncaught Error: Call to undefined function beast_encode_file() in /home/ninja/Project/php-beast-master/tools/encode_files.php:76
Stack trace:
#0 /home/ninja/Project/php-beast-master/tools/encode_files.php(69): encrypt_directory('/var/www/www/we...', '/home/ninja/Pro...', 1489027200, 'BEAST_ENCRYPT_T...')
#1 /home/ninja/Project/php-beast-master/tools/encode_files.php(69): encrypt_directory('/var/www/www/we...', '/home/ninja/Pro...', 1489027200, 'BEAST_ENCRYPT_T...')
#2 /home/ninja/Project/php-beast-master/tools/encode_files.php(153): encrypt_directory('/var/www/www/we...', '/home/ninja/Pro...', 1489027200, 'BEAST_ENCRYPT_T...')
#3 {main}
thrown in /home/ninja/Project/php-beast-master/tools/encode_files.php on line 76

`
我的环境是虚拟机运行的ubuntu16.10 64bit, php7.0, 加密的时候提示找不到这个函数,可是编译都正常啊

php7编译错误

/root/lnmp/php-beast-master/beast.c: In function ‘zif_beast_file_expire’:
/root/lnmp/php-beast-master/beast.c:961: warning: assignment from incompatible pointer type
/root/lnmp/php-beast-master/beast.c:962:32: error: macro "RETURN_STRING" passed 2 arguments, but takes just 1
/root/lnmp/php-beast-master/beast.c:962: error: ‘RETURN_STRING’ undeclared (first use in this function)
/root/lnmp/php-beast-master/beast.c:964:47: error: macro "RETURN_STRING" passed 2 arguments, but takes just 1

php7 make时候出现错误, php5.6没有问题

beast_cache_hash会溢出

beast_cache_hash计算使用key->device * 3 + key->inode * 7,且使用int保存并用作index计算。
st_ino的定义是不小于uint:

Data Type: ino_t
This is an unsigned integer type used to represent file serial numbers. (In Unix jargon, these are sometimes called inode numbers.) In the GNU C Library, this type is no narrower than unsigned int.

因此存在溢出可能。
在实际使用docker部署的情况中,出现了st_ino比较大的情况,导致sf。

[10 Aug 17:56:49] ERROR: st_dev: 64769, st_ino: 1611759572, hashval: -1602390577

Unexpected character in input: '' (ASCII=28) state=0

Processed encrypt files [44%] - 100%PHP Warning: Unexpected character in input: '' (ASCII=28) state=0 in /usr/local/php-beast-master/tools/encode_dir.php on line 79
脚本我只改了个名字,改了下从命令行读取参数。加密有些项目,报这个错误,是什么情况,有中文名?我不懂PHP,大神关注下?

感谢作者

无私的奉献,给许多人提供了帮助。php-beast 我正在研究中。

模块有点不稳定

加载模块后,多次刷新访问未加密的网站都会导致server假死,本来想贴日志上来的,设了日志路径,设了所有可写,发现没有日志文件,奇怪。多次访问单个代码量小的加密或未加密文件,比如

<?php
    phpinfo();
?>

这样是没问题的,访问未加密的稍大的网站就会出现假死,希望能解决一下。

make 报错

In file included from /usr/local/php-beast-master/beast.c:37:0:
/usr/local/php-7.1.3/include/php/main/php_globals.h:30:15: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘_attribute’ before ‘int’
extern PHPAPI int core_globals_id;
^
/usr/local/php-beast-master/beast.c: 在函数‘segmentfault_deadlock_fix’中:
/usr/local/php-beast-master/beast.c:928:10: 警告:赋值时将整数赋给指针,未作类型转换 [默认启用]
info = backtrace_symbols(array, (int)size);
^
/usr/local/php-beast-master/beast.c: 在函数‘zif_beast_file_expire’中:
/usr/local/php-beast-master/beast.c:1308:16: 警告:从不兼容的指针类型赋值 [默认启用]
string = php_format_date(format, strlen(format), expire, 1 TSRMLS_CC);

make: *** [beast.lo] 错误 1

make 的时候报错
/usr/local/webserver/php/include/php/main/php_globals.h:30: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘int’
/home/php-beast-master/beast.c: 在函数‘filter_code_comments’中:
/home/php-beast-master/beast.c:151: 错误:‘tsrm_ls’未声明(在此函数内第一次使用)
/home/php-beast-master/beast.c:151: 错误:(即使在一个函数内多次出现,每个未声明的标识符在其
/home/php-beast-master/beast.c:151: 错误:所在的函数内也只报告一次。)
/home/php-beast-master/beast.c: 在函数‘segmentfault_deadlock_fix’中:
/home/php-beast-master/beast.c:651: 警告:赋值时将整数赋给指针,未作类型转换
make: *** [beast.lo] 错误 1

php7.1.5 nts make warning, gcc 4.8.5 20150623

/root/softwares/php-beast/beast.c: In function 'segmentfault_deadlock_fix':
/root/softwares/php-beast/beast.c:1058:10: warning: assignment makes pointer from integer without a cast [enabled by default]
info = backtrace_symbols(array, (int)size);
^
/root/softwares/php-beast/beast.c: In function 'zif_beast_file_expire':
/root/softwares/php-beast/beast.c:1438:16: warning: assignment from incompatible pointer type [enabled by default]
string = php_format_date(format, strlen(format), expire, 1 TSRMLS_CC);
^

是不是不能用于框架的加密?

比如yii框架,只加密个controller是可以的,再加密一个model,就不行了,要么找不到相应的class,要么是乱码,就是说加密的controller调用加密的model,就不行了。
加密的文件都是一次性加密,然后部分拷贝使用的。
不知道是怎么回事?

Ubuntu16.04 LTS ,PHP7 编译出错

root@st:/data/soft/php-beast# make
/bin/bash /data/soft/php-beast/libtool --mode=compile cc -I. -I/data/soft/php-beast -DPHP_ATOM_INC -I/data/soft/php-beast/include -I/data/soft/php-beast/main -I/data/soft/php-beast -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /data/soft/php-beast/beast.c -o beast.lo
libtool: compile: cc -I. -I/data/soft/php-beast -DPHP_ATOM_INC -I/data/soft/php-beast/include -I/data/soft/php-beast/main -I/data/soft/php-beast -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /data/soft/php-beast/beast.c -fPIC -DPIC -o .libs/beast.o
/data/soft/php-beast/beast.c: In function 'filter_code_comments':
/data/soft/php-beast/beast.c:165:5: warning: implicit declaration of function 'zend_strip' [-Wimplicit-function-declaration]
zend_strip(TSRMLS_C);
^
/data/soft/php-beast/beast.c: In function 'encrypt_file':
/data/soft/php-beast/beast.c:240:28: error: request for member 'len' in something not a structure or union
inlen = codes.value.str.len;
^
/data/soft/php-beast/beast.c:241:28: error: request for member 'val' in something not a structure or union
inbuf = codes.value.str.val;
^
In file included from /usr/include/php/20151012/main/php.h:389:0,
from /data/soft/php-beast/beast.c:44:
/data/soft/php-beast/beast.c:250:31: error: 'ENFORCE_SAFE_MODE' undeclared (first use in this function)
ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL);
^
/usr/include/php/20151012/main/php_streams.h:568:107: note: in definition of macro 'php_stream_open_wrapper'
#define php_stream_open_wrapper(path, mode, options, opened) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), NULL STREAMS_CC)
^
/data/soft/php-beast/beast.c:250:31: note: each undeclared identifier is reported only once for each function it appears in
ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL);
^
/usr/include/php/20151012/main/php_streams.h:568:107: note: in definition of macro 'php_stream_open_wrapper'
#define php_stream_open_wrapper(path, mode, options, opened) php_stream_open_wrapper_ex((path), (mode), (options), (opened), NULL STREAMS_CC)
^
/data/soft/php-beast/beast.c: In function 'cgi_compile_file':
/data/soft/php-beast/beast.c:443:37: warning: passing argument 2 of 'zend_fopen' from incompatible pointer type [-Wincompatible-pointer-types]
filep = zend_fopen(h->filename, &opened_path TSRMLS_CC);
^
/data/soft/php-beast/beast.c:443:37: note: expected 'zend_string ** {aka struct zend_string *}' but argument is of type 'char *
'
/data/soft/php-beast/beast.c: In function 'php_beast_cache_size':
/data/soft/php-beast/beast.c:539:9: error: 'new_value_length' undeclared (first use in this function)
if (new_value_length == 0) {
^
/data/soft/php-beast/beast.c:543:16: warning: passing argument 1 of 'beast_atoi' from incompatible pointer type [-Wincompatible-pointer-types]
beast_atoi(new_value, &max_cache_size, &len);
^
/data/soft/php-beast/beast.c:503:6: note: expected 'const char *' but argument is of type 'zend_string * {aka struct _zend_string *}'
void beast_atoi(const char *str, int *ret, int *len)
^
/data/soft/php-beast/beast.c:546:17: error: switch quantity not an integer
switch (new_value[len]) {
^
/data/soft/php-beast/beast.c: In function 'php_beast_log_file':
/data/soft/php-beast/beast.c:572:9: error: 'new_value_length' undeclared (first use in this function)
if (new_value_length == 0) {
^
In file included from /usr/include/string.h:630:0,
from /usr/include/php/20151012/main/../main/php_config.h:2517,
from /usr/include/php/20151012/Zend/zend_config.h:1,
from /usr/include/php/20151012/Zend/zend_portability.h:48,
from /usr/include/php/20151012/Zend/zend_types.h:27,
from /usr/include/php/20151012/Zend/zend.h:31,
from /data/soft/php-beast/beast.c:34:
/data/soft/php-beast/beast.c:576:29: warning: passing argument 1 of 'strlen' from incompatible pointer type [-Wincompatible-pointer-types]
beast_log_file = strdup(new_value);
^
In file included from /usr/include/php/20151012/main/../main/php_config.h:2517:0,
from /usr/include/php/20151012/Zend/zend_config.h:1,
from /usr/include/php/20151012/Zend/zend_portability.h:48,
from /usr/include/php/20151012/Zend/zend_types.h:27,
from /usr/include/php/20151012/Zend/zend.h:31,
from /data/soft/php-beast/beast.c:34:
/usr/include/string.h:394:15: note: expected 'const char *' but argument is of type 'zend_string * {aka struct _zend_string *}'
extern size_t strlen (const char *__s)
^
In file included from /usr/include/string.h:630:0,
from /usr/include/php/20151012/main/../main/php_config.h:2517,
from /usr/include/php/20151012/Zend/zend_config.h:1,
from /usr/include/php/20151012/Zend/zend_portability.h:48,
from /usr/include/php/20151012/Zend/zend_types.h:27,
from /usr/include/php/20151012/Zend/zend.h:31,
from /data/soft/php-beast/beast.c:34:
/data/soft/php-beast/beast.c:576:29: warning: passing argument 1 of '__strdup' from incompatible pointer type [-Wincompatible-pointer-types]
beast_log_file = strdup(new_value);
^
/usr/include/x86_64-linux-gnu/bits/string2.h:1278:14: note: expected 'const char *' but argument is of type 'zend_string * {aka struct _zend_string *}'
extern char *__strdup (const char *__string) __THROW attribute_malloc;
^
/data/soft/php-beast/beast.c: In function 'php_beast_enable':
/data/soft/php-beast/beast.c:587:9: error: 'new_value_length' undeclared (first use in this function)
if (new_value_length == 0) {
^
/data/soft/php-beast/beast.c:591:21: warning: passing argument 1 of 'strcasecmp' from incompatible pointer type [-Wincompatible-pointer-types]
if (!strcasecmp(new_value, "on") || !strcmp(new_value, "1")) {
^
In file included from /usr/include/php/20151012/main/../main/php_config.h:2517:0,
from /usr/include/php/20151012/Zend/zend_config.h:1,
from /usr/include/php/20151012/Zend/zend_portability.h:48,
from /usr/include/php/20151012/Zend/zend_types.h:27,
from /usr/include/php/20151012/Zend/zend.h:31,
from /data/soft/php-beast/beast.c:34:
/usr/include/string.h:529:12: note: expected 'const char _' but argument is of type 'zend_string * {aka struct _zend_string *}'
extern int strcasecmp (const char *__s1, const char *__s2)
^
In file included from /usr/include/string.h:630:0,
from /usr/include/php/20151012/main/../main/php_config.h:2517,
from /usr/include/php/20151012/Zend/zend_config.h:1,
from /usr/include/php/20151012/Zend/zend_portability.h:48,
from /usr/include/php/20151012/Zend/zend_types.h:27,
from /usr/include/php/20151012/Zend/zend.h:31,
from /data/soft/php-beast/beast.c:34:
/data/soft/php-beast/beast.c:591:49: warning: passing argument 1 of '__builtin_strlen' from incompatible pointer type [-Wincompatible-pointer-types]
if (!strcasecmp(new_value, "on") || !strcmp(new_value, "1")) {
^
/data/soft/php-beast/beast.c:591:49: note: expected 'const char *' but argument is of type 'zend_string * {aka struct _zend_string *}'
/data/soft/php-beast/beast.c:591:49: warning: passing argument 1 of '__builtin_strcmp' from incompatible pointer type [-Wincompatible-pointer-types]
if (!strcasecmp(new_value, "on") || !strcmp(new_value, "1")) {
^
/data/soft/php-beast/beast.c:591:49: note: expected 'const char *' but argument is of type 'zend_string * {aka struct _zend_string *}'
/data/soft/php-beast/beast.c:591:49: warning: passing argument 1 of '__builtin_strlen' from incompatible pointer type [-Wincompatible-pointer-types]
if (!strcasecmp(new_value, "on") || !strcmp(new_value, "1")) {
^
/data/soft/php-beast/beast.c:591:49: note: expected 'const char *' but argument is of type 'zend_string * {aka struct _zend_string *}'
/data/soft/php-beast/beast.c:591:49: warning: passing argument 1 of '__builtin_strcmp' from incompatible pointer type [-Wincompatible-pointer-types]
if (!strcasecmp(new_value, "on") || !strcmp(new_value, "1")) {
^
/data/soft/php-beast/beast.c:591:49: note: expected 'const char *' but argument is of type 'zend_string * {aka struct _zend_string *}'
/data/soft/php-beast/beast.c:591:49: warning: passing argument 1 of '__builtin_strcmp' from incompatible pointer type [-Wincompatible-pointer-types]
if (!strcasecmp(new_value, "on") || !strcmp(new_value, "1")) {
^
/data/soft/php-beast/beast.c:591:49: note: expected 'const char *' but argument is of type 'zend_string * {aka struct _zend_string *}'
/data/soft/php-beast/beast.c:591:49: warning: passing argument 1 of '__builtin_strcmp' from incompatible pointer type [-Wincompatible-pointer-types]
if (!strcasecmp(new_value, "on") || !strcmp(new_value, "1")) {
^
/data/soft/php-beast/beast.c:591:49: note: expected 'const char *' but argument is of type 'zend_string * {aka struct _zend_string *}'
/data/soft/php-beast/beast.c: In function 'php_beast_set_networkcard':
/data/soft/php-beast/beast.c:603:9: error: 'new_value_length' undeclared (first use in this function)
if (new_value_length == 0) {
^
In file included from /usr/include/string.h:630:0,
from /usr/include/php/20151012/main/../main/php_config.h:2517,
from /usr/include/php/20151012/Zend/zend_config.h:1,
from /usr/include/php/20151012/Zend/zend_portability.h:48,
from /usr/include/php/20151012/Zend/zend_types.h:27,
from /usr/include/php/20151012/Zend/zend.h:31,
from /data/soft/php-beast/beast.c:34:
/data/soft/php-beast/beast.c:607:32: warning: passing argument 1 of 'strlen' from incompatible pointer type [-Wincompatible-pointer-types]
local_networkcard = strdup(new_value);
^
In file included from /usr/include/php/20151012/main/../main/php_config.h:2517:0,
from /usr/include/php/20151012/Zend/zend_config.h:1,
from /usr/include/php/20151012/Zend/zend_portability.h:48,
from /usr/include/php/20151012/Zend/zend_types.h:27,
from /usr/include/php/20151012/Zend/zend.h:31,
from /data/soft/php-beast/beast.c:34:
/usr/include/string.h:394:15: note: expected 'const char *' but argument is of type 'zend_string * {aka struct _zend_string *}'
extern size_t strlen (const char *__s)
^
In file included from /usr/include/string.h:630:0,
from /usr/include/php/20151012/main/../main/php_config.h:2517,
from /usr/include/php/20151012/Zend/zend_config.h:1,
from /usr/include/php/20151012/Zend/zend_portability.h:48,
from /usr/include/php/20151012/Zend/zend_types.h:27,
from /usr/include/php/20151012/Zend/zend.h:31,
from /data/soft/php-beast/beast.c:34:
/data/soft/php-beast/beast.c:607:32: warning: passing argument 1 of '__strdup' from incompatible pointer type [-Wincompatible-pointer-types]
local_networkcard = strdup(new_value);
^
/usr/include/x86_64-linux-gnu/bits/string2.h:1278:14: note: expected 'const char *' but argument is of type 'zend_string * {aka struct zend_string *}'
extern char *__strdup (const char *__string) __THROW attribute_malloc;
^
/data/soft/php-beast/beast.c: In function 'segmentfault_deadlock_fix':
/data/soft/php-beast/beast.c:650:12: warning: implicit declaration of function 'backtrace' [-Wimplicit-function-declaration]
size = backtrace(array, 10);
^
/data/soft/php-beast/beast.c:651:12: warning: implicit declaration of function 'backtrace_symbols' [-Wimplicit-function-declaration]
info = backtrace_symbols(array, (int)size);
^
/data/soft/php-beast/beast.c:651:10: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
info = backtrace_symbols(array, (int)size);
^
/data/soft/php-beast/beast.c: In function 'zif_beast_file_expire':
/data/soft/php-beast/beast.c:910:16: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
string = php_format_date(format, strlen(format), expire, 1 TSRMLS_CC);
^
/data/soft/php-beast/beast.c:911:32: error: macro "RETURN_STRING" passed 2 arguments, but takes just 1
RETURN_STRING(string, 0);
^
/data/soft/php-beast/beast.c:911:9: error: 'RETURN_STRING' undeclared (first use in this function)
RETURN_STRING(string, 0);
^
/data/soft/php-beast/beast.c:913:47: error: macro "RETURN_STRING" passed 2 arguments, but takes just 1
RETURN_STRING("0000-00-00 00:00:00", 1);
^
/data/soft/php-beast/beast.c: In function 'validate_networkcard':
/data/soft/php-beast/beast.c:712:9: warning: ignoring return value of 'fgets', declared with attribute warn_unused_result -Wunused-resultfgets(buf, 128, fp);
^
Makefile:193: recipe for target 'beast.lo' failed
make: *
* [beast.lo] Error 1

能告诉我缺少什么吗?

为什么设置过期时间不起作用

部署了两台服务器,
每台服务器编译时设置了不同的网卡物理地址绑定,
结果发现在不同的服务器下encode的文件可以通用,而且设置过期时间为2015年的某一天(服务器有时间同步,为当前20161215),结果加密处理后也可以正常运行。

求指导

Unexpected character in input: '' (ASCII=28) state=0

Processed encrypt files [44%] - 100%PHP Warning: Unexpected character in input: '' (ASCII=28) state=0 in /usr/local/php-beast-master/tools/encode_dir.php on line 79
脚本我只改了个名字,改了下从命令行读取参数。加密有些项目,报这个错误,是什么情况,有中文名?我不懂PHP,大神关注下?

加密大文件有问题

超过90KB的PHP 文件都提示加密失败 DES AES都试过 用encode_file.php和encode_files.php 都不行 提示Encrypt file failure!

make 时候报错

php-5.2.17/include/php/main/php_globals.h:153: error: expected specifier-qualifier-list before ‘error_handling_t’

包含失败

a.php require b.php, b.php require c.php
这种情况下会失败。。。

将b.php换回明文源码,才能搞定。

beast的缓存如何清除

beast可以设置缓存大小提升效率,想问下,缓存过期时间如何设置?如何清除缓存?

关于expire过期时间无效的问题

你好,
我在配置安装好php-beast之后,使用了tools目录下的configure.ini配置了expire过期时间,重新加密了文件,问题是,当前时间超过了expire时间,加密的文件依然可以运行。首先我怀疑是自己PHP的时区设置问题,在加密文件打印出了,当前时间,发现时区是没错的,也尝试过把expire设置为时间戳,也没有用。我找到你的tools目录下的encode_files.php的75行,发现是这里调用扩展的beast_encode_file函数,然后查看了,源文件的beast.c文件,发现这个函数可以设置一个expire过期时间,我在encode_files.php的75行加上了expire过期时间(时间戳的格式)beast_encode_file($path, $new_path,$expire),
再次加密文件,运行之后依然没有效果。
请问,是我配置的地方有问题还是缺少响应的配置。

建议编译出的文件名自动附加网卡部分字符和过期日期

由于产品最终可能部署到多台机器上去,
编译出的文件多了就容易在机器匹配上出错。
因此建议在用不同的网卡和过期日期信息编译时,在编译出的文件上附加上这些信息,
比如beast_xxxxxx_20991231.so「网卡取后6位」

在服务器配置再修改为beast.so或者只直接用extension=beast_xxxxxx_20991231.so配置

PHP Fatal error: Unable to start beast module in Unknown on line 0

在进行加密后,项目正常运行,但不知什么情况下出现了这个错误!

PHP Fatal error: Unable to start beast module in Unknown on line 0.

执行外部命令php失效,重启php-fpm也是这个错误导致无法启动。

解决方法只能是取消这个模块或者重启服务器.这个有点...

php5.4.16+apache2+osx下加密成功,但解密乱码

我的环境是php5.4.16+apache2+osx,beast_encode_file和encrypt_project.php加密方式均尝试,无报错,也确认成功加载了beast1.3扩展,但解密乱码(文件内容简单phpinfo),大大,求解。。

PHP7版本会影响部分性能(细微)

我发现在使用PHP7版本以后,性能有所下降,程序处理时间增加了10%~20%。不知道这算不算是一个bug。
PHP安装程序选用了lnmp一键安装包,来自lnmp.org

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.