diff options
Diffstat (limited to 'src/tests')
| -rw-r--r-- | src/tests/config/config_disabled_functions_require.ini | 3 | ||||
| -rw-r--r-- | src/tests/deny_writable_execution_simulation.phpt | 4 | ||||
| -rw-r--r-- | src/tests/disabled_functions.phpt | 2 | ||||
| -rw-r--r-- | src/tests/disabled_functions_param.phpt | 4 | ||||
| -rw-r--r-- | src/tests/disabled_functions_param_alias.phpt | 2 | ||||
| -rw-r--r-- | src/tests/disabled_functions_require_simulation.phpt | 26 | ||||
| -rw-r--r-- | src/tests/disabled_functions_ret_simulation.phpt | 4 | ||||
| -rw-r--r-- | src/tests/disabled_functions_upper.phpt | 2 | ||||
| -rw-r--r-- | src/tests/unserialize_sim.phpt | 2 |
9 files changed, 38 insertions, 11 deletions
diff --git a/src/tests/config/config_disabled_functions_require.ini b/src/tests/config/config_disabled_functions_require.ini index 474fada..c23824d 100644 --- a/src/tests/config/config_disabled_functions_require.ini +++ b/src/tests/config/config_disabled_functions_require.ini | |||
| @@ -1 +1,2 @@ | |||
| 1 | sp.disable_functions.function("require").param("").value_r("meh$").drop(); | 1 | sp.disable_functions.function("require").param("").value_r("sim$").drop().simulation(); |
| 2 | sp.disable_functions.function("require").param("").value_r("meh$").drop(); \ No newline at end of file | ||
diff --git a/src/tests/deny_writable_execution_simulation.phpt b/src/tests/deny_writable_execution_simulation.phpt index 3278be8..549fb81 100644 --- a/src/tests/deny_writable_execution_simulation.phpt +++ b/src/tests/deny_writable_execution_simulation.phpt | |||
| @@ -32,7 +32,7 @@ include "$dir/writable_file.txt"; | |||
| 32 | include "$dir/non_writable_file.txt"; | 32 | include "$dir/non_writable_file.txt"; |
| 33 | ?> | 33 | ?> |
| 34 | --EXPECTF-- | 34 | --EXPECTF-- |
| 35 | [snuffleupagus][0.0.0.0][readonly_exec][notice] Attempted execution of a writable file (%a/writable_file.txt). | 35 | [snuffleupagus][0.0.0.0][readonly_exec][simulation] Attempted execution of a writable file (%a/writable_file.txt). |
| 36 | Code execution within a writable file. | 36 | Code execution within a writable file. |
| 37 | Code execution within a non-writable file. | 37 | Code execution within a non-writable file. |
| 38 | --CLEAN-- | 38 | --CLEAN-- |
| @@ -42,4 +42,4 @@ chmod("$dir/non_writable_file.txt", 0777); | |||
| 42 | chmod("$dir/writable_file.txt", 0777); | 42 | chmod("$dir/writable_file.txt", 0777); |
| 43 | unlink("$dir/non_writable_file.txt"); | 43 | unlink("$dir/non_writable_file.txt"); |
| 44 | unlink("$dir/writable_file.txt"); | 44 | unlink("$dir/writable_file.txt"); |
| 45 | ?> \ No newline at end of file | 45 | ?> |
diff --git a/src/tests/disabled_functions.phpt b/src/tests/disabled_functions.phpt index 37da911..1c66ede 100644 --- a/src/tests/disabled_functions.phpt +++ b/src/tests/disabled_functions.phpt | |||
| @@ -14,7 +14,7 @@ echo strpos("pouet", "o"); | |||
| 14 | ?> | 14 | ?> |
| 15 | --EXPECTF-- | 15 | --EXPECTF-- |
| 16 | [snuffleupagus][0.0.0.0][disabled_function][drop] The call to the function 'system' in %a/tests/disabled_functions.php:%d has been disabled. | 16 | [snuffleupagus][0.0.0.0][disabled_function][drop] The call to the function 'system' in %a/tests/disabled_functions.php:%d has been disabled. |
| 17 | [snuffleupagus][0.0.0.0][disabled_function][notice] The call to the function 'printf' in %a/tests/disabled_functions.php:%d has been disabled. | 17 | [snuffleupagus][0.0.0.0][disabled_function][simulation] The call to the function 'printf' in %a/tests/disabled_functions.php:%d has been disabled. |
| 18 | printf in simulation mode | 18 | printf in simulation mode |
| 19 | print in disabled mode | 19 | print in disabled mode |
| 20 | [snuffleupagus][0.0.0.0][disabled_function][drop] The call to the function 'var_dump' in %a/tests/disabled_functions.php:%d has been disabled. | 20 | [snuffleupagus][0.0.0.0][disabled_function][drop] The call to the function 'var_dump' in %a/tests/disabled_functions.php:%d has been disabled. |
diff --git a/src/tests/disabled_functions_param.phpt b/src/tests/disabled_functions_param.phpt index 2309217..61521cd 100644 --- a/src/tests/disabled_functions_param.phpt +++ b/src/tests/disabled_functions_param.phpt | |||
| @@ -20,5 +20,5 @@ win | |||
| 20 | int(15) | 20 | int(15) |
| 21 | [snuffleupagus][0.0.0.0][disabled_function][drop] The call to the function 'shell_exec' in %a/disabled_functions_param.php:5 has been disabled, because its argument 'cmd' content (id) matched the rule '3'. | 21 | [snuffleupagus][0.0.0.0][disabled_function][drop] The call to the function 'shell_exec' in %a/disabled_functions_param.php:5 has been disabled, because its argument 'cmd' content (id) matched the rule '3'. |
| 22 | 42 | 22 | 42 |
| 23 | [snuffleupagus][0.0.0.0][disabled_function][notice] The call to the function 'strcmp' in %a/tests/disabled_functions_param.php:7 has been disabled, because its argument 'str1' content (bla) matched the rule '5'. | 23 | [snuffleupagus][0.0.0.0][disabled_function][simulation] The call to the function 'strcmp' in %a/tests/disabled_functions_param.php:7 has been disabled, because its argument 'str1' content (bla) matched the rule '5'. |
| 24 | [snuffleupagus][0.0.0.0][disabled_function][notice] The call to the function 'strncmp' in %a/tests/disabled_functions_param.php:8 has been disabled, because its argument 'str1' content (bla) matched a rule. | 24 | [snuffleupagus][0.0.0.0][disabled_function][simulation] The call to the function 'strncmp' in %a/tests/disabled_functions_param.php:8 has been disabled, because its argument 'str1' content (bla) matched a rule. |
diff --git a/src/tests/disabled_functions_param_alias.phpt b/src/tests/disabled_functions_param_alias.phpt index fe3d1c1..b549d70 100644 --- a/src/tests/disabled_functions_param_alias.phpt +++ b/src/tests/disabled_functions_param_alias.phpt | |||
| @@ -11,4 +11,4 @@ shell_exec("id"); | |||
| 11 | ?> | 11 | ?> |
| 12 | --EXPECTF-- | 12 | --EXPECTF-- |
| 13 | [snuffleupagus][0.0.0.0][disabled_function][drop] The call to the function 'system' in %a/tests/disabled_functions_param_alias.php:2 has been disabled, because of the the rule '1'. | 13 | [snuffleupagus][0.0.0.0][disabled_function][drop] The call to the function 'system' in %a/tests/disabled_functions_param_alias.php:2 has been disabled, because of the the rule '1'. |
| 14 | [snuffleupagus][0.0.0.0][disabled_function][notice] The call to the function 'shell_exec' in %a/tests/disabled_functions_param_alias.php:3 has been disabled, because of the the rule '2'. | 14 | [snuffleupagus][0.0.0.0][disabled_function][simulation] The call to the function 'shell_exec' in %a/tests/disabled_functions_param_alias.php:3 has been disabled, because of the the rule '2'. |
diff --git a/src/tests/disabled_functions_require_simulation.phpt b/src/tests/disabled_functions_require_simulation.phpt new file mode 100644 index 0000000..2744c37 --- /dev/null +++ b/src/tests/disabled_functions_require_simulation.phpt | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions - Require (simulation) | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) die "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/config_disabled_functions_require.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | $dir = __DIR__; | ||
| 10 | file_put_contents($dir . '/test.bla', "BLA\n"); | ||
| 11 | file_put_contents($dir . '/test.sim', "MEH\n"); | ||
| 12 | require $dir . '/test.bla'; | ||
| 13 | require $dir . '/test.sim'; | ||
| 14 | echo "1337\n"; | ||
| 15 | ?> | ||
| 16 | --EXPECTF-- | ||
| 17 | BLA | ||
| 18 | [snuffleupagus][0.0.0.0][disabled_function][simulation] The call to the function 'include' in %a/disabled_functions_require_simulation.php:%d has been disabled, because its argument 'inclusion path' content (%a/test.sim) matched a rule. | ||
| 19 | MEH | ||
| 20 | 1337 | ||
| 21 | --CLEAN-- | ||
| 22 | <?php | ||
| 23 | $dir = __DIR__; | ||
| 24 | unlink($dir . '/test.bla'); | ||
| 25 | unlink($dir . '/test.sim'); | ||
| 26 | ?> | ||
diff --git a/src/tests/disabled_functions_ret_simulation.phpt b/src/tests/disabled_functions_ret_simulation.phpt index 58af3a9..1965030 100644 --- a/src/tests/disabled_functions_ret_simulation.phpt +++ b/src/tests/disabled_functions_ret_simulation.phpt | |||
| @@ -11,8 +11,8 @@ echo stripos("pouet", "p") . "\n"; | |||
| 11 | strcmp("p", "p") . "\n"; | 11 | strcmp("p", "p") . "\n"; |
| 12 | ?> | 12 | ?> |
| 13 | --EXPECTF-- | 13 | --EXPECTF-- |
| 14 | [snuffleupagus][0.0.0.0][disabled_function][notice] The execution has been aborted in %a/disabled_functions_ret_simulation.php:2, because the return value (0) of the function 'strpos' matched a rule. | 14 | [snuffleupagus][0.0.0.0][disabled_function][simulation] The execution has been aborted in %a/disabled_functions_ret_simulation.php:2, because the return value (0) of the function 'strpos' matched a rule. |
| 15 | 0 | 15 | 0 |
| 16 | [snuffleupagus][0.0.0.0][disabled_function][notice] The execution has been aborted in %a/disabled_functions_ret_simulation.php:3, because the function 'stripos' returned '0', which matched the rule '1'. | 16 | [snuffleupagus][0.0.0.0][disabled_function][simulation] The execution has been aborted in %a/disabled_functions_ret_simulation.php:3, because the function 'stripos' returned '0', which matched the rule '1'. |
| 17 | 0 | 17 | 0 |
| 18 | [snuffleupagus][0.0.0.0][disabled_function][drop] The execution has been aborted in %a/disabled_functions_ret_simulation.php:4, because the return value (0) of the function 'strcmp' matched a rule. | 18 | [snuffleupagus][0.0.0.0][disabled_function][drop] The execution has been aborted in %a/disabled_functions_ret_simulation.php:4, because the return value (0) of the function 'strcmp' matched a rule. |
diff --git a/src/tests/disabled_functions_upper.phpt b/src/tests/disabled_functions_upper.phpt index 4a7ed94..08c26c0 100644 --- a/src/tests/disabled_functions_upper.phpt +++ b/src/tests/disabled_functions_upper.phpt | |||
| @@ -14,7 +14,7 @@ echo sTRPOs("pouet", "o"); | |||
| 14 | ?> | 14 | ?> |
| 15 | --EXPECTF-- | 15 | --EXPECTF-- |
| 16 | [snuffleupagus][0.0.0.0][disabled_function][drop] The call to the function 'system' in %a/tests/disabled_functions_upper.php:%d has been disabled. | 16 | [snuffleupagus][0.0.0.0][disabled_function][drop] The call to the function 'system' in %a/tests/disabled_functions_upper.php:%d has been disabled. |
| 17 | [snuffleupagus][0.0.0.0][disabled_function][notice] The call to the function 'printf' in %a/tests/disabled_functions_upper.php:%d has been disabled. | 17 | [snuffleupagus][0.0.0.0][disabled_function][simulation] The call to the function 'printf' in %a/tests/disabled_functions_upper.php:%d has been disabled. |
| 18 | printf in simulation mode | 18 | printf in simulation mode |
| 19 | print in disabled mode | 19 | print in disabled mode |
| 20 | [snuffleupagus][0.0.0.0][disabled_function][drop] The call to the function 'var_dump' in %a/tests/disabled_functions_upper.php:%d has been disabled. | 20 | [snuffleupagus][0.0.0.0][disabled_function][drop] The call to the function 'var_dump' in %a/tests/disabled_functions_upper.php:%d has been disabled. |
diff --git a/src/tests/unserialize_sim.phpt b/src/tests/unserialize_sim.phpt index 8ebf64d..0d8280c 100644 --- a/src/tests/unserialize_sim.phpt +++ b/src/tests/unserialize_sim.phpt | |||
| @@ -13,5 +13,5 @@ var_dump(unserialize('s:1:"a";alyualskdufyhalkdjsfhalkjdhflaksjdfhlkasdhflkahdaw | |||
| 13 | ?> | 13 | ?> |
| 14 | --EXPECT-- | 14 | --EXPECT-- |
| 15 | s:1:"a";650609b417904d0d9bbf1fc44a975d13ecdf6b02b715c1a06271fb3b673f25b1string(1) "a" | 15 | s:1:"a";650609b417904d0d9bbf1fc44a975d13ecdf6b02b715c1a06271fb3b673f25b1string(1) "a" |
| 16 | [snuffleupagus][0.0.0.0][unserialize][notice] Invalid HMAC for s:1:"a";alyualskdufyhalkdjsfh | 16 | [snuffleupagus][0.0.0.0][unserialize][simulation] Invalid HMAC for s:1:"a";alyualskdufyhalkdjsfh |
| 17 | string(1) "a" | 17 | string(1) "a" |
