php ami_ban.php InvalidAccountID > /dev/null 2 &
<?php
$host="localhost";
$username="admin";
$secret="1133";
$socket = fsockopen($host,"5038", $errno, $errstr,10);
if (!$socket){
echo "$errstr ($errno)\n";
}else{
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: $username\r\n");
fputs($socket, "Secret: $secret\r\n\r\n");
fputs($socket, "Action: WaitEvent\r\n");
fputs($socket, "Action: Logoff\r\n\r\n");
while(!feof($socket)){
$result=fread($socket,5000);
if (preg_match("/\b$argv[1]\b/i", $result, $match)){
$r=explode("\n",$result);
$channel=explode("/",$r[9]);
echo "fail to auntehticate $channel[2]\n";
foreach( $r as $key=>$value){
echo " $key : $value\n";
system( "echo \" $key : $value\n \" >>/root/ban.log");
system("/root/block.sh $channel[2]");
}
continue;
}
}
}
fclose($socket);
?>
No hay comentarios:
Publicar un comentario