Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?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");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement