Last active
May 10, 2017 16:41
-
-
Save zotherstupidguy/766e4a2c0103a05af6c3 to your computer and use it in GitHub Desktop.
IRC Channel IPs
This file contains hidden or 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 | |
NICK=itouchthings | |
SERVER=irc.freenode.net | |
PORT=6667 | |
CHAN="#ruby" | |
#PRIVMSG $CHAN :Greetings! | |
{ | |
# join channel and say hi | |
#JOIN $CHAN | |
cat << IRC | |
NICK $NICK | |
USER itouchthings 8 x : itouchthings | |
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 -r _ code _ ip _ ; do | |
case $code in | |
354) | |
printf '%s\n' "$ip" | |
;; | |
*) | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment