Exemple #1
0
 public function execute()
 {
     if (false !== ($state = Common::getGet('rightpanel'))) {
         GWF_Session::set('WC_RIGHT_PANEL', $state > 0);
         GWF_Website::redirectBack();
     }
 }
Exemple #2
0
 private static function cleanupOldTokens()
 {
     $tokens = GWF_Session::get(self::TOKEN_NAME);
     if (self::MAX_TOKENS < ($count = count($tokens))) {
         GWF_Session::set(self::TOKEN_NAME, array_slice($tokens, $count - self::MAX_TOKENS, self::MAX_TOKENS, true));
     }
 }
Exemple #3
0
function prog2NextQuestion(WC_Challenge $chall)
{
    if (false === ($user = GWF_Session::getUser())) {
        die($chall->lang('err_login'));
    }
    $solution = GWF_Random::randomKey(rand(9, 12));
    GWF_Session::set('prog2_solution', $solution);
    GWF_Session::set('prog2_timeout', microtime(true));
    //	GWF_Session::commit();
    die($solution);
}
Exemple #4
0
 private function onNewPubmsg($timestamp)
 {
     if (false === ($cut = GWF_Session::getOrDefault(self::$SESS_AJAX_PUB, time()))) {
         return;
     }
     $msgs = new GWF_ChatMsg(false);
     $channel = '';
     $new = $msgs->selectAll('*', "chatmsg_to='{$channel}' AND chatmsg_time>{$cut}", 'chatmsg_time ASC');
     foreach ($new as $msg) {
         $this->echoMessage($msg);
     }
     GWF_Session::set(self::$SESS_AJAX_PUB, time());
 }
Exemple #5
0
 public function execute(GWF_Module $module)
 {
     if (GWF_Session::haveCookies()) {
         GWF_Session::set(GWF_Browser::SESS_DETECTION, 1);
         GWF_Session::set(GWF_Browser::SESS_RESOLUTION, array(intval(Common::getGet('w', -1)), intval(Common::getGet('h', -1))));
         GWF_Website::redirectBack();
     } else {
         $url = Common::getGet('url', GWF_Session::getLastURL());
         if ($module->cfgFallbackSessions()) {
             GWF_Session::createFallback($url);
             GWF_Website::redirect(GWF_WEB_ROOT . 'index.php?mo=GWF&me=CookieCheck&level=2&url=' . urlencode($url));
         } else {
             GWF_Website::redirectBack();
         }
     }
 }
Exemple #6
0
function crackcha_next(WC_Challenge $chall)
{
    if (crackcha_round_over()) {
        header('Content-Type: text/plain');
        if (false === crackcha_insert_high($chall)) {
            echo GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
            return;
        } else {
            echo $chall->lang('msg_insert_high') . PHP_EOL;
            echo crackcha_reset($chall);
            return;
        }
    }
    require_once GWF_CORE_PATH . 'inc/3p/Class_Captcha.php';
    $chars = GWF_Random::randomKey(5, GWF_Random::ALPHAUP);
    crackcha_increase_count();
    GWF_Session::set('WCC_CRACKCHA_CHARS', $chars);
    $aFonts = array(GWF_PATH . 'extra/font/teen.ttf');
    $rgbcolor = GWF_CAPTCHA_COLOR_BG;
    $oVisualCaptcha = new PhpCaptcha($aFonts, 210, 42, $rgbcolor);
    $oVisualCaptcha->Create('', $chars);
}
Exemple #7
0
 private function profile(GWF_User $user)
 {
     if (false === ($profile = GWF_Profile::getProfile($user->getID()))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     $watcher = GWF_User::getStaticOrGuest();
     if ($profile->isRobotHidden() && $watcher->isWebspider()) {
         return $this->module->error('err_no_spiders');
     }
     if (false === ($prof_view = GWF_Session::getOrDefault('prof_view', false))) {
         $prof_view = array();
     }
     $uid = $user->getID();
     if (!in_array($uid, $prof_view, true)) {
         $prof_view[] = $uid;
         if (false === $profile->increase('prof_views', 1)) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
     }
     GWF_Session::set('prof_view', $prof_view);
     $tVars = array('user' => $user, 'profile' => $profile, 'jquery' => Common::getGet('ajax') !== false);
     return $this->module->templatePHP('profile.php', $tVars);
 }
Exemple #8
0
<?php

chdir('../../../');
define('GWF_PAGE_TITLE', 'The Last Hope');
require_once 'challenge/html_head.php';
require GWF_CORE_PATH . 'module/WeChall/solutionbox.php';
if (false === ($chall = WC_Challenge::getByTitle(GWF_PAGE_TITLE))) {
    $chall = WC_Challenge::dummyChallenge(GWF_PAGE_TITLE, 4, 'challenge/bsdhell/thelasthope/index.php', false);
}
$chall->showHeader();
if (strcasecmp(Common::getPost('answer'), 'username_password') === 0) {
    $count = GWF_Counter::getCount('WC_BSD_LH_DOLT');
    if (false === GWF_Session::getOrDefault('WC_BSD_LH_DOLT', false)) {
        $count++;
        GWF_Counter::saveCounter('WC_BSD_LH_DOLT', $count);
        GWF_Session::set('WC_BSD_LH_DOLT', '1');
    }
    echo GWF_HTML::message('The Last Hope', $chall->lang('msg_literal'), false);
    echo GWF_HTML::error('The Last Hope', $chall->lang('err_literal', array($count)), false);
} else {
    $chall->onCheckSolution();
}
htmlTitleBox($chall->lang('title'), $chall->lang('info', array('bsd_thelasthope.elf')));
formSolutionbox($chall);
echo $chall->copyrightFooter();
require_once 'challenge/html_foot.php';
Exemple #9
0
 public function setGuestNick($nick)
 {
     GWF_Session::set(self::$SESS_NICKNAME, $nick);
 }
Exemple #10
0
    GWF_Debug::setMailOnError(false);
    GWF_Debug::setDieOnError(false);
    $solved = call_user_func($function, $chall, $answer);
    GWF_Debug::setMailOnError(true);
    GWF_Debug::setDieOnError(true);
    if ($solved === true) {
        $level++;
        $next_func = 'train_regex_level_' . $level;
        if (!function_exists($next_func)) {
            echo GWF_HTML::message('WeChall', $chall->lang('msg_solved'), false);
            $chall->onChallengeSolved(GWF_Session::getUserID());
            $level = 1;
        } else {
            echo GWF_HTML::message('WeChall', $chall->lang('msg_next_level'), false);
        }
        GWF_Session::set('WCC_T_REGEX', $level);
    } else {
        echo GWF_HTML::error('WeChall', $chall->lang('err_wrong'), false);
    }
}
echo GWF_Box::box($chall->lang('info_' . $level), $chall->lang('title', array($level)));
formSolutionbox($chall);
echo $chall->copyrightFooter();
require_once 'challenge/html_foot.php';
##########
# Levels #
##########
function train_regex_level_1(WC_Challenge $chall, $answer)
{
    if ($answer === '/^$/') {
        return true;
Exemple #11
0
function zreload_func_reset($shellid, $args)
{
    GWF_Session::set('zreload', 1);
    zreloadClearShells();
    zreload_do_before_actions();
    return 'All cleared';
}
Exemple #12
0
chdir('../../../../');
define('WCC_IP6_SESS', 'WCC_IP6_SESS');
define('GWF_PAGE_TITLE', 'Training: IPv6');
require_once 'challenge/html_head.php';
require_once GWF_CORE_PATH . 'module/WeChall/solutionbox.php';
if (false === ($chall = WC_Challenge::getByTitle(GWF_PAGE_TITLE))) {
    $chall = WC_Challenge::dummyChallenge(GWF_PAGE_TITLE, 1, 'challenge/training/www/ip6/index.php');
}
$chall->showHeader();
$wechall = Module_WeChall::instance();
$level = GWF_Session::getOrDefault(WCC_IP6_SESS, 1);
if (isset($_POST['answer']) && is_string($_POST['answer'])) {
    if (true === wcc_ip6_check_answer($chall, $_POST['answer'], $level)) {
        $_POST['answer'] = '';
        GWF_Session::set(WCC_IP6_SESS, ++$level);
        echo GWF_HTML::message('WCIPv6', $chall->lang('msg_correct', array($level)));
    } else {
        echo $wechall->error('err_wrong');
    }
}
echo GWF_Box::box($chall->lang('info_' . $level), $chall->lang('title', array($level)));
formSolutionbox($chall);
echo $chall->copyrightFooter();
require_once 'challenge/html_foot.php';
function wcc_ip6_check_answer(WC_Challenge $chall, $answer, $level)
{
    require_once 'solutions.php';
    if ($level === count($solutions)) {
        $ip = $_SERVER['REMOTE_ADDR'];
        if (GWF_IP6::isV6($ip)) {
Exemple #13
0
 private static function genSolution()
 {
     $solution = GWF_Random::randomKey(32, GWF_Random::ALPHANUMUPLOW);
     GWF_Session::set('LIV_SMI_SOL', $solution);
     return $solution;
 }
Exemple #14
0
/**
 * Reset consecutive success counter.
 * @return void
 */
function blightFailed()
{
    GWF_Session::set('BLIGHT3_CONSECUTIVE', 0);
}
Exemple #15
0
 private function uploadedFile(GWF_Form $form)
 {
     if (false === ($file = $form->getVar('file'))) {
         //			echo $this->module->error('err_file');
         return;
     }
     $tempname = 'dbimg/dl/' . basename($file['tmp_name']);
     if (false === ($file = GWF_Upload::moveTo($file, $tempname))) {
         echo GWF_HTML::err('ERR_WRITE_FILE', array($tempname));
     }
     GWF_Session::set(self::SESS_FILE, $file);
 }
Exemple #16
0
 private function saveAjaxTimes(array $times)
 {
     GWF_Session::set(self::$SESS_LAGGY_AJAX, $times);
 }
Exemple #17
0
function salesman_gen_pricelist(WC_Challenge $chall)
{
    $product_names = array('Milk', 'Coffee', 'Sugar', 'Coke', 'Beer', 'Screwdriver', 'VacuumCleaner', 'Pepper', 'Salt', 'Water', 'Hammer', 'Chisel', 'Meat', 'Chicken', 'Eggs', 'MobilePhone', 'ChristmasTree', 'MusicCD', 'VideoDVD', 'Playstation', 'Ashtray', 'ExhaustingPipe', 'Windows', 'Router', 'LanCable', 'Harddisk', 'Bacon');
    $level = salesman_getLevel();
    $count = WCC_TR_CU_ITEMS_MIN + WCC_TR_CU_ITEMS_LEVEL * ($level - 1);
    shuffle($product_names);
    $list = array();
    for ($i = 0; $i < $count; $i++) {
        $item = array_pop($product_names);
        $list[$item] = rand(WCC_TR_CU_MIN_PRICE, WCC_TR_CU_MAX_PRICE);
    }
    GWF_Session::set('WCC_TR_CU_LIST', $list);
    return $list;
}
Exemple #18
0
 public function onRemOptions()
 {
     GWF_Session::set(self::SESS_OPTIONS, array());
     return '';
 }
Exemple #19
0
 public function onLoginAs()
 {
     GWF_Session::set(self::LOGIN_AS_SESS, 1);
 }
Exemple #20
0
 public static function saveTempOrder(GWF_Orderable $gdos)
 {
     GWF_Session::set(self::SESS_ORDER, serialize($gdos));
     return false;
     # no error
 }
Exemple #21
0
 function GenerateCode($challenge = true)
 {
     if ($challenge !== true) {
         $this->sCode = $challenge;
         return;
     }
     // reset code
     $this->sCode = '';
     // loop through and generate the code letter by letter
     for ($i = 0; $i < $this->iNumChars; $i++) {
         if (count($this->aCharSet) > 0) {
             // select random character and add to code string
             $this->sCode .= $this->aCharSet[GWF_Random::arrayItem($this->aCharSet)];
         } else {
             // select random character and add to code string
             $this->sCode .= chr(GWF_Random::rand(65, 90));
         }
     }
     // save code in session variable
     if ($this->bCaseInsensitive) {
         GWF_Session::set(CAPTCHA_SESSION_ID, strtoupper($this->sCode));
     } else {
         GWF_Session::set(CAPTCHA_SESSION_ID, $this->sCode);
     }
 }
Exemple #22
0
 private function onLoggedIn(GWF_User $user, $isAjax)
 {
     $last_url = GWF_Session::getLastURL();
     if (false === GWF_Session::onLogin($user, isset($_POST['bind_ip']))) {
         return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
     }
     require_once GWF_CORE_PATH . 'module/Login/GWF_LoginHistory.php';
     GWF_LoginHistory::insertEvent($user->getID());
     # save last login time
     $user->saveVar('user_lastlogin', time());
     if ($this->module->cfgCleanupAlways()) {
         GWF_LoginFailure::cleanupUser($user->getID());
     }
     if ($isAjax) {
         return sprintf('1:%s', GWF_Session::getSessID());
     } else {
         GWF_Session::set('GWF_LOGIN_BACK', $last_url);
         if (false !== ($lang = $user->getLanguage())) {
             GWF_Language::setCurrentLanguage($lang);
         }
         if (0 < ($fails = GWF_LoginFailure::getFailCount($user, $this->module->cfgTryExceed()))) {
             GWF_Session::set('GWF_LOGIN_FAILS', $fails);
         }
         GWF_Website::redirect(GWF_WEB_ROOT . 'welcome');
     }
 }
Exemple #23
0
 public static function savePreview(GWF_News $news)
 {
     GWF_Session::set(self::SESS_NEWSLETTER, serialize($news));
 }