-
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathbash.php
More file actions
21 lines (15 loc) · 534 Bytes
/
bash.php
File metadata and controls
21 lines (15 loc) · 534 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
require __DIR__ . '/../vendor/autoload.php';
$launcher = new Clue\React\Shell\ProcessLauncher();
$shell = $launcher->createDeferredShell('bash 2>&1');
$shell->execute('echo -n $USER')->then(function ($result) {
var_dump('current user', $result);
}, function (Exception $e) {
echo 'Error: ' . $e->getMessage() . PHP_EOL;
});
$shell->execute('env | sort | head -n10')->then(function ($env) {
var_dump('env', $env);
}, function (Exception $e) {
echo 'Error: ' . $e->getMessage() . PHP_EOL;
});
$shell->end();