IRC

By supafreky on Mar 10, 2008

Created to be used for connecting to IRC clients using PHP on a UNIX system.

<?php
function phpbot($server, $port, $user, $nick, $realname, $channel) {
  $sockname = fsockopen($server, $port, $errno, $errstr) or exit($errno . " " . $errstr);
  $repeat = 0;
  while (($sockread = fgets($sockname, 512))) {
    $sockread = explode(" ", $sockread);
    if (!$repeat) {
      fputs($sockname, "NICK " . $nick . "\r\n");
      fputs($sockname, "USER " . $user . " \"\" \"\" :" . $realname . "\r\n");
    }
    else if ($sockread[0] == "PING") {
      fputs($sockname, "PONG :" . $sockread[1] . "\r\n");
    }
    else if ($sockread[1] == "001") {
      fputs($sockname, "JOIN " . $channel . "\r\n");
    }
    else if (fnmatch("43?", $sockread[1])) {
      fputs($sockname, "NICK " . $nick . str_repeat(mt_rand(0, 9), 3) . "\r\n");
    }
    $repeat++;
  }
}
?>

Comments

Sign in to comment.
Joshuaxiong1   -  Mar 08, 2009

It is possible to use php to botnet people?

 Respond  
LordHawk   -  Mar 13, 2008

<?php
if(!function_exists(\'fnmatch\')) {
function fnmatch($pattern, $string) {
return preg_match(\"#^\".strtr(preg_quote($pattern, \'#\'), array(\'\\' => \'.\', \'\?\' => \'.\')).\"$#i\", $string);
}// end
}// end if
?>

this is the function i have to override the fnmatch. however all it does is have phpbot join the channel.

 Respond  
LordHawk   -  Mar 13, 2008

hmm, what can i do to edit it?

 Respond  
F*U*R*B*Y*   -  Mar 11, 2008

the only part that doesn\'t work on the windows system is the fnmatch, besides that it will work :)

 Respond  
LordHawk   -  Mar 10, 2008

How would i edit this to run on a windows system?

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.