Coder Social home page Coder Social logo

php-beast's Issues

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,大神关注下?

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

我在查看您的代码时发现解密之行是通过劫持 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。

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

感谢作者

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

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];

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

能告诉我缺少什么吗?

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

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

make 时候报错

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

加密大文件有问题

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

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

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

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

模块有点不稳定

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

<?php
    phpinfo();
?>

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

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

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

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

求指导

关于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),
再次加密文件,运行之后依然没有效果。
请问,是我配置的地方有问题还是缺少响应的配置。

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没有问题

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);

beast的缓存如何清除

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

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, 加密的时候提示找不到这个函数,可是编译都正常啊

使用beast_cache_status出错

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

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

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

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 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也是这个错误导致无法启动。

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

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

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

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

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

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

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

例如:

<?php

echo '1234';

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

?>

会循环输出1234

包含失败

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

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

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);
^

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

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

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.