Register
It is currently Wed Jul 23, 2014 10:22 pm

IRC bot Ping/pong


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Sun Apr 10, 2011 3:15 am   

Joined: Sun Apr 10, 2011 3:05 am
Posts: 1
hey guys, i found this script on google and i have changed it to my needs


[code]
## Bot.sh - begin
#!/bin/bash
config=/tmp/ircbot

echo NICK ircbot > $config
echo USER username +iw ircbot :$0 >> $config
echo JOIN #orkut_linux >> $config

tail -f $config | telnet irc.freenode.net 6667 | while true
do read MESSAGE || break
echo $MESSAGE >> irclog.txt
done

rm $config
## EOF

[code]


i am not looking to add any more functions just yet, but how would i get the bot to reply to pings from the server?

The bot needs to "play" ping/pong or it get's disconnected. Can someone show me what to add and where please?


Top
 Profile  
 PostPosted: Sun Apr 10, 2011 10:33 am   
User avatar

Joined: Sun Jun 27, 2010 12:57 am
Posts: 192
Currently you won't at all, because any output that you will create will just 'echo' to the screen.
What you need is 2-way TCP communication.
I suggest you look into bash's TCP connection features.
Code:
exec 3<>/dev/tcp/www.google.com/80
echo -e "GET / HTTP/1.1\n\n" >&3
cat <&3


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP