-
-
Save zotherstupidguy/9aee63064dcf6b76c1f3 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
#!/bin/sh | |
# Copyright 2014 Vivien Didelot <[email protected]> | |
# Licensed under the terms of the GNU GPL v3, or any later version. | |
#Jarkko Oikarinen first introduced IRC to the world in 1988. Five years later, he clearly defined the IRC protocol in RFC 1459, which made the whole protocol much more accessible. Armed with this information, you can get a better understanding of this simple text-based protocol and learn how to connect to IRC servers without using a special client. Once you have mastered this, you should find it a trivial task to write programs that connect to IRC. | |
#netcat kornbluth.freenode.net 6667 | |
#The USER command is used to set the login, user modes, and real name. If I wanted to have a login of "paul," I would type the following, followed by Enter: | |
#NICK zotherstupidguy\rUSER foo x x whatever | |
NICK=irccat42 | |
SERVER=irc.freenode.net | |
PORT=6667 | |
CHAN="#hackspree" | |
{ | |
# join channel and say hi | |
cat << IRC | |
NICK $NICK | |
USER irccat 8 x : irccat | |
JOIN $CHAN | |
PRIVMSG $CHAN :Greetings! | |
WHO $CHAN %ni | |
IRC | |
# forward messages from STDIN to the chan, indefinitely | |
while read line ; do | |
echo "$line" | sed "s/^/PRIVMSG $CHAN :/" | |
done | |
# close connection | |
echo QUIT | |
} | nc $SERVER $PORT | while read line ; do | |
case "$line" in | |
*PRIVMSG\ $CHAN\ :*) echo "$line" | cut -d: -f3- ;; | |
#*) echo "[IGNORE] $line" >&2 ;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment