Add index.php
This commit is contained in:
commit
0c948d01e2
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
// Check if the ?c query parameter is present
|
||||
$cookies = isset($_GET['c']) ? explode(',', urldecode($_GET['c'])) : [];
|
||||
$targetUrl = isset($_GET['u']) ? urldecode($_GET['u']) : '';
|
||||
|
||||
// Set the cookies
|
||||
foreach ($cookies as $cookie) {
|
||||
$parts = explode('=', $cookie, 2);
|
||||
if (count($parts) === 2) {
|
||||
$name = trim($parts[0]);
|
||||
$value = addslashes(trim($parts[1]));
|
||||
setcookie($name, $value, 0, '/');
|
||||
$_COOKIE[$name] = $value; // Update the $_COOKIE superglobal
|
||||
}
|
||||
}
|
||||
|
||||
// Start the HTML output
|
||||
echo '<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Hello from z0rs</title>
|
||||
<style>
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>';
|
||||
|
||||
// Print all cookies
|
||||
echo '<h1>Cookies:</h1>';
|
||||
echo '<pre>';
|
||||
print_r($_COOKIE);
|
||||
echo '</pre>';
|
||||
|
||||
// If the ?u query parameter is present, generate the cURL command
|
||||
if (!empty($targetUrl)) {
|
||||
$curlCommand = 'curl -X GET "' . $targetUrl . '" \\' . PHP_EOL;
|
||||
foreach ($_COOKIE as $cookieName => $cookieValue) {
|
||||
$curlCommand .= '--cookie "' . $cookieName . '=' . addslashes($cookieValue) . '" \\' . PHP_EOL;
|
||||
}
|
||||
echo '<button onclick="copyToClipboard()">Copy cURL Command</button>';
|
||||
echo '<pre id="curlCommand" style="display: none;">' . rtrim($curlCommand, ' \\' . PHP_EOL) . '</pre>';
|
||||
}
|
||||
|
||||
echo '</body>
|
||||
<script>
|
||||
function copyToClipboard() {
|
||||
const curlCommand = document.getElementById("curlCommand").textContent;
|
||||
navigator.clipboard.writeText(curlCommand)
|
||||
.then(() => alert("cURL command copied to clipboard!"))
|
||||
.catch((error) => alert("Failed to copy cURL command: " + error));
|
||||
}
|
||||
</script>
|
||||
</html>';
|
||||
Loading…
Reference in New Issue