Skip to content

Instantly share code, notes, and snippets.

@sonicrules1234
Created June 3, 2010 20:53
Show Gist options
  • Save sonicrules1234/424467 to your computer and use it in GitHub Desktop.
Save sonicrules1234/424467 to your computer and use it in GitHub Desktop.
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
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