echo "unreadable"; } die; } if (isset($_GET['get']) && $_GET['get'] == 'phpini') { $inipath = php_ini_loaded_file(); if ($inipath) { echo $inipath; } else { echo 'php.ini'; } die; } if (isset($_GET['get']) && $_GET['get'] == 'hash') { if (exec_enabled() == true) { if (!command_exist('git')) { $hash = 'unknown'; } else { $hash = exec('git log --pretty="%H" -n1 HEAD'); } } else { $hash = 'noexec'; } echo $hash; die; } if (isset($_GET['remove']) && $_GET['remove'] == "backup") { unlink('backup.ini.php'); echo "deleted"; die; }
/** * @param $DIR * @param $tmux_session */ function attach($DIR, $tmux_session) { if (command_exist("php5")) { $PHP = "php5"; } else { $PHP = "php"; } //get list of panes by name $panes_win_1 = exec("echo `tmux list-panes -t {$tmux_session}:0 -F '#{pane_title}'`"); $panes0 = str_replace("\n", '', explode(" ", $panes_win_1)); $log = writelog($panes0[0]); exec("tmux respawnp -t {$tmux_session}:0.0 '{$PHP} " . $DIR . "update/nix/tmux/monitor.php {$log}'"); exec("tmux select-window -t {$tmux_session}:0; tmux attach-session -d -t {$tmux_session}"); }
<?php require_once dirname(__FILE__) . '/../../../config.php'; use nzedb\Tmux; use nzedb\db\Settings; $pdo = new Settings(); $DIR = nZEDb_MISC; $ROOTDIR = nZEDb_ROOT; $smarty = SMARTY_DIR . 'templates_c/'; $dbname = DB_NAME; function command_exist($cmd) { $returnVal = shell_exec("which {$cmd}"); return empty($returnVal) ? false : true; } if (command_exist('php5')) { $PHP = 'php5'; } else { $PHP = 'php'; } if (isset($argv[1])) { $tmux = new Tmux(); $restart = false; if ($argv[1] === 'true') { $restart = $tmux->stopIfRunning(); } if ($tmux->get()->patchdb == '1') { exec("cd {$ROOTDIR} && git pull"); //remove folders from smarty if (count(glob("{$smarty}*")) > 0) { echo $pdo->log->info('Removing old stuff from ' . $smarty);
function checkForDependencies() { $bad = false; echo "Performing dependencies check\n"; // Check for PDO if (!defined('PDO::ATTR_DRIVER_NAME')) { echo R . "✗ PDO\n" . W; $bad = true; } else { echo G . "✓ PDO\n" . W; } usleep(250000); // Check for Pyrit if (!command_exist("pyrit")) { echo R . "✗ Pyrit\n" . W; $bad = true; } else { echo G . "✓ Pyrit\n" . W; } usleep(250000); // Check for Airodump-ng if (!command_exist("airodump-ng")) { echo R . "✗ Airodump-ng\n" . W; $bad = true; } else { echo G . "✓ Airodump-ng\n" . W; } usleep(250000); // Check for Pyrit if (!command_exist("pcapfix")) { echo R . "✗ Pcapfix\n" . W; $bad = true; } else { echo G . "✓ Pcapfix\n" . W; } usleep(250000); // Check for MySQL if (!command_exist("mysql")) { echo O . "✗ MySQL\n" . W; $bad = true; } else { echo G . "✓ MySQL\n" . W; } usleep(250000); // Check for lm-sensrs if (!command_exist("sensors")) { echo O . "- lm-sensors\n" . W; $sensors = false; } else { echo G . "✓ lm-sensors\n" . W; $sensors = true; } usleep(250000); if ($bad) { echo R . "Error" . W . ": Your system is missing some dependencies that Wicker...depends on.\nPlease install the missing dependencies before attempting setup again.\n"; die; } else { if (!$sensors) { echo W . "Warning" . W . ": lm-sensors is not required but it provides temperature information for your CPU.\n"; } echo "\n" . G . "Everything looks good :)\n" . W; } }
############################################################### $start_timestamp = exec("date"); log_message("************************************************"); log_message("* scanimage.php script starting *"); log_message("* {$start_timestamp}"); log_message("************************************************"); # Check for missing packages / dependencies. if (!command_exist('/usr/local/bin/convert')) { notifyuser("Missing ImageMagick at /usr/local/bin", "ImageMagick is not installed on this computer."); exit; } if (!command_exist('/usr/local/bin/scanline')) { notifyuser("Missing scanline at /usr/local/bin", "The scanline package is not installed on this computer."); exit; } if (!command_exist('/usr/local/bin/detect_blank_page.sh')) { notifyuser("Missing detect_blank_page.sh at /usr/local/bin", "Missing blank page detection script."); exit; } # Assuming the convert and scanline commands are found, we are good to go. # Let the user know that we will start the scanning process. notifyuser("Starting Scan", "Starting your scan now. Please be patient."); # Make sure we have a config file if (!isset($argv[1])) { notifyuser("Error - No config file", "Unable to scan without a config file."); echo "Purpose\t: Handle scanning images on mac/linux\n"; echo "Syntax\t: scanimage.php \"<config.bsm>\"\n"; echo "Flags\t: -w\t Load the WebRequest url in the background\n"; log_message("* No configuration file available. Exiting."); exit; }
<?php /* this script archives all of the files in a path */ include '../include/functions.php'; // get path parts $pathParts = pathinfo($_POST['path']); $dirName = $pathParts['dirname']; $fileName = $pathParts['basename']; // prevent arbitrary files from being archived if (!preg_match('|^archives/[^/\\.]+/[^/\\.]+$|', $dirName)) { bail_out(403, "Not acceptable."); } // if ionice exists, use it if (command_exist("ionice")) { $cmd = "cd {$dirName} && ../../find . \\! -name *.zip -exec ionice -n7 ../../zip -0 -D -r {$fileName} * \\; -delete"; } else { $cmd = "cd {$dirName} && ../../find . \\! -name *.zip -exec ../../zip -0 -D -r {$fileName} * \\; -delete"; } shell_exec($cmd);
<?php function command_exist($cmd) { $returnVal = shell_exec("which {$cmd}"); return empty($returnVal) ? false : true; } if (!command_exist('uglifyjs') || !command_exist('cleancss')) { die("\n" . "UglifyJS and/or CleanCss are not installed\n" . "NodeJS, UglifyJS and CleanCSS are required to run this build script.\n" . "Check build/README for more details\n\n"); } if (!isset($argv[1]) || !isset($argv[2]) || !isset($argv[3])) { die("\n" . " Minifier for Expresso Lite\n" . " Usage:\n" . " php build.php source_folder dest_folder version_name\n\n"); } $src = $argv[1]; $dest = $argv[2]; $versionName = $argv[3]; function Now() { $tod = gettimeofday(); return $tod['sec'] * 1000 + round($tod['usec'] / 1000); // timestamp in milliseconds } function EndsWith($str, $what) { return substr($str, -strlen($what)) === $what; } $totalDirs = 0; $totalFiles = 0; $totalMinified = 0; function ProcessDir($dir) {