Exemplo n.º 1
0
 // Niv 1 + SECURITE MOTEUR
 /* ************************************ */
 /* CONSTRUCTION de la commande pour ENVOI sur la console via  SSH */
 if (isset($_POST['cmd'])) {
     // *** Affichage mode debug ***
     // echo '# '.$_POST['cmd'].' #<br />';
     if (isset($_POST['versionLog'])) {
         $cheminWIN = "";
         $cheminWIN = str_replace('/', '\\', INI_Conf_Moteur($_SESSION['opensim_select'], "address"));
         if ($_POST['versionLog'] == "32") {
             $cmd = 'DEL ' . $cheminWIN . "OpenSim.log";
         }
         if ($_POST['versionLog'] == "64") {
             $cmd = 'DEL ' . $cheminWIN . "OpenSim.32BitLaunch.log";
         }
         exec_command($cmd);
         //echo exec_command($cmd);
         // $ecrire = fopen($cheminWIN.'OpenSim.log', "w");
         // ftruncate($ecrire, 0);
         // echo "DEBUG: ".$ecrire;
     }
 }
 //*************** Formulaire de choix du moteur a selectionne *****************
 // On se connecte a MySQL
 $db = mysql_connect($hostnameBDD, $userBDD, $passBDD);
 mysql_select_db($database, $db);
 $sql = 'SELECT * FROM moteurs';
 $req = mysql_query($sql) or die('Erreur SQL !<p>' . $sql . '</p>' . mysql_error());
 // echo '<h4>Selectionner un Simulateur</h4>';
 echo '<form class="form-group" method="post" action="">';
 echo '<div class="form-inline">';
Exemplo n.º 2
0
// get server statistics via fb_lock_print
//
if (have_panel_permissions($s_login['user'], 'adm_server')) {
    $exe = 'fb_lock_print';
    // get the LOCK_HEADER BLOCK
    list($iblockpr_output, $binary_error) = exec_command($exe, ' -o');
    $lock_header = '';
    unset($iblockpr_output[0]);
    foreach ($iblockpr_output as $line) {
        if (strlen(trim($line)) == 0) {
            break;
        }
        $lock_header .= $line . "<br>\n";
    }
    // get the server statistics
    list($iblockpr_output, $binray_error) = exec_command($exe, ' -i');
    if (count($iblockpr_output) > 3) {
        $iblock['names'] = preg_split('/[\\s,]+/', $iblockpr_output[0]);
        $iblock['last'] = preg_split('/[\\s,]+/', $iblockpr_output[1]);
        $iblock['avg'] = preg_split('/[\\s,]+/', $iblockpr_output[3]);
    }
    // get server version and implementation strings
    if (($service = fbird_service_attach($s_login['host'], $s_login['user'], $s_login['password'])) != FALSE) {
        $server_info = fbird_server_info($service, IBASE_SVC_SERVER_VERSION) . ' / ' . fbird_server_info($service, IBASE_SVC_IMPLEMENTATION);
        fbird_service_detach($service);
    } else {
        $ib_error = fbird_errmsg();
    }
}
//
// backup the current database
function isql_get_metadata($user, $pw, $db, $host)
{
    $db_str = !empty($host) ? $host . ':' . $db : $db;
    $user_str = getenv('ISC_USER') ? '' : ' -u ' . ibwa_escapeshellarg($user);
    $pw_str = getenv('ISC_PASSWORD') ? '' : ' -p ' . ibwa_escapeshellarg($pw);
    $parameters = ' -m -x' . $user_str . $pw_str . ' ' . ibwa_escapeshellarg($db_str);
    return exec_command('isql-fb', $parameters);
}
Exemplo n.º 4
0
			
			light_message('<h3>Properties for selected items</h3>
			<p>size of '.sizeof($fsizes).' selected files: <b>'.show_size(0,false,array_sum($fsizes)).'</b></p>
			<p>size of '.sizeof($dsizes).' selected dirs: <b>'.show_size(0,false,array_sum($dsizes)).'</b></p>
			<p>total size: <b>'.show_size(0,false,array_sum($fsizes)+array_sum($dsizes)).'</b></p>
			'.(sizeof($mods)==1 ? '<p>mod: <b>'.get_rights($v,false).' ('.get_rights($v).')</b></p>' : '').'
			'.(sizeof($owners)==1 ? '<p>owner: <b>'.get_owner($v).'</b></p>' : '').'
			'.(sizeof($groups)==1 ? '<p>group: <b>'.get_group($v).'</b></p>' : '') );
			
			
		}
		break;
	case 'terminal':
		if(!empty($_REQUEST['cmd']))
		{
			$res = exec_command($_REQUEST['cmd']);
		}else
		{
			$res = array('cmd'=>'', 'output'=>'', 'dir'=> getcwd_short());
		}
		
		light_message('<form action="?act=terminal" method="POST" style="margin: 0px; padding: 0px;"><h3>'.$res['dir'].'</h3>
		<!-- cmd has id "filter" because filter is default focused on -->
		<input type=text id="filter" name="cmd" value="'.(!empty($_REQUEST['cmd']) ? htmlspecialchars($_REQUEST['cmd']) : '').'"><br>
		<input type="submit" value="execute">
		<br>
<br><div style="font-family: Courier New, Courier, monospace;" class="toutput">'.$res['output'].'</div>
		');
		break;
	case 'logout':
		logout();
Exemplo n.º 5
0
}
log_message("Building project...");
exec_command('xcodebuild -target "' . $projectName . '" -sdk "' . $targetSDK . '" -configuration "' . $configuration . '"  CONFIGURATION_BUILD_DIR="' . $projectBuildDirPath . '" -scheme "' . BUILD_SCHEME . '" clean build archive >> "' . $logPath . '"', FALSE, FALSE, TRUE);
// Make app filename
$appPath;
$handle = opendir($projectBuildDirPath);
if (!$handle) {
    die_with_error('Couldn\'t read project build dir');
}
while (($fileName = readdir($handle)) !== false) {
    if (pathinfo($fileName, PATHINFO_EXTENSION) != 'app') {
        continue;
    }
    $appPath = $projectBuildDirPath . '/' . $fileName;
}
closedir($handle);
if (!file_exists($appPath)) {
    die_with_error('Didn\'t create APP file');
}
// Clean temp files
exec_command('rm -rf ' . $tempBuildDirPath, FALSE, FALSE);
###########################################################
# Sign app
###########################################################
log_message("Packaging and signing...");
exec_command('/usr/bin/xcrun -sdk "' . $targetSDK . '" PackageApplication -v "' . $appPath . '" -o "' . $ipaPath . '" --sign "' . $developerIdentity . '" --embed "' . $provProfilePath . '" >> "' . $logPath . '"', FALSE, FALSE, TRUE);
if (!file_exists($ipaPath)) {
    die_with_error('Didn\'t create IPA file');
}
log_message("Done.");
$errorHappened = FALSE;
Exemplo n.º 6
0
        ?>
