Created
June 3, 2010 20:53
-
-
Save sonicrules1234/424467 to your computer and use it in GitHub Desktop.
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
westly@westly-laptop ~ $ perl sonicbotpp.pl | |
Sent nick and user | |
:brown.freenode.net NOTICE * :*** Looking up your hostname... | |
Buffer = :brown.freenode.net NOTICE * :*** Looking up your hostname... | |
ABCDE | |
:brown.freenode.net NOTICE * :*** Checking Ident | |
:brown.freenode.net NOTICE * :*** Checking Identng up your hostname... | |
ABCDE |
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
use IO::Socket::INET; | |
use warnings; | |
$password = ""; | |
$sock = IO::Socket::INET->new(PeerAddr => "irc.freenode.net", | |
PeerPort => 6667, | |
Proto => "tcp"); | |
$sock->send("NICK sonicbotpp \nUSER sonicbotpp * * :sonicbotpp\n"); | |
print "Sent nick and user\n"; | |
$buffer = ""; | |
while (1) | |
{ | |
$sock->recv($data, 1024); | |
if ($data ne "") {print "$data\n";}; | |
# if ($data == "") {print "$!\n";$sock-close();}; | |
$data = $buffer.$data; | |
@lines = split(/\n/, $data); | |
$buffer = $lines[-1]; | |
print "Buffer = $buffer\nABCDE\n"; | |
for (@lines[0..($#lines-2)]) { | |
$line = $_; | |
@blah = split(/ /, $line); | |
if ($blah[0] eq "PING") { | |
$server = $blah[1]; | |
$sock->send("PONG ".$server."\n"); | |
print "Sent pong\n"; | |
}; | |
$raw = substr($line, 1, length($line) - 2); | |
@words = split(/ /, $raw); | |
print "$words[1]\n"; | |
if ($words[1] eq "001") { | |
$sock->send("PRIVMSG NickServ :IDENTIFY sonicbot $password\nJOIN ##brokendream\n"); | |
print "Send JOIN\n"}; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment