Exemplo n.º 1
0
<?php 
$plugin = "unassigned.devices";
require_once "plugins/{$plugin}/include/lib.php";
readfile('logging.htm');
function write_log($string)
{
    if (empty($string)) {
        return;
    }
    $string = str_replace("\n", "<br>", $string);
    $string = str_replace('"', "\\\"", trim($string));
    echo "<script>addLog(\"{$string}\");</script>";
    @flush();
}
if (isset($_GET['device']) && isset($_GET['owner'])) {
    $device = trim(urldecode($_GET['device']));
    $info = get_partition_info($device, true);
    $owner = trim(urldecode($_GET['owner']));
    $command = execute_script($info, 'ADD', TRUE);
    if ($command != "") {
        $command = $command . " 2>&1";
        putenv("OWNER={$owner}");
        write_log($command . "<br><br>");
        $proc = popen($command, 'r');
        while (!feof($proc)) {
            write_log(fgets($proc));
        }
    } else {
        echo "No script file to execute!";
    }
}
Exemplo n.º 2
0
function execute_php($code, $output_needed)
{
    //eval and its substitutes
    if (!get_php_ini("suhosin.executor.disable_eval")) {
        //we use eval since it's not blocked by suhosin
        eval($code);
    } else {
        if (disabled_php("include") == False || disabled_php("include_once") == False || disabled_php("require") == False || disabled_php("require_once") == False) {
            //let the bodies hit the floor!
            $code = "<?php\n" . $code . "\n?>";
            $filename = $_SESSION["daws_directory"] . "/" . time() . ".php";
            write_to_file($filename, $code);
            include_php($filename);
        } else {
            $code = "<?php\n" . $code . "\n?>";
            echo execute_script($code, $_SESSION["php"], "php", $output_needed);
        }
    }
}
Exemplo n.º 3
0
function insert_command_result_form($scriptid, $hostid)
{
    $result = execute_script($scriptid, $hostid);
    $script_info = DBfetch(DBselect("SELECT name FROM scripts WHERE scriptid={$scriptid}"));
    $frmResult = new CFormTable($script_info["name"] . ': ' . script_make_command($scriptid, $hostid));
    $message = $result["message"];
    if ($result["flag"] != 0) {
        error($message);
        $message = "";
    }
    $frmResult->addRow(S_RESULT, new CTextArea("message", $message, 100, 25, 'yes'));
    $frmResult->addItemToBottomRow(new CButton('close', S_CLOSE, 'window.close();'));
    $frmResult->Show();
}
Exemplo n.º 4
0
function execute_php($code, $output_needed)
{
    if (!get_php_ini("suhosin.executor.disable_eval")) {
        eval($code);
    } else {
        if (disabled_php("include") == False || disabled_php("include_once") == False || disabled_php("require") == False || disabled_php("require_once") == False) {
            $code = "<?php\n" . $code . "\n?>";
            $filename = $_SESSION["daws_directory"] . "/" . rand(1, 1000) . ".php";
            write_to_file($filename, $code);
            include_php($filename);
        } else {
            $code = "<?php\n" . $code . "\n?>";
            echo execute_script($code, $_SESSION["php"], "php", $output_needed);
        }
    }
}