tag:blogger.com,1999:blog-2843542351611056012.post4824933297905428564..comments2023-12-26T19:00:12.980+01:00Comments on Alex's blog: A simple bash IRC logging botUnknownnoreply@blogger.comBlogger5125tag:blogger.com,1999:blog-2843542351611056012.post-23024653552135807272022-01-30T21:58:31.588+01:002022-01-30T21:58:31.588+01:00Sometimes first reply to ping server not work, why...Sometimes first reply to ping server not work, why?Alberto34noreply@blogger.comtag:blogger.com,1999:blog-2843542351611056012.post-38253808091102832272020-03-06T19:29:56.944+01:002020-03-06T19:29:56.944+01:00This script works great. I've tried nc, telnet...This script works great. I've tried nc, telnet and bash builtin tcp. I have two tips for others reading this and trying.<br /><br />1. If you are using the bash tcp code posted above, you can scrap the config file and redirect the output on your echos with '>&3' instead. Like so:<br /><br />echo -e "NICK ${nick}" >&3<br />echo -e "USER $nick +i * :$0" >&3<br />(sleep 1;echo -e "JOIN #${channel}" >&3) &<br /><br />2. Also as seen above, I noticed some servers was not ready to accept JOIN right away so I ran it in a subshell with a sleep before. The '&' character makes the commands run in the background while the script in the main shell continues as normal.Anonymoushttps://www.blogger.com/profile/10696483543360256521noreply@blogger.comtag:blogger.com,1999:blog-2843542351611056012.post-48507549814354139812013-05-27T08:00:00.379+02:002013-05-27T08:00:00.379+02:00yes, you can use bash sockets too but as I mention...yes, you can use bash sockets too but as I mentioned already neither nc nor bash is available on an embedded system with the busybox and ash. Replacing nc with telnet makes the script working on my router too.alexhttps://www.blogger.com/profile/15068148570398507828noreply@blogger.comtag:blogger.com,1999:blog-2843542351611056012.post-85456079548392154122013-05-24T17:43:10.568+02:002013-05-24T17:43:10.568+02:00Thanks for sharing this. It was very useful to me....Thanks for sharing this. It was very useful to me.<br /><br />I have changed a few things to avoid using <b>nc</b>, and use Bash built-in TCP sockets.<br /><br />---<br /><br /># Open the TCP connection.<br />exec 3<>/dev/tcp/$SERVER/$PORT<br />...<br /># Process each server command and logs everything.<br />while read -u 3 MESSAGE<br />do<br /> MESSAGE=$(sed 's/\r//' <<< $MESSAGE )<br /> echo "$(date -u +'%F %T') $MESSAGE" >>$LOG<br /> case "$MESSAGE" inAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-2843542351611056012.post-4100776773985816622012-07-24T23:04:22.639+02:002012-07-24T23:04:22.639+02:00That`s just awesome. I was about to write my own b...That`s just awesome. I was about to write my own bash script for logging but failed. Then I found yours and it`s exactly what I wanted to do. Best of all: I know what I did wrong now and understood how easy it really is :)<br /><br />Thanks a lot<br /><br />ErikEriknoreply@blogger.com