function theSkeletonDirectory()
{
    $directory = getBowerDirectory() . 'skeleton-css/';
    if (!fileExists($directory)) {
        consoleLog("You seem to be missing the 'skeleton-css' folder", 'error');
    }
    print $directory;
}
예제 #2
0
function validReg($username, $dbHandle, $password, $password2)
{
    $USERNAME_MIN = 6;
    $USERNAME_MAX = 30;
    $PASS_MIN = 0;
    $valid = false;
    if (ctype_alnum($username)) {
        $query = "SELECT username\n\t\t\tFROM user_list\n\t\t\tWHERE username = '******'";
        $result = $dbHandle->query($query)->fetch_array(MYSQLI_BOTH);
        $valid = true;
    } else {
        $_SESSION['error'] = true;
        $_SESSION['errorMess'] = "USERNAME MUST BE ALPHANUMERIC";
        consoleLog($_SESSION['errorMess']);
    }
    if ($valid) {
        if ($result['username'] == $username) {
            $_SESSION['error'] = true;
            $_SESSION['errorMess'] = "USER ALREADY EXISTS";
            consoleLog($_SESSION['errorMess']);
            $valid = false;
        } else {
            if (strlen($password) == $PASS_MIN) {
                $_SESSION['error'] = true;
                $_SESSION['errorMess'] = "PLEASE ENTER USERNAME AND PASSWORD";
                consoleLog($_SESSION['errorMess']);
                $valid = false;
            } else {
                if ($password != $password2) {
                    $_SESSION['error'] = true;
                    $_SESSION['errorMess'] = "PASSWORDS MUST MATCH";
                    consoleLog($_SESSION['errorMess']);
                    $valid = false;
                } else {
                    if (strlen($username) < $USERNAME_MIN) {
                        $_SESSION['error'] = true;
                        $_SESSION['errorMess'] = "USERNAME TOO SHORT. MUST BE AT LEAST 6 CHARACTERS";
                        consoleLog($_SESSION['errorMess']);
                        $valid = false;
                    } else {
                        if (strlen($username) > $USERNAME_MAX) {
                            $_SESSION['error'] = true;
                            $_SESSION['errorMess'] = "USERNAME TOO LONG";
                            consoleLog($_SESSION['errorMess']);
                            $valid = false;
                        }
                    }
                }
            }
        }
    }
    return $valid;
}
예제 #3
0
function checkCookie($dbHandle, $dbHost, $dbUser, $dbPass, $dbName)
{
    $dbHandle = dbConnect($dbHandle, $dbHost, $dbUser, $dbPass, $dbName);
    if (isset($_COOKIE["user_id"])) {
        $query = "SELECT * FROM user_list WHERE user_id=" . $_COOKIE['user_id'];
        consoleLog($query);
        $user = $dbHandle->query($query);
        $userinfo = $user->fetch_array(MYSQLI_BOTH);
        consoleLog($userinfo);
        consoleLog($_COOKIE["token"]);
        consoleLog($userinfo["token"]);
        if ($_COOKIE["token"] == $userinfo["token"]) {
            consoleLog('got here');
            return true;
        }
        consoleLog('got here :-(');
        return false;
    }
}
예제 #4
0
function ExtractFlash($flash_file)
{
    consoleLog("Analyzing SWF: {$flash_file}");
    $matches = [];
    $swf_output = shell_exec("swfextract {$flash_file}");
    preg_match("/PNGs: ID\\(s\\) (.+)/", $swf_output, $matches);
    $ranges = explode(",", $matches[1]);
    global $figure_types;
    $new_ranges = [];
    $count = 0;
    foreach ($ranges as $index => $value) {
        if (strpos($value, '-') !== false) {
            $explode = explode('-', $value);
            for ($i = $explode[0]; $i <= $explode[1];) {
                $new_ranges[$count++] = $i++;
            }
        } else {
            $new_ranges[$count++] = $value;
        }
    }
    $kaka = [];
    $hehe = shell_exec("swfdump -s {$flash_file}");
    consoleLog("Extracting SWF: {$flash_file}");
    foreach ($new_ranges as $index => $value) {
        $name = sprintf("%04d", $value);
        preg_match("/exports {$name} as \"(.+)\"/", $hehe, $kaka);
        $real_value = $kaka[1];
        $real_values = $real_value;
        foreach ($figure_types as $index2 => $value2) {
            if (strpos($real_values, "_{$value2}_") !== false) {
                $exploded = explode("_", $real_values);
                $key_net = array_search($value2, $exploded);
                $real_exploded = array_slice($exploded, $key_net - 2);
                $real_values = implode("_", $real_exploded);
                break;
            }
        }
        consoleLog("File Name: {$real_value} : {$real_values}");
        $file_name = OUTPUT_DIRECTORY . 'sprites/' . $real_values . '.png';
        shell_exec("swfextract {$flash_file} -p {$value} -o \"{$file_name}\"");
    }
}
예제 #5
0
function ExtractFlash($flash_file)
{
    consoleLog("Analyzing SWF: {$flash_file}");
    $matches = [];
    $swf_output = shell_exec("swfextract {$flash_file}");
    preg_match("/PNGs: ID\\(s\\) (.+)/", $swf_output, $matches);
    $ranges = explode(",", $matches[1]);
    $new_ranges = [];
    $count = 0;
    foreach ($ranges as $index => $value) {
        if (strpos($value, '-') !== false) {
            $explode = explode('-', $value);
            for ($i = $explode[0]; $i <= $explode[1];) {
                $new_ranges[$count++] = $i++;
            }
        } else {
            $new_ranges[$count++] = $value;
        }
    }
    $kaka = [];
    $hehe = shell_exec("swfdump -s {$flash_file}");
    consoleLog("Extracting SWF: {$flash_file}");
    foreach ($new_ranges as $index => $value) {
        $name = sprintf("%04d", $value);
        preg_match("/exports {$name} as \"(.+)\"/", $hehe, $kaka);
        $real_value = $kaka[1];
        $i = array_search('1', array_map("is_numeric", $p = explode("_", $real_value)));
        $j = array_slice($p, 0, $i);
        $k = array_slice($p, $i);
        $real_values = implode("_", array_merge(array_unique($j), $k));
        consoleLog("File Name: {$real_value} : {$real_values}");
        $file_name = OUTPUT_DIRECTORY . 'sprites/' . $real_values . '.png';
        shell_exec("swfextract {$flash_file} -p {$value} -o \"{$file_name}\"");
    }
}
예제 #6
0
function ExtractSWF($filename)
{
    $swfID = basename($filename, ".swf");
    consoleLog("<b>Extract SWF: " . $swfID . ".swf</b>");
    consoleLogBlank();
    checkDIR(OUTPUT_DIRECTORY . $swfID);
    $raw = file_get_contents_with_console($filename);
    if ($raw === false) {
        return false;
    }
    if (substr($raw, 0, 3) == 'CWS') {
        $raw = 'F' . substr($raw, 1, 7) . gzuncompress(substr($raw, 8));
    }
    list(, $file_length) = unpack('V', substr($raw, 4, 4));
    $header_length = 8 + 1 + ceil(((ord($raw[8]) >> 3) * 4 - 3) / 8) + 4;
    $symbols = [];
    $pngs = [];
    $xmls = [];
    consoleLog("Analyzing SWF...");
    for ($cursor = $header_length; $cursor < $file_length;) {
        consoleLogProgressBar($cursor, $file_length);
        list(, $tag_header) = unpack('v', substr($raw, $cursor, 2));
        $cursor += 2;
        list($tag_code, $tag_length) = [$tag_header >> 6, $tag_header & 0x3f];
        if ($tag_length == 0x3f) {
            list(, $tag_length) = unpack('V', substr($raw, $cursor, 4));
            $cursor += 4;
        }
        switch ($tag_code) {
            case 36:
                if ($swfID != "Habbo") {
                    $tag = SWFREAD_PNG(substr($raw, $cursor, $tag_length));
                    $pngs[$tag['symbol_id']] = $tag['im'];
                }
                break;
            case 76:
                $symbols = SWFREAD_SYM(substr($raw, $cursor, $tag_length));
                break;
            case 87:
                $tag = SWFREAD_BIN(substr($raw, $cursor, $tag_length));
                $xmls[$tag['symbol_id']] = $tag['data'];
                break;
        }
        $cursor += $tag_length;
    }
    consoleLogProgressBar($file_length, $file_length);
    consoleLogBlank();
    consoleLogBlank();
    consoleLog("Analyzing XML...");
    $cnt = 0;
    $xmls_length = count($xmls);
    foreach ($xmls as $symbol_id => $xml) {
        $cnt++;
        consoleLogProgressBar($cnt, $xmls_length, "items");
        $name = isset($symbols[$symbol_id]) ? $symbols[$symbol_id] : 'symbol_' . $symbol_id;
        $_xml = @simplexml_load_string($xml);
        if ($_xml !== false) {
            $_name = $_xml->getName();
            if (($_name == "animationSet" || $_name == "geometry" || $_name == "partSets" || $_name == "actions") && $swfID == "Habbo") {
                switch ($_name) {
                    case "animationSet":
                        $name = "HabboAvatarAnimation";
                        ExtractAvatarAnimation($_xml);
                        break;
                    case "geometry":
                        $name = "HabboAvatarGeometry";
                        ExtractAvatarGeometry($_xml);
                        break;
                    case "partSets":
                        $name = "HabboAvatarPartSets";
                        ExtractAvatarPartSets($_xml);
                        break;
                    case "actions":
                        $name = "HabboAvatarActions";
                        ExtractAvatarActions($_xml);
                        break;
                    case "figuredata":
                        $name = "HabboAvatarFigure_" . $symbol_id;
                        ExtractFigureData($_xml, $name . ".json");
                }
            } elseif ($_name == "manifest" && $swfID != "Habbo") {
                ExtractCastOffset($_xml);
            }
            //file_put_contents(OUTPUT_DIRECTORY.$swfID.'/'.$name.'.xml', $xml);
        } else {
            //file_put_contents(OUTPUT_DIRECTORY.$swfID.'/'.$name.'.dat', $xml);
        }
    }
    consoleLogBlank();
    consoleLogBlank();
    consoleLog("Extracting image cast files...");
    $cnt = 0;
    $pngs_length = count($pngs);
    foreach ($pngs as $symbol_id => $png) {
        $cnt++;
        consoleLogProgressBar($cnt, $pngs_length, "images");
        $name = isset($symbols[$symbol_id]) ? $symbols[$symbol_id] : 'symbol_' . $symbol_id;
        ob_start();
        imagepng($png);
        $image_data = ob_get_contents();
        ob_end_clean();
        file_put_contents(OUTPUT_DIRECTORY . $swfID . '/' . $name . '.png', $image_data);
        if (strpos($name, 'hh_human_item_h_') === 0) {
            pushItemSet($name);
        }
        //consoleLog('<img src="data:image/png;base64,'.base64_encode($image_data).'"> ');
    }
    consoleLogBlank();
    consoleLogBlank();
}
예제 #7
0
function ExtractFlash($flash_file)
{
    consoleLog("Analyzing SWF: {$flash_file}");
    $matches = [];
    $swf_output = shell_exec("swfextract {$flash_file}");
    preg_match("/PNGs: ID\\(s\\) (.+)/", $swf_output, $matches);
    $ranges = explode(",", $matches[1]);
    $new_ranges = [];
    $count = 0;
    foreach ($ranges as $index => $value) {
        if (strpos($value, '-') !== false) {
            $explode = explode('-', $value);
            for ($i = $explode[0]; $i <= $explode[1];) {
                $new_ranges[$count++] = $i++;
            }
        } else {
            $new_ranges[$count++] = $value;
        }
    }
    $kaka = [];
    $hehe = shell_exec("swfdump -s {$flash_file}");
    consoleLog("Extracting SWF: {$flash_file}");
    foreach ($new_ranges as $index => $value) {
        $name = sprintf("%04d", $value);
        preg_match("/exports {$name} as \"(.+)\"/", $hehe, $kaka);
        $real_value = $kaka[1];
        $real_value = str_replace('HabboRoomContent_', '', $real_value);
        consoleLog("File Name: {$real_value}");
        $file_name = OUTPUT_DIRECTORY . 'masks/' . $real_value . '.png';
        shell_exec("swfextract {$flash_file} -p {$value} -o \"{$file_name}\"");
    }
}