Skip to content

Instantly share code, notes, and snippets.

@spaze
Created April 10, 2021 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spaze/f5dbf8fe178929431e7125b31c45e620 to your computer and use it in GitHub Desktop.
Save spaze/f5dbf8fe178929431e7125b31c45e620 to your computer and use it in GitHub Desktop.
xsssk sources snippet
<?php
function index()
{
echo ascii('xsssk');
}
function rick()
{
header('Location: https://media.giphy.com/media/Vuw9m5wXviFIQ/giphy.gif', true, 301);
}
function inlineJsIsBad()
{
header('Content-Type: application/javascript');
echo 'alert("💩 JavaScript is bad, m\'kay?");';
}
function iCanHasHtml()
{
return (!isset($_SERVER['HTTP_ACCEPT']) || strpos($_SERVER['HTTP_ACCEPT'], 'text/html') !== false);
}
function iCanHasPikshur()
{
return (strpos($_SERVER['HTTP_ACCEPT'], 'image/*') !== false);
}
function iCanHasJavaScript()
{
return (strpos($_SERVER['HTTP_ACCEPT'], '*/*') !== false);
}
// ---
if (iCanHasHtml()) {
index();
exit;
}
if (iCanHasPikshur()) {
rick();
exit;
}
if (iCanHasJavaScript()) {
inlineJsIsBad();
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment