execute command added to do.php

This commit is contained in:
Christopher 2020-10-24 13:48:01 +02:00
parent 0877b4faff
commit 2000f98b70
1 changed files with 12 additions and 0 deletions

View File

@ -30,6 +30,18 @@ if(isset($_SESSION['LOGIN']))
$dockerClient->startContainer($container['Id']);
}
if(isset($_REQUEST['do-command']))
{
if(isset($_REQUEST['commandtext']))
{
$filename = "/tmp/command".time().".txt";
$command = trim($_REQUEST['commandtext']);
file_put_contents($filename, $command);
exec('cat '.$filename.' | socat EXEC:"docker attach '.$container['Id'].'",pty STDIN');
}
}
header("Location: index.php");
die();
}else{