<?php require_once 'test_webterminal/process.class.php'; $p = new Process("su neco"); usleep(500000); $p->put("neco"); $p->put(chr(13)); echo $p->get(); echo '<hr>'; //$p->put(chr(21)); //var_dump($p->close()); //echo json_encode($p->getStatus()); //echo '<hr>'; // $p->put("whoami"); // $p->put(chr(13)); //echo $p->get(); usleep(500000); echo $p->get(); $p->put("whoami"); $p->put(chr(13)); echo $p->get(); echo '<hr>'; usleep(500000); echo $p->get(); echo '<hr>'; echo json_encode($p->getStatus()); echo '<hr>'; $p->put("ls -l"); $p->put(chr(13)); echo $p->get(); echo '<hr>';
/** * Simulates the SIGCONT sending via 'fg' */ private function sendFg() { $SLAYER = 'pid=' . self::$status['pid'] . '; supid=`ps -o pid --no-heading --ppid $pid`;' . 'bashpid=`ps -o pid --no-heading --ppid $supid`;' . 'childs=`ps -o pid --no-heading --ppid $bashpid`;' . 'kill -CONT $childs;'; $process = new Process("su -c '{$SLAYER}' -l {$this->login}"); usleep(500000); $process->put($this->password); $process->put(chr(13)); self::$process->put(chr(13)); usleep(500000); }