</td>
					</tr>
<?php 
    }
    ?>
				</tbody>
			</table>
		</div>
	</div>
</form>

<div class="panel panel-default">
	<div class="panel-heading"><h2 class="panel-title"><?php 
    echo gettext('pfSync nodes');
    ?>
</h2></div>
	<div class="panel-body">
		<ul>
<?php 
    foreach (explode("\n", exec_command("/sbin/pfctl -vvss | /usr/bin/grep creator | /usr/bin/cut -d\" \" -f7 | /usr/bin/sort -u")) as $node) {
        echo '<li>' . $node . '</li>';
    }
    ?>
		</ul>
	</div>
</div>

<?php 
}
include "foot.inc";
        log_append('SHELL: ' . $line);
    }
}
if (isset($password)) {
    if (empty($_REQUEST['p'])) {
        log_append('Missing hook password');
        die;
    }
    if ($_REQUEST['p'] !== $password) {
        log_append('Invalid hook password');
        die;
    }
}
// GitLab sends the json as raw post data
$input = file_get_contents("php://input");
$json = json_decode($input);
if (!is_object($json) || empty($json->ref)) {
    log_append('Invalid push event data');
    die;
}
if (isset($ref)) {
    $_refs = (array) $ref;
    if ($ref !== '*' && !in_array($json->ref, $_refs)) {
        log_append('Ignoring ref ' . $json->ref);
        die;
    }
}
log_append('Launching shell hook script...');
exec_command('sh ' . $hookfile);
#log_append('executando o comand sh ' . $hookfile);
log_append('Shell hook script finished');
Exemplo n.º 8
0
         unset($tableauIni[$_POST['name_sim']]);
         // Enregistrement du nouveau fichier
         $fp = fopen(INI_Conf_Moteur($_SESSION['opensim_select'], "address") . "Regions/RegionTemp.ini", "w");
         while (list($key, $val) = each($tableauIni)) {
             fputs($fp, "[" . $key . "]\r\n");
             fputs($fp, "RegionUUID          = " . $tableauIni[$key]['RegionUUID'] . "\r\n");
             fputs($fp, "Location            = " . $tableauIni[$key]['Location'] . "\r\n");
             fputs($fp, "InternalAddress     = 0.0.0.0\r\n");
             fputs($fp, "InternalPort        = " . $tableauIni[$key]['InternalPort'] . "\r\n");
             fputs($fp, "AllowAlternatePorts = False\r\n");
             fputs($fp, "ExternalHostName    = " . $tableauIni[$key]['ExternalHostName'] . "\r\n");
         }
         fclose($fp);
         unlink($filename);
         rename(INI_Conf_Moteur($_SESSION['opensim_select'], "address") . "Regions/RegionTemp.ini", $filename);
         exec_command("chmod -R 777 " . INI_Conf_Moteur($_SESSION['opensim_select'], "address") . "Regions/");
         echo "<p class='alert alert-success alert-anim'>";
         echo "<i class='glyphicon glyphicon-ok'></i>";
         echo " Region <strong>" . $_POST['NewName'] . "</strong> supprimee avec succes</p>";
     }
 }
 // ******************************************************
 //  Affichage page principale
 // ******************************************************
 // ******************************************************
 // *** Lecture Fichier Regions.ini ***
 $filename2 = INI_Conf_Moteur($_SESSION['opensim_select'], "address") . "Regions/Regions.ini";
 if (file_exists($filename2)) {
     $filename = $filename2;
 } else {
     echo "<p class='alert alert-success alert-anim'>";
Exemplo n.º 9
0
             goto tc_connection_clientnonce_complete;
         }
     }
     if (@class_exists('COM')) {
         if ($CAPI_Util = @new COM('CAPICOM.Utilities.1')) {
             $clientnonce = base64_decode($CAPI_Util->GetRandom(16, 0));
             goto tc_connection_clientnonce_complete;
         }
     }
     // If none of the above is available, an error is
     // given.
     $auth_success = 0;
     $error_message = '<p>No available random source found</p>';
     goto tc_connection_authchallenge_complete;
     tc_connection_clientnonce_complete:
     $response = exec_command('authchallenge safecookie ' . bin2hex($random_string));
     if (substr($response, 0, 29) === '250 AUTHCHALLENGE SERVERHASH=') {
         $serverhash = hex2bin(substr($response, 29, 64));
         $servernonce = hex2bin(substr($response, 106, 64));
         $tohash = $tc_connection_auth_cookie_contents . $clientnonce . $servernonce;
         $serverhash1 = hash_hmac('sha256', $tohash, "Tor safe cookie authentication server-to-controller hash", 1);
         if ($serverhash == $serverhash1) {
             $clienthash_hex = hash_hmac('sha256', $tohash, "Tor safe cookie authentication controller-to-server hash");
             $command = 'authenticate ' . $clienthash_hex;
             goto tc_connection_authchallenge_complete;
         }
     }
     $auth_success = 0;
     $error_message = '<p>Authchallenge failed</p>';
     tc_connection_authchallenge_complete:
 } else {
Exemplo n.º 10
0
	'success' => $success,
	'dir'    => sizeof($fz) == 1 ? d_is_dir($fz[0]) : true,
	);
	break;
case 'save-file':
	$f = clean(urldecode($_REQUEST['filename_encoded']));
	
	if(!d_file_put_contents($f, $_REQUEST['content']))
	{
		echo 'Cannot edit file.'.reason();
		$_RESULT = false;
	}else $_RESULT = true;
	break;
case 'exec':
	session_write_close();
	$_RESULT = exec_command($_REQUEST['cmd']);
	break;
case 'get_rights':
	$_RESULT = d_get_rights($f);
	break;
case 'set_rights':
	if(!$_REQUEST['recursive'])
	{
		$_RESULT = true;
		
		//array_display($_REQUEST);
		
		foreach($fz as $v)
		{
			if(!d_chmod($v, trim($_REQUEST['mod']))) $_RESULT=false;
		}
Exemplo n.º 11
0
//2011.05.06 @fbassas
require_once dirname(__FILE__) . '/wp-config.php';
require_once ABSPATH . WPINC . '/registration.php';
${$msg} = '';
// Check database connection
$isok = username_exists('admin');
if (!$isok) {
    $msg .= 'ERROR: No es pot connectar a la base de dades<br/><br/>';
}
// Check connection to data files
$wpcontentdir = dirname(__FILE__) . '/wp-content';
$blogsdir = $wpcontentdir . '/blogs.dir';
$isok = is_writable($blogsdir);
if ($isok !== TRUE) {
    $msg .= 'ERROR: No es pot accedir al sistema de fitxers. Reviseu el punt de muntatge ' . $blogsdir;
    $msg .= exec_command("ls -la {$wpcontentdir}");
    $msg .= exec_command("ls -la {$blogsdir}");
    $msg .= exec_command("df -h {$wpcontentdir}");
}
if (empty($msg)) {
    $msg = 'OK';
}
echo $msg;
function exec_command($command)
{
    $msg = "<br/><br/>\$ {$command}<br/>";
    $msgtmp = array();
    exec($command, $msgtmp);
    $msg .= implode($msgtmp, '<br/>');
    return $msg;
}