function DecryptAll_SQL($s, $key) { $s = DecryptROT($s); $s = SaXoro($s, $key); $s = Decrypt($s); return AddSlashes(trim(str_replace("^(**)^", "&", $s))); }
<?php $encb64 = "cJ4ZJD3Vkf3Dv5uxrWiTQg=="; $pwd = "123"; $salt = "3"; $enc = base64_decode($encb64); $decpad = Decrypt($enc, $pwd, $salt); // Remove the padding $pad = ord($decpad[($len = strlen($decpad)) - 1]); $dec = substr($decpad, 0, strlen($decpad) - $pad); echo "Enc: " . bin2hex($enc) . "\r\n"; echo "Dec: " . $dec . "\r\n"; function Decrypt($ciphertext, $password, $salt) { $key = PBKDF1($password, $salt, 100, 32); $iv = PBKDF1($password, $salt, 100, 16); //echo "Key: " . bin2hex($key) . "\r\n"; //echo "IV: " . bin2hex($iv) . "\r\n"; // NB: Need 128 not 256 and CBC mode to be compatible $result = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $ciphertext, MCRYPT_MODE_CBC, $iv); return $result; } function PBKDF1($pass, $salt, $count, $cb) { // This is very approximately the way that the Microsoft version of // PasswordDeriveBytes works. /// /// !!!WARNING!!! /// // This is a BAD function! // Irrespective of the fact that the use of PBKDF1 is not recommended anyway.
exit; } } } } } } } } } } $link = 'https://picasaweb.google.com/' . str_replace('%26', '&', $link); } else { if (endsWith($link, "penc")) { $pos = stripos($link, ".com/", 4) + 5; $link = substr($link, 0, $pos) . Decrypt(substr($link, $pos, -strlen("penc")), $key); $link = str_replace('%26', '&', $link); } } loguear(FALSE); $useheader = ""; $useragent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0"; $referer = ""; $autoreferer = ""; $usehttpheader = true; $custheader = ""; $ucookie = ""; $encoding = ""; $timeout = ""; $follow = ""; $mpost = "";
if (GetUyeID() == false) { $response["Sonuc"] = false; $response["Mesaj"] = "Giriş Yapılmadı"; echoRespnse(200, $response); return; } $response = array(); $UyeID = Decrypt($app->request->get("UyeID")); $db = new DbHandler(); $response["Data"] = $db->KullaniciGetirByUyeID($UyeID); if ($response["Data"] != false) { $response["Sonuc"] = true; $response["Mesaj"] = ""; } else { $response["Sonuc"] = false; $response["Mesaj"] = "Böyle bir kullanıcı Bulunamadı"; } echoRespnse(200, $response); }); $app->post("/Log", function () use($app) { if (GetUyeID() == false) { $response["Sonuc"] = false; $response["Mesaj"] = "Giriş Yapılmadı"; echoRespnse(200, $response); return; } $response = array(); $Mesaj = Decrypt($app->request->post("Mesaj")); echoRespnse(200, $response); }); $app->run();
$key_Ks3 = getKs($key3); } else { $key_Ks3 = $key_Ks1; } if ($mode === "encrypt") { //get 64 bit encrypted data: $enc_data = Encrypt(Decrypt(Encrypt($data, $key_Ks1), $key_Ks2), $key_Ks3); //64 to dec and dec to hex: $dec_enc_data = ArrayToDec($enc_data); $hex_enc_data = DecToHex($dec_enc_data); echo "<br />"; echo "encription result:<br />"; test($hex_enc_data, 1); } elseif ($mode === "decrypt") { //get 64 bit decrypted data: $dec_data = Decrypt(Encrypt(Decrypt($data, $key_Ks3), $key_Ks2), $key_Ks1); //64 to dec and dec to hex: $dec_dec_data = ArrayToDec($dec_data); $hex_dec_data = DecToHex($dec_dec_data); echo "<br />"; echo "decription result:<br />"; test($hex_dec_data, 1); } } //end if ?> </div> </body> <script> function SameToKey1() { var key1 = document.getElementsByName("key1[]");
} return $string; } function endsWith($haystack, $needle) { $length = strlen($needle); if ($length == 0) { return true; } return substr($haystack, -$length) === $needle; } $link = $_POST['url']; if (endsWith($link, "penc")) { $pos = stripos($link, ".com/", 4) + 5; echo substr($link, $pos, -strlen("penc")) . "<br>"; $link = substr($link, 0, $pos) . Decrypt(substr($link, $pos, -strlen("penc")), "dDeFG34Jr342DDgrL"); echo $link; } $useheader = $_POST['iheader']; $useragent = $_POST['iagent']; $referer = $_POST['ireferer']; $autoreferer = $_POST['iautoreferer']; $usehttpheader = $_POST['ihttpheader']; $custheader = $_POST['icustheader']; $ucookie = $_POST['icookie']; $encoding = $_POST['iencoding']; $timeout = $_POST['itimeout']; $follow = $_POST['ifollow']; $mpost = $_POST['ipost']; $mpostfield = $_POST['ipostfield']; $proxytunnel = $_POST['iproxytunnel'];
//========================================[ SAVE CHANGES ]========================================// // Set the keywords with the updated session arrays and // update the masks class with the changed values $keywords[$connect] = $_SESSION[$ID][$connect]; $keywords[$special] = $_SESSION[$ID][$special]; $keywords[$admin] = $_SESSION[$ID][$admin]; // If the login is encrypted, it must be decrypted // before the values are to be used in the installer if ($steps[STEP_DBCONNECT]['encryptlogin']) { // Trim is added here because when Blowfish is decrypted it adds four // unprintable characters at the end of the string, which trim removes $keywords[$connect]['hostname'] = trim(Decrypt($_SESSION[$ID][$connect]['hostname'])); $keywords[$connect]['username'] = trim(Decrypt($_SESSION[$ID][$connect]['username'])); $keywords[$connect]['password'] = trim(Decrypt($_SESSION[$ID][$connect]['password'])); $keywords[$connect]['database'] = trim(Decrypt($_SESSION[$ID][$connect]['database'])); } // If admin data is encrypted, decrypt the data before continue if ($steps[STEP_ROOTUSER]['encryptdata']) { foreach ($_SESSION[$ID][$admin] as $adminKey => $defaultValue) { $keywords[$admin][$adminKey] = trim(Decrypt($defaultValue)); } } //========================================[ CLEAN-UP ]========================================// // Remove the variables not used again unset($ID); unset($connect); unset($admin); unset($special); unset($stepkey); unset($agreemt); unset($requested);
// Set the keywords with the updated session arrays and // update the masks class with the changed values $keywords[$connect] = $_SESSION[$ID][$connect]; $keywords[$serial] = $_SESSION[$ID][$serial]; $keywords[$special] = $_SESSION[$ID][$special]; $keywords[$admin] = $_SESSION[$ID][$admin]; $keywords[STEP_ADDEDINFO] = $_SESSION[$ID][STEP_ADDEDINFO]; // If the login is encrypted, it must be decrypted // before the values are to be used in the installer if ($steps[STEP_DBCONNECT]['encryptlogin']) { // Trim is added here because when Blowfish is decrypted it adds four // unprintable characters at the end of the string, which trim removes $keywords[$connect]['hostname'] = trim(Decrypt($_SESSION[$ID][$connect]['hostname'])); $keywords[$connect]['username'] = trim(Decrypt($_SESSION[$ID][$connect]['username'])); $keywords[$connect]['password'] = trim(Decrypt($_SESSION[$ID][$connect]['password'])); $keywords[$connect]['database'] = trim(Decrypt($_SESSION[$ID][$connect]['database'])); } // If admin data is encrypted, decrypt the data before continue if ($steps[STEP_ROOTUSER]['encryptdata']) { foreach ($_SESSION[$ID][$admin] as $adminKey => $defaultValue) { $keywords[$admin][$adminKey] = trim($defaultValue); } } //========================================[ CLEAN-UP ]========================================// // Remove the variables not used again unset($ID); unset($connect); unset($admin); unset($special); unset($stepkey); unset($agreemt);
{ $block = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, 'cbc'); $keysize = mcrypt_get_key_size(MCRYPT_RIJNDAEL_128, 'cbc'); $ivsize = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, 'cbc'); echo "Block size: " . $block . "\r\n"; echo "Key size: " . $keysize . "\r\n"; echo "IV size: " . $ivsize . "\r\n"; $pad = $block - strlen($src) % $block; $src .= str_repeat(chr($pad), $pad); $enc = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $src, MCRYPT_MODE_CBC, $iv); $r = base64_encode($enc); return $r; } function Decrypt($src, $key, $iv) { $enc = base64_decode($src); $dec = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $enc, MCRYPT_MODE_CBC, $iv); $block = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, 'cbc'); $pad = ord($dec[($len = strlen($dec)) - 1]); return substr($dec, 0, strlen($dec) - $pad); } $plain = "Mary had a little lamb"; //$key1 = "09CB0785F13CD0D557C0940E72E0DCDC86CDC89769044E95DB51A782E7D996FFF3"; //$iv1 = "09CB0785F13CD0D557C0940E72E0DCDC"; $key1 = "09CB0785F13CD0D557C0940E72E0DCDC"; $iv1 = "09CB0785F13CD0D5"; $enc1 = Encrypt($plain, $key1, $iv1); $dec1 = Decrypt($enc1, $key1, $iv1); echo "Src: " . $plain . "\n"; echo "Enc: " . $enc1 . "\n"; echo "Dec: " . $dec1 . "\n";