コード例 #1
0
ファイル: index.php プロジェクト: sinfocol/gwf3
function wccgpg_doit(WC_Challenge $chall, $user)
{
    if ($user === false) {
        echo GWF_HTML::error('GPG', $chall->lang('err_login'), false);
        return;
    }
    if (!$user->hasValidMail()) {
        echo GWF_HTML::error('GPG', $chall->lang('err_no_mail'));
        return;
    }
    $receiver = $user->getValidMail();
    if (!function_exists('gnupg_init')) {
        echo GWF_HTML::error('GPG', $chall->lang('err_server'));
        return;
    }
    if (false === ($fingerprint = GWF_PublicKey::getFingerprintForUser($user))) {
        $url = GWF_WEB_ROOT . 'account';
        echo GWF_HTML::error('GPG', $chall->lang('err_no_gpg', $url), false);
        return;
    }
    $solution = WC_CryptoChall::generateSolution('OHOYOUGOTGPG!', true, false);
    $mail = new GWF_Mail();
    $mail->setSubject($chall->lang('mail_s'));
    $mail->setSender(GWF_BOT_EMAIL);
    $mail->setReceiver($receiver);
    $mail->setBody($chall->lang('mail_b', array($user->displayUsername(), $solution)));
    if (false === $mail->sendToUser($user)) {
        echo GWF_HTML::err('ERR_MAIL_SENT');
    } else {
        echo GWF_HTML::message('GPG', $chall->lang('msg_mail_sent', array(htmlspecialchars($receiver))));
    }
}
コード例 #2
0
ファイル: index.php プロジェクト: sinfocol/gwf3
function bacon_prepare_hidden(WC_Challenge $chall)
{
    $solution = WC_CryptoChall::generateSolution('HamAndEggsAndBaconAndBeer!', true, false);
    $hidden = $chall->lang('hidden', array($solution));
    $hidden = str_replace(' ', 'X', $hidden);
    $hidden = strtoupper($hidden) . 'XX';
    return $hidden;
}
コード例 #3
0
ファイル: index.php プロジェクト: sinfocol/gwf3
function crypto_dig1_ciphertext(WC_Challenge $chall)
{
    WC_CryptoChall::checkPlaintext($chall->lang('plaintext'), true);
    $solution = WC_CryptoChall::generateSolution('The22_GHDIdiiiiEEEEZZ', true, true);
    $pt = $chall->lang('plaintext', array($solution));
    $ct = crypto_dig1_encrypt($pt);
    return $ct;
}
コード例 #4
0
ファイル: index.php プロジェクト: sinfocol/gwf3
function crypto_trans1_ciphertext(WC_Challenge $chall)
{
    WC_CryptoChall::checkPlaintext($chall->lang('plaintext'), true, true);
    $solution = WC_CryptoChall::generateSolution('The_GHSUBBBBEEEEZZ', true, true);
    $pt = $chall->lang('plaintext', array($solution));
    $ct = crypto_trans1_encrypt($pt);
    $ct = str_replace(' ', ' ', $ct);
    return $ct;
}
コード例 #5
0
ファイル: index.php プロジェクト: sinfocol/gwf3
function crypto_caesar_1_ciphertext(WC_Challenge $chall)
{
    WC_CryptoChall::checkPlaintext(strtoupper($chall->lang('plaintext')));
    $solution = WC_CryptoChall::generateSolution('The Foo The Bar The Lee', true, true);
    $pt = $chall->lang('plaintext', array($solution));
    $pt = strtoupper($pt);
    $pt = preg_replace('/[^A-Z ]/', '', $pt);
    $ct = crypto_caesar_1_encrypt($pt);
    return $ct;
}
コード例 #6
0
ファイル: index.php プロジェクト: sinfocol/gwf3
function crypto_caesar_2_ciphertext(WC_Challenge $chall)
{
    WC_CryptoChall::checkPlaintext($chall->lang('plaintext'), true);
    $solution = WC_CryptoChall::generateSolution('The_Foo!The!Bar_The!Lee', true, true);
    $pt = $chall->lang('plaintext', array($solution));
    //	$pt = strtoupper($pt);
    //	$pt = preg_replace('/[^A-Z]/', '', $pt);
    $ct = crypto_caesar_2_encrypt($pt);
    return WC_CryptoChall::hexdump($ct);
}
コード例 #7
0
ファイル: index.php プロジェクト: sinfocol/gwf3
function crypto_sub1_ciphertext(WC_Challenge $chall)
{
    WC_CryptoChall::checkPlaintext(strtolower($chall->lang('plaintext')), true, true);
    $solution = WC_CryptoChall::generateSolution('The_GHEEEEZZ', true);
    //	var_dump($solution);
    $chars1 = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
    $chars2 = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
    shuffle($chars1);
    shuffle($chars2);
    $map = array();
    for ($i = 0; $i < 26; $i++) {
        $map[$chars1[$i]] = $chars2[$i];
    }
    $pt = $chall->lang('plaintext', array($solution));
    $pt = strtoupper($pt);
    $pt = preg_replace('/[^A-Z ]/', '', $pt);
    $ct = crypto_sub1_encrypt($pt, $map);
    return $ct;
}
コード例 #8
0
ファイル: index.php プロジェクト: sinfocol/gwf3
function crypto_sub2_ciphertext(WC_Challenge $chall)
{
    WC_CryptoChall::checkPlaintext($chall->lang('plaintext'), true);
    $solution = WC_CryptoChall::generateSolution('The_GHttttttEEEEZZ', true, true);
    $chars1 = array();
    for ($i = 0; $i < 256; $i++) {
        $chars1[] = chr($i);
    }
    $chars2 = array();
    for ($i = 0; $i < 256; $i++) {
        $chars2[] = chr($i);
    }
    shuffle($chars1);
    shuffle($chars2);
    $map = array();
    for ($i = 0; $i < 256; $i++) {
        $map[$chars1[$i]] = $chars2[$i];
    }
    $pt = $chall->lang('plaintext', array($solution));
    $ct = crypto_sub2_encrypt($pt, $map);
    return WC_CryptoChall::hexdump($ct);
}
コード例 #9
0
ファイル: saw_lotion.php プロジェクト: sinfocol/gwf3
<?php

chdir('../../../../');
define('GWF_PAGE_TITLE', 'Encodings: URL');
require_once 'challenge/html_head.php';
if (false === ($chall = WC_Challenge::getByTitle(GWF_PAGE_TITLE))) {
    $chall = WC_Challenge::dummyChallenge(GWF_PAGE_TITLE, 1, 'challenge/training/encodings/url/index.php', false);
}
$chall->showHeader();
require_once GWF_CORE_PATH . 'module/WeChall/WC_CryptoChall.php';
$solution = WC_CryptoChall::generateSolution('OHNOU_R_Ls', true, true);
if (Common::getGetString('p', '') === $solution) {
    $chall->onChallengeSolved(GWF_Session::getUserID());
}
echo $chall->copyrightFooter();
require_once 'challenge/html_foot.php';
コード例 #10
0
ファイル: attachment.php プロジェクト: sinfocol/gwf3
<?php

chdir('../../../../');
require_once 'protected/config.php';
require_once '../gwf3.class.php';
$gwf = new GWF3(getcwd(), array('website_init' => true, 'autoload_modules' => true, 'load_module' => false, 'get_user' => true, 'do_logging' => true, 'blocking' => true, 'no_session' => false, 'store_last_url' => true, 'ignore_user_abort' => true));
//GWF_Session::start();
//GWF_Language::init();
//GWF_HTML::init();
$wechall = GWF_Module::loadModuleDB('WeChall');
require_once GWF_CORE_PATH . 'module/WeChall/WC_CryptoChall.php';
$jpg_path = 'challenge/training/stegano/attachment/the.jpg';
$jpg_file = file_get_contents($jpg_path);
$solution = WC_CryptoChall::generateSolution('YouLikeAttachmentEh', true, false);
$zip_path = GWF_PATH . 'extra/temp/steganoattach/' . GWF_Session::getSessID() . '.zip';
$zip = new GWF_ZipArchive();
if (false === $zip->open($zip_path, GWF_ZipArchive::CREATE)) {
    die('zip error 1');
}
if (false === $zip->addFromString('solution.txt', $solution)) {
    die('zip error 2');
}
if (false === $zip->close()) {
    die('zip error 3');
}
$jpg_file .= file_get_contents($zip_path);
unlink($zip_path);
header('Content-Type: image/jpeg');
echo $jpg_file;
die;
コード例 #11
0
ファイル: stageTWO222.php プロジェクト: sinfocol/gwf3
<?php

$secret = (require 'secret.php');
$key2 = file_get_contents('key2.key');
chdir('../../../');
define('GWF_PAGE_TITLE', '2013 New Years Special');
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, 3, 'challenge/quangntenemy/2013NYS/index.php', false);
}
$chall->showHeader();
require_once GWF_CORE_PATH . 'module/WeChall/WC_CryptoChall.php';
$SOLUTION = WC_CryptoChall::generateSolution($secret, true);
if (!($bot = GWF_User::getByName('Silvester2013'))) {
    die('oops');
}
if (!($user = GWF_User::getStaticOrGuest())) {
    die('oops');
}
if (isset($_POST['answer'])) {
    $chall->setVar('chall_solution', WC_Challenge::hashSolution($SOLUTION, true));
    $chall->onCheckSolution();
}
if (Common::getGetString('santa') === 'clause.json') {
    if ('' === ($rec = $user->getValidMail())) {
        echo GWF_HTML::error('Happy Holidays', $chall->lang('err_no_mail'), false);
    } else {
        $mail = new GWF_Mail();
        $mail->setSender($bot->getValidMail());
        $mail->setSenderName('Silvester Stallhuhn');
コード例 #12
0
ファイル: index.php プロジェクト: sinfocol/gwf3
<?php

chdir('../../../../');
define('GWF_PAGE_TITLE', 'Training: ASCII');
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/encodings/ascii/index.php', false);
}
$chall->showHeader();
require_once GWF_CORE_PATH . 'module/WeChall/WC_CryptoChall.php';
WC_CryptoChall::checkSolution($chall, 'OHNOASCII', true, true);
$solution = WC_CryptoChall::generateSolution('OHNOASCII', true, true);
$msg = $chall->lang('message', array($solution));
$message = '';
$len = strlen($msg);
for ($i = 0; $i < $len; $i++) {
    $message .= ', ' . ord($msg[$i]);
}
$message = substr($message, 2);
echo GWF_Box::box($chall->lang('info', array($message)), $chall->lang('title'));
formSolutionbox($chall);
echo $chall->copyrightFooter();
require_once 'challenge/html_foot.php';
コード例 #13
0
ファイル: index.php プロジェクト: sinfocol/gwf3
define('LSB_IMAGE_PATH', 'challenge/training/stegano/LSB/gizmore2.png');
chdir('../../../../');
define('GWF_PAGE_TITLE', 'Training: LSB');
require_once 'challenge/html_head.php';
require_once GWF_CORE_PATH . 'module/WeChall/WC_CryptoChall.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, 2, '/challenge/training/stegano/LSB/index.php', false);
}
$chall->showHeader();
if (isset($_POST['answer']) && is_string($_POST['answer'])) {
    $_POST['answer'] = strtoupper($_POST['answer']);
}
WC_CryptoChall::checkSolution($chall, 'YouAreNotLeanorado!', true, false);
$solution = WC_CryptoChall::generateSolution('YouAreNotLeanorado!', true, false);
$path = lsb_gen_image($solution);
$href = 'http://wechall.blogspot.com/2007/11/steganabara-explained.html';
$hidden_hint = sprintf('<p style="color: #eee;">Hidden Hint: %s</p>', $href);
$thx = 'buttmonkey';
if (false !== ($user = GWF_User::getByName($thx))) {
    $thx = $user->displayProfileLink();
}
echo GWF_Box::box($chall->lang('info', array($hidden_hint, $thx)), $chall->lang('title'));
$title = $chall->lang('img_title');
$htmlimg = sprintf('<img src="%s%s" alt="%s" title="%s" width="480" height="212" />', GWF_WEB_ROOT, $path, $title, $title);
echo GWF_Box::box($htmlimg, $title);
formSolutionbox($chall);
echo $chall->copyrightFooter();
require_once 'challenge/html_foot.php';
function lsb_gen_image($solution)
コード例 #14
-1
ファイル: index.php プロジェクト: sinfocol/gwf3
<?php

chdir('../../../../');
define('GWF_PAGE_TITLE', 'Stegano Attachment');
require_once 'challenge/html_head.php';
require_once GWF_CORE_PATH . 'module/WeChall/WC_CryptoChall.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, 2, '/challenge/training/stegano/attachment/index.php', false);
}
$chall->showHeader();
WC_CryptoChall::checkSolution($chall, 'YouLikeAttachmentEh', true, false);
echo GWF_Box::box($chall->lang('info', array('attachment.php')), $chall->lang('title'));
formSolutionbox($chall);
echo $chall->copyrightFooter();
require_once 'challenge/html_foot.php';