Skip to content

Instantly share code, notes, and snippets.

@numanturle
Created August 30, 2020 21:49
Show Gist options
  • Select an option

  • Save numanturle/ff08d79e9bbc6bd9bd631b8539a4c79b to your computer and use it in GitHub Desktop.

Select an option

Save numanturle/ff08d79e9bbc6bd9bd631b8539a4c79b to your computer and use it in GitHub Desktop.
soderctf misc 2
<?php
$flag = "SODERCTF[C0K_M7_K0L4Y_G3LcI_D3L1_Y1N3_1S_BaSINde_fanta_s3verim]";
function strigToBinary($string)
{
$characters = str_split($string);
$binary = [];
foreach ($characters as $character) {
$data = unpack('H*', $character);
$binary[] = base_convert($data[1], 16, 2);
}
return implode(' ', $binary);
}
$ac = strigToBinary($flag);
$ac = strrev($ac);
$parca = explode(" ", $ac);
for ($i = 0; $i < count($parca); $i++) {
$ne = $parca[$i];
// amele styleee
$degis = str_replace("00000000", "8", $ne);
$degis = str_replace("0000000", "7", $degis);
$degis = str_replace("000000", "6", $degis);
$degis = str_replace("00000", "5", $degis);
$degis = str_replace("0000", "4", $degis);
$degis = str_replace("0000", "3", $degis);
$degis = str_replace("00", "2", $degis);
$degis = str_replace("0", "o", $degis);
$parca[$i] = $degis;
}
print_r($parca);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment