Example #1
0
 public static function getPlugins($name)
 {
     self::$PLUGIN = array();
     GWF_File::filewalker(self::getPlugDir(), array(__CLASS__, 'getPlugRec'), false, true, $name);
     if (GWF3::getConfig('env') === 'dev') {
         GWF_File::filewalker(self::getPlugDirDev(), array(__CLASS__, 'getPlugRec'), false, true, $name);
     }
     GWF_File::filewalker(self::getPlugDirUser(), array(__CLASS__, 'getPlugRec'), false, true, $name);
     GWF_File::filewalker(self::getPlugDirSecret(), array(__CLASS__, 'getPlugRec'), false, true, $name);
     usort(self::$PLUGIN, array(__CLASS__, 'sort_power_descending'));
     return self::$PLUGIN;
 }
Example #2
0
 public static function initCityQuests()
 {
     foreach (self::$cities as $city) {
         $city instanceof SR_City;
         $fullpath = self::getShadowDir() . 'city/' . $city->getName() . '/quest';
         if (Common::isDir($fullpath)) {
             GWF_File::filewalker($fullpath, array($city, 'initQuests'));
         }
     }
 }
Example #3
0
<?php

GWF_File::filewalker('/home/user', true, 'cron_level_5', false);
function cron_level_5($entry, $fullpath, $args = NULL)
{
    $home = $fullpath;
    $username = $entry;
    $dir = $fullpath . '/level';
    if (false === ($stat = @stat($dir))) {
        return;
    }
    $chmod = $stat['mode'];
    if ($chmod & 04) {
        return;
    }
    $filename = $home . '/level/5/solution.txt';
    if (!Common::isFile($filename)) {
        // Create solution file
        $tmp = '/root/_tmp_5';
        @file_put_contents($tmp, "The solution to level 5 is 'OhRightThePerms', without the quotes.\n");
        @chmod($tmp, '0700');
        @chown($tmp, $username);
        @chgrp($tmp, $username);
        // Copy it to user home
        @rename($tmp, $filename);
    }
}
Example #4
0
<?php

GWF_File::filewalker(GWF_CORE_PATH . 'module/Audit/challs', 'cron_challs', true);
function cron_challs($entry, $fullpath, $args = NULL)
{
    if ($entry === 'cronjob.php') {
        require_once $fullpath;
    } elseif ($entry === 'cronjob.sh') {
        $fullpath = escapeshellcmd($fullpath);
        system("{$fullpath}");
    }
}
Example #5
0
    }
    $create = false;
    $crypt_pass = escapeshellarg($row['password']);
    if (false === ($uid = getUID($username))) {
        $nextuid = trim(file_get_contents($uidfile));
        $nextuid++;
        $uid = $nextuid;
        file_put_contents($uidfile, $uid);
        $create = true;
    }
    if ($uid > 3000) {
        if ($create) {
            system(GWF_PATH . 'core/module/Audit/ruth/adduser.sh' . " {$uid} {$username} {$crypt_pass}");
        } else {
            system("/usr/sbin/usermod -p {$crypt_pass} {$username}");
        }
        GWF_File::filewalker(GWF_CORE_PATH . 'module/Audit/challs', 'setup_chall', true, true, $username);
        if ($create) {
            $dirname = "/home/user/{$username}/level";
            chmod($dirname, 0705);
            chown($dirname, $username);
            chgrp($dirname, $username);
            $dirname = "/home/user/{$username}";
            chmod($dirname, 0700);
            chown($dirname, $username);
            chgrp($dirname, $username);
        }
    }
}
$db->free($result);
$db->truncateTable('war_audit_add_user');
Example #6
0
<?php

GWF_File::filewalker('/home/user', true, 'cron_welcome', false);
function cron_welcome($entry, $fullpath, $args = NULL)
{
    $source = '/etc/skel/WELCOME.txt';
    $destin = $fullpath . '/WELCOME.txt';
    copy($source, $destin);
    chown($destin, 'root');
    chgrp($destin, 'root');
    chmod($destin, 0444);
}
Example #7
0
    foreach ($modules as $module) {
        $module instanceof Dog_Module;
        $triggers = $module->getFilteredTriggers(Dog::getServer(), Dog::getChannel(), Dog::getUser());
        if (count($triggers) > 0) {
            sort($triggers);
            $out .= ' ' . chr(2) . $module->getName() . chr(2) . ': ';
            $out .= implode(', ', $triggers);
            $out .= '.';
        }
    }
    $user = Dog::getUser();
    $user->sendNOTICE(substr($out, 1));
    # Plugins
    $out = '';
    $plugdir = Dog_Plugin::getPlugDir();
    GWF_File::filewalker($plugdir, 'dogplug_help_all', false, true, strlen($plugdir) + 1);
    ksort($DPH_ALL);
    foreach ($DPH_ALL as $folder => $commands) {
        sort($commands);
        $out .= ' ' . chr(2) . $folder . chr(2) . ': ';
        $out .= implode(', ', $commands);
        $out .= '.';
    }
    $user->sendNOTICE(substr($out, 1));
} elseif ($argc === 1) {
    if (false !== ($plug = Dog_Plugin::getPlug($argv[0]))) {
        $scopetxt = dogplug_scopetxt($plugin, $plug->getPriv(), $plug->getScope());
        $plugin->reply($plug->getHelp() . $scopetxt);
    } elseif (false !== ($mod = Dog_Module::getByTrigger($argv[0]))) {
        $scopetxt = dogplug_scopetxt($plugin, $mod->getPriv($argv[0]), $mod->getScope($argv[0]));
        $plugin->reply($mod->getHelp($argv[0]) . $scopetxt);
Example #8
0
<?php

require_once '../../../bootstrap.php';
GWF_File::filewalker('/home/user', true, 'install_level_4', false);
function install_level_4($entry, $fullpath, $args = NULL)
{
    $home = $fullpath;
    $username = $entry;
    include 'install_user.php';
}
Example #9
0
                }
            }
        } else {
            if (strpos($fullpath, $search) !== false) {
                if (strpos($fullpath, '/disabled_modules/') === false) {
                    global $__DOG_TRAC_RESULTS;
                    $__DOG_TRAC_RESULTS[] = Common::substrFrom($fullpath, GWF_PATH);
                }
            }
        }
    }
}
# Iterate over these dirs
$dirs = array('core', 'www/js', 'www/challenge');
foreach ($dirs as $dir) {
    GWF_File::filewalker(GWF_PATH . $dir, 'dog_trac_helper4', true, true, $message);
}
# Print results
$url = 'http://trac.gwf3.gizmore.org/browser/';
switch (count($__DOG_TRAC_RESULTS)) {
    case 0:
        return $plugin->rply('err_file');
    case 1:
    case 2:
    case 3:
        $out = '';
        foreach ($__DOG_TRAC_RESULTS as $result) {
            $out .= ' | ' . $url . $result;
        }
        return Dog::reply(substr($out, 3));
    default:
Example #10
0
 public static function initTimerTrigDirRep($entry, $fullpath, $data)
 {
     $data[] = $entry;
     GWF_File::filewalker($fullpath, array(__CLASS__, 'initTimerTrig'), true, true, $data);
 }