Guest User

Untitled

a guest
May 27th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. use IO::Socket::INET;
  2. use warnings;
  3. $password = "";
  4. $sock = IO::Socket::INET->new(PeerAddr => "irc.freenode.net",
  5. PeerPort => 6667,
  6. Proto => "tcp");
  7. $sock->send("NICK sonicbotpp \nUSER sonicbotpp * * :sonicbotpp\n");
  8. print "Sent nick and user\n";
  9. $buffer = "";
  10. while (1)
  11. {
  12. $sock->recv($data, 1024);
  13. if ($data ne "") {print "$data\n";};
  14. # if ($data == "") {print "$!\n";$sock-close();};
  15. $data = $buffer.$data;
  16. @lines = split(/\n/, $data);
  17. $buffer = $lines[-1];
  18. print "Buffer = $buffer\nABCDE\n";
  19. for (@lines[0..($#lines-2)]) {
  20. $line = $_;
  21. @blah = split(/ /, $line);
  22. if ($blah[0] eq "PING") {
  23. $server = $blah[1];
  24. $sock->send("PONG ".$server."\n");
  25. print "Sent pong\n";
  26. };
  27. $raw = substr($line, 1, length($line) - 2);
  28. @words = split(/ /, $raw);
  29. print "$words[1]\n";
  30. if ($words[1] eq "001") {
  31. $sock->send("PRIVMSG NickServ :IDENTIFY sonicbot $password\nJOIN ##brokendream\n");
  32. print "Send JOIN\n"};
  33. };
  34. };
Add Comment
Please, Sign In to add comment