Created
February 28, 2018 22:50
-
-
Save HFahlstedt/afa53f0ecfa69ee44ad6181085751e42 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$defaultdata = array( "showpassword"=>"no", "bgcolor"=>"#ffffff"); | |
$plain_text = json_encode($defaultdata); | |
$default_cookie_value = "ClVLIh4ASCsCBE8lAxMacFMZV2hdVVotEhhUJQNVAmhSEV4sFxFeaAw="; | |
$decoded_cookie_value = base64_decode($default_cookie_value); | |
function my_xor_encrypt($in, $key) { | |
$text = $in; | |
$outText = ''; | |
for ($i=0; $i < strlen($text); $i++) { | |
$outText .= $text[$i] ^ $key[$i % strlen($key)]; | |
} | |
return $outText; | |
} | |
$secret_key_repeated = my_xor_encrypt($decoded_cookie_value, $plain_text); | |
$secret_key = ''; | |
for ($i=0; $i < strlen($secret_key_repeated); $i++) { | |
$secret_key .= $secret_key_repeated[$i]; | |
$encrypted_value = my_xor_encrypt($plain_text, $secret_key); | |
if ($encrypted_value == $decoded_cookie_value) { | |
break; | |
} | |
} | |
$defaultdata['showpassword'] = 'yes'; | |
$ivil_cookie = base64_encode(my_xor_encrypt(json_encode($defaultdata), $secret_key)); | |
print "$ivil_cookie\n"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment