Bare Metal IRC Client

nik=clf$RANDOM;sr=irc.efnet.org;expect -c "set timeout -1;spawn nc $sr 6666;set send_human {.1 .2 1 .2 1};expect AUTH*\n ;send -h \"user $nik * * :$nik commandlinefu\nnick $nik\n\"; interact -o -re (PING.:)(.*\$) {send \"PONG :\$interact_out(2,string)\"}"
Uses the extremely cool utilities netcat and expect. "expect" logs in & monitors for server PING checks. When a PING is received it sends the PONG needed to stay connected. IRC commands to try: HELP, TIME, MOTD, JOIN and PRIVMSG The "/" in front of IRC commands are not needed, e.g. type JOIN #mygroup Learn about expect: http://tldp.org/LDP/LGNET/issue48/fisher.html The sample output shows snippets from an actual IRC session. Please click UP button if you like it!
Sample Output
:efnet.portlane.se 376 clf3990 :End of /MOTD command.
privmsg clf3990 :hello to myself...
:clf3990!~clf3990@184.105.134.5 PRIVMSG clf3990 :hello to myself...
join #happyplace
:clf3990!~clf3990@184.105.134.5 JOIN :#happyplace
:efnet.portlane.se MODE #happyplace +nt
:efnet.portlane.se 353 clf3990 = #happyplace :@clf3990
privmsg #happyplace :hello all, I am clf3990 the creator of #happyplace
quit
:Closing Link: (Quit: clf3990)


8
By: omap7777
2015-03-18 09:10:28

These Might Interest You

What Others Think

Or you could just install an IRC client, which is safer, easier, and has more features. Why would you want to do this? It's a kludge.
blutgens · 165 weeks and 3 days ago
@blutgens - It's useful in situations where you're using a system with limited resources/privileges. You could use a method like this to pipe through a vps systems that may be low on space, if you wanted that system to act as a cheap proxy to prevent IP leakage. A tool is only as useless/useful as the imagination of the person wielding it.
cyberpsych0sis · 165 weeks and 2 days ago
this is genius, didn't know about 'expect' but i'll study it now. thanks!
caesarsol · 163 weeks and 6 days ago
This is nice, but on most of our machines there is no netcat (our security team considered it harmful, so we uninstalled it). If we can install netcat, we can also install irssi or any similar client, though.
gergelypolonkai · 155 weeks and 2 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: