Combreal icon

cesarCrypto.php

Combreal | PRO | 07/18/20 04:22:43 PM UTC | 0 ⭐ | 2105 👁️ | Never ⏰ | []
PHP |

1.38 KB

|

None

|

0 👍

/

0 👎

<?php
function getContent($url, $cookiePath)
{
//used Export Cookies extension to get NC cookie
$ch = curl_init ();
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ( $ch, CURLOPT_URL, $url );
curl_setopt ( $ch, CURLOPT_HEADER, 0 );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $ch, CURLOPT_CONNECTTIMEOUT, 0 );
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiePath);
curl_setopt($ch, CURLOPT_VERBOSE, true);
$file_contents = curl_exec ( $ch );
if (curl_errno ( $ch )) {
    echo curl_error ( $ch );
    curl_close ( $ch );
    exit ();
}
curl_close ( $ch );
return $file_contents;
}
$content = getContent("https://www.newbiecontest.org/epreuves/prog/prog5.php", 'C:/Temp/cookies.txt');
$key = (int) filter_var($content, FILTER_SANITIZE_NUMBER_INT);
if (preg_match("/'(.+)'/", $content, $m))
{
    $m[0] = substr($m[0], 1);
    $m[0] = substr($m[0], 0, strpos($m[0],"'"));
}
$alphabet = "abcdefghijklmnopqrstuvwxyz";
$newAlphabet = substr($alphabet, $key);
$rest = substr($alphabet, 0, $key);
$newAlphabet = $newAlphabet.$rest;
$myArray = str_split($m[0]);
$decrypt = ""; 
foreach($myArray as $character)
{
    $pos = strpos($newAlphabet, $character);
    $decrypt = $decrypt.$alphabet[$pos];
}
$subm = "https://www.newbiecontest.org/epreuves/prog/verifpr5.php?solution=" . $decrypt;
header("Location: $subm");
?>

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