curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0 pmt.mcpe.me-insta/1.0", "Accept: application/json"]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$ret = curl_exec($ch);
curl_close($ch);
function urlGet($url)
{
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
    curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
    curl_setopt($ch, CURLOPT_AUTOREFERER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, ["User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0 pmt.mcpe.me-insta/1.0", "Authorization: bearer " . $_SESSION["access_token"]]);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}
$json = json_decode($ret);
$_SESSION["access_token"] = $json->access_token;
$userData = json_decode(urlGet("https://api.github.com/user"));
$_SESSION["github_login"] = $userData->login;
$_SESSION["github_name"] = $userData->name;
header("Location: ./", true, 302);
Beispiel #2
0
/**
 * This function contacts the test page to initialize SSO.
 *
 * @param $test The test we are running.
 * @param $curl The curl handle we should use.
 * @return TRUE on success, FALSE on failure.
 */
function doLogout($test, $curl)
{
    if (!array_key_exists('url', $test)) {
        echo 'Missing required attribute url in test.' . "\n";
        return FALSE;
    }
    $params = array('op' => 'logout');
    $page = urlGet($curl, $test['url'], $params);
    if ($page === FALSE) {
        echo 'Failed to log out.' . "\n";
        return FALSE;
    }
    /* Skip HTTP-REDIRECT debug pagess. */
    while (TRUE) {
        $newPage = skipDebugPage($curl, $page);
        if ($newPage === $page) {
            break;
        }
        $page = $newPage;
    }
    return $page;
}
Beispiel #3
0
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}
$name = $_REQUEST["name"];
$version = $_REQUEST["version"];
$api = $_REQUEST["api"];
$files = ["plugin.yml" => ["content" => yaml_emit(["name" => $name, "author" => $_SESSION["github_name"], "version" => $version, "api" => [$api], "main" => $main = ($namespace = "_" . str_replace("-", "_", $_SESSION["github_login"]) . "\\" . $name) . "\\" . "Main", "commands" => [], "permissions" => []])], "src--" . str_replace("\\", "--", $main) . ".php" => ["content" => <<<EOF
<?php
namespace {$namespace};
use pocketmine\\command\\CommandSender;
use pocketmine\\command\\Command;
use pocketmine\\event\\Listener;
use pocketmine\\plugin\\PluginBase;

class Main extends PluginBase{
  public function onEnable(){
    // \$this->getServer()->getPluginManager()->registerEvents(\$this, \$this);
  }
  public function onCommand(CommandSender \$issuer, Command \$cmd, \$label, array \$params){
    switch(\$cmd->getName()){
    }
    return false;
  }
}
EOF
]];
$data = json_decode(urlGet("https://api.github.com/gists", true, json_encode(["description" => "{$name} - Auto-generated gist plugin stub by pmt.mcpe.me InstaPlugin", "files" => $files])));
header("Location: https://gist.github.com/" . $_SESSION["github_login"] . "/{$data->id}/edit");
Beispiel #4
0
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
    curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
    curl_setopt($ch, CURLOPT_AUTOREFERER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, ["User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0 pmt.mcpe.me-insta/1.0", "Authorization: bearer " . $_SESSION["access_token"]]);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}
$gist = json_decode($json = urlGet("https://api.github.com/gists/" . $_REQUEST["id"]));
if (isset($gist->message) and $gist->message === "Not Found") {
    echo "Gist Not Found!";
    die;
}
$files = $gist->files;
$phar = new Phar($path = "data/" . str_replace(["=", "+", "/"], "_", base64_encode(openssl_random_pseudo_bytes(8))) . ".phar");
$phar->startBuffering();
$phar->setStub("<?php __HALT_COMPILER();");
$phar->setSignatureAlgorithm(Phar::SHA512);
foreach ($gist->files as $name => $file) {
    $content = $file->content;
    $phar->addFromString(str_replace("--", "/", $name), $content);
}
$phar->stopBuffering();
?>