예제 #1
0
파일: good.php 프로젝트: mohc/vdd
/**
 * Example of chained method invocations in a function.
 */
function test3()
{
    // Uses the Rules API as example.
    $rule = rule();
    $rule->condition('rules_test_condition_true')->condition('rules_test_condition_true')->condition(rules_or()->condition(rules_condition('rules_test_condition_true')->negate())->condition('rules_test_condition_false')->condition(rules_and()->condition('rules_test_condition_false')->condition('rules_test_condition_true')->negate()));
}
예제 #2
0
if (file_exists($file) && !unlink($file)) {
    error("Can't replace configuration: {$file}", 4);
}
$links = links();
foreach (rules() as $port => $rule) {
    $service = $rule['service'];
    if (false === array_key_exists($service, $links)) {
        if ($service !== gethostbyname($service)) {
            rule($file, $port, $service, $rule['dst']);
            continue;
        } else {
            error("Missing host name: {$rule['service']}", 3);
        }
        error("Missing service name: {$rule['service']}", 2);
    }
    rule($file, $port, $links[$rule['service']][$rule['dst']]['addr'], $links[$rule['service']][$rule['dst']]['port']);
}
if (array_key_exists('LOGFILE', $_SERVER) && is_string($_SERVER['LOGFILE']) && strlen($_SERVER['LOGFILE']) > 0) {
    @file_put_contents('php://stdout', "Adding rule: logfile {$_SERVER['LOGFILE']}\n");
    @file_put_contents('php://stdout', "Adding rule: logcommon\n");
    file_put_contents($file, "logfile {$_SERVER['LOGFILE']}\nlogcommon\n", FILE_APPEND);
}
function rule($file, $port, $addr, $dst)
{
    static $ip;
    if (empty($ip)) {
        $ip = preg_replace('/^([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+).*/', '\\1', exec('hostname -i'));
    }
    @file_put_contents('php://stdout', sprintf("Adding rule: {$ip} {$port} %s %d\n", $addr, $dst));
    file_put_contents($file, sprintf("{$ip} {$port} %s %d\n", $addr, $dst), FILE_APPEND);
}
예제 #3
0
	include_once('ressources/class.ActiveDirectory.inc');
	
	
	
$usersmenus=new usersMenus();
if(!$usersmenus->AsDansGuardianAdministrator){
	$tpl=new templates();
	$alert=$tpl->_ENGINE_parse_body('{ERROR_NO_PRIVS}');
	echo "<H2>$alert</H2>";
	die();	
}

if(isset($_GET["popup"])){popup();exit;}
if(isset($_GET["list"])){items();exit;}
if(isset($_GET["ruleid-js"])){rule_js();exit;}
if(isset($_GET["ruleid"])){rule();exit;}
if(isset($_POST["ID"])){rule_save();exit;}
if(isset($_GET["switch-js"])){switch_js();exit;}
if(isset($_POST["switch"])){switch_save();exit;}
if(isset($_GET["delete-js"])){delete_js();exit;}
if(isset($_POST["delete"])){delete();exit;}
popup();

function rule_js(){
	header("content-type: application/x-javascript");
	$page=CurrentPageName();
	$tpl=new templates();
	$ID=$_GET["ruleid-js"];
	if($ID==0){$title="{new_rule}";}else{$title="{rule}:: $ID";}
	$title=$tpl->_ENGINE_parse_body($title);
	$pattern=urlencode($_GET["pattern"]);
예제 #4
0
                         10 deducted points are excluded from the game - regardless of their actual amount of
                         ethical scores.') . rule('Advisories', 'Each advisory is scored 0 to 5 <i>ethical scores</i>, depending on its quality.
                        We try to assign scores for each vulnerablity only once, in a first come, first served
                        fashion.') . '</ul>') . rule('Defensive Score', 'A flag is considered defended and gets scored with 1 point, iff
                   it was successfuly retrieved by the gameserver and 
                   it wasn\'t submitted by another team by the end of its expiry time.') . rule('Offensive Score', 'A flag is considered caught and gets awarded with 1 point, iff
                  the submitting team has the same service actively running, of which the flag originates') . rule('Total', 'The total score is calculated as follows: for each of the three
              categories a team is assigned a value of relative scores to the team with the most scores in each 
              respective category. These two or three relative scores are then added and normalized, such that 
              the leading team has 100%.') . '</ul>');
echo rule('Discouraged Behaviour I', 'The following actions are discouraged and possibly fined with negative scores:
       <ul>
        <li>Automated scanning (ports, IPs, etc.) or usage of vulnerability scanners.
        <li>Attacks like Denial-of-Service, Distributed-Denial-of-Service or Bandwith Exhaustion.
        <li>Deployment of network-layer or OS-wide techniques that
          <ul>
            <li>try to destinct between gameserver and players
            <li>limit the effect of attacks, like e.g. overflows or injections
          </ul>
        <li>Any attacks or changes on any host that are directed against routing.
        <li>Destructive behaviour (e.g. deleting vital system files).
        <li>Intentionally supporting other teams.
	<li>In the IRC-channel: Swearing, flooding, and similar.
        <li><i>This list is not complete.</i>
       </ul>');
echo rule('Discouraged Behaviour II', "The following is discouraged and is possibly fined with negative scores and/or immediate dispension from the game:\n      <ul>\n        <li>Attacking the game server or any other host of the organisors.\n        <li>Attacking systems outside the VPN. All traffic has to happen within the VPN.\n        <li>Relaying data through other team's networks into the Internet.\n        <li>Cheating on the team's size leads to immediate disqualification.\n        <li><i>This list is not complete.</i>\n      </ul>");
echo '
</ul></p>

<p>&nbsp;</p>';
myfooter();
예제 #5
0
}
rule();
title('Call: $results=$spotify->searchTrack("' . $track . '")');
$results = $spotify->searchTrack($track);
title('Call: $results->getInfo()');
dump_pre($results->getInfo());
title('Call: $results->getCount()');
dump_pre($results->getCount());
title('Call: $results->getTracks()');
title('&nbsp;&nbsp;Foreach Call: $resulttrack->getName()');
title('&nbsp;&nbsp;Foreach Call: $resulttrack->getArtists()');
foreach ($results->getTracks() as $resulttrack) {
    dump_pre($resulttrack->getName());
    dump_pre($resulttrack->getArtists());
}
rule();
title('Call: $results=$spotify->foo("' . $artist . '")');
$results = $spotify->foo($artist);
title('Call: $results->getInfo()');
dump_pre($results->getInfo());
// Some little functions to aide in example display :)
function dump_pre($var)
{
    echo '<pre>';
    var_dump($var);
    echo '</pre>';
}
function title($title)
{
    echo '<b>' . $title . '</b>' . "<br />\n";
}