0

I want to run scilab with BackDoor module from PHP script. (https://atoms.scilab.org/toolboxes/BackDoor/0.2)

When I run command in terminal

sudo scilab-adv-cli

result is something like

opening BackDoor
BackDoor: listening to commands on TCP port 27020

and scilab is still runnig, and I can connect it from octave.

But I want to run this from API. When I run in PHP script

$result = shell_exec("sudo scilab-adv-cli 2>&1");

$result is

Start 
... (loading things)
Opening back door  
BackDoor: listening to connections on TCP port 27020 
Killed

2>&1 in the command I need for showing last line from result. (http://php.net/manual/en/function.shell-exec.php#106250)

I dont know why is this happening. When the module BackDoor wasn't installed, result was "\n\n", not "Killed". When I run never ending while, the process will showing in the list of command "top" in terminal, until I kill it. With BackDoor module process will showing up only few seconds and then ends.

I tried:

  • chown www-data:www-data -R /(path to scilab folder also with backdoor files)
  • chmod 777 -R /(path to scilab folder also with backdoor files)

I also tried run never ending while

$result = shell_exec("sudo scilab-adv-cli -e "i = 1; while i < 10 disp("i"); end; " 2>&1");

but few seconds after scilab start, is killed. In the last case was showed many many times "1.\n\n" and then "BackDoor: listening to connections on TCP port 27020. Killed".

1 Answers1

0

I'm the developer of this module. The problem is probably that the Backdoor opens a TCP port for receiving connections. Check your PHP module to see if it has permission to open such a port.

  • I tried run scilab from .sh script or python script too. Something like that: shell_exec("./script.sh") and there was "sudo scilab-adv-cli" Do you think the problem with the port will persist in this case,too? Because the result is still the same. – ssemrak Apr 20 '17 at 15:50