Created
November 14, 2012 02:23
-
-
Save bongtrop/4069877 to your computer and use it in GitHub Desktop.
Fack people in irc chenel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use IO::Socket; | |
sub random_name { | |
my @name=("Somsak","Somsee","Somchai","Sommay","Somrede","Sommud","Sombut","Somluk","Somji","Somga","Somtom","Sommanod","Som","Somsed","Somkaru"); | |
my $random=$name[rand(@name)]; | |
return $random; | |
} | |
for(my $i=0;$i<10;$i++) { | |
my $pid=fork(); | |
if ($pid) { | |
next; | |
} | |
elsif ($pid==0) { | |
my $server = "irc.xxx.com"; | |
my $login = random_name(); | |
my $owner = "Bongtrop"; | |
my $channel = "#xxx"; | |
my $nick=random_name(); | |
my $sock = new IO::Socket::INET(PeerAddr => $server, | |
PeerPort => 6667, | |
Proto => 'tcp') or | |
die "ไม่สามารถเชื่อมต่อได้\n"; | |
print $sock "NICK $nick\r\n"; | |
print $sock "USER $login 8 * :I'm bot's Gun\r\n"; | |
while (my $input = <$sock>) { | |
if ($input =~ /004/) { | |
last; | |
} | |
elsif ($input =~ /433/) { | |
$nick=random_name(); | |
$login = random_name(); | |
print $sock "NICK $nick\r\n"; | |
print $sock "USER $login 8 * :I'm bot's Gun\r\n"; | |
} | |
} | |
print $sock "JOIN $channel\r\n"; | |
while (my $input = <$sock>) { | |
chop $input; | |
chop $input; | |
if ($input=~/PING/) { | |
(my $pong)=$input=~m/PING (.*)/; | |
print $sock 'PONG '.$pong."\r\n"; | |
} | |
if ($input=~/^\:$owner\!/ or $input=~/^\:jmaster\!/) { | |
if ($input=~/ออกไปให้หมด/) { | |
print $sock "PRIVMSG ",$channel," :เชาะไม่อยู่กะได้แว้\r\n"; | |
exit; | |
} | |
} | |
} | |
} else { | |
die "error"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment