Discussion | Articles | Blogs | Books | Contact Us | Chat | Shop | Search
  WrongPlanet.net
User Stats
   Members: 21,879
   Online Now: 331



People Online:
Visitors: 197
Members: 134
New Today: 18
New Yesterday: 14
Latest: DebbieCat

Search
Google
Web WP.net



  Aspie Affection
Support Wrong Planet Awareness!
Bash script bot

 
Post new topic   Reply to topic    Wrong Planet Forums Forum Index -> Computers, Math, Science, and Technology
View previous topic :: View next topic  
Author Message
Aaron_Mason
Phoenix
Phoenix


Joined: Jul 04, 2005
Age: 23
Posts: 618
Location: Bathurst, Australia

PostPosted: Sun Aug 24, 2008 6:29 am    Post subject: Bash script bot Reply with quote

Hey all,

This is hardly new news - the Bourne Again SHell (BASH) has been able to do this for years. I, however, have made a small IRC bot using only bash's socket redirection (i.e. >/dev/tcp/host/port). The script is below.

Note that this won't work on Debian based Linux distributions as they have such redirection disabled at compile time. For the rest of us, here's the magic in the form of a small harassment bot.

Code:

#!/bin/bash

if [ ! "$1" ]; then
        echo "Syntax: $0 #channel"
        exit 1
fi

sock=/dev/tcp/irc.freenode.net/6667

exec 5<>$sock

echo NICK ^^BORG >&5
echo USER borg 8 \* :We are borg. >&5

while read line <&5; do
        echo $line

        if [ "$(egrep '^:.* 376' <<<"$line")" ]; then
                # end of MOTD

                echo "At the end of the MOTD, waiting 15..."
                sleep 15
                echo "JOIN $1" >&5
                echo "PRIVMSG $1 :We are borg.  Resistance is futile." >&5
                echo "QUIT :Resistance is futile." >&5
        fi
done


DISCLAIMER: I'm not responsible for anything that breaks if you use this script. Also, if you get g-lined from a network for using this, not my fault. You are responsible for everything that happens if you choose to use this. We know where you eat.
_________________
We are one, we are strong... the more you hold us down, the more we press on - Creed, "What If"

AS is definitive. Reality is frequently inaccurate.

I'm the same as I was when I was six years old - Modest Mouse
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Wrong Planet Forums Forum Index -> Computers, Math, Science, and Technology All times are GMT - 5 Hours
Page 1 of 1

 
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 vote in polls in this forum

Wrong PlanetTM Copyright 2004-2008, Alex Plank and Yellow Sneaker Media, LLC
Alex Plank  Aspie Affection 

Terms of Service - You must read this as a user of Wrong Planet

RSS Feed Add to Google Add to My Yahoo!

Subscribe: Wrong Planet News  Wrong Planet Forums

Privacy Policy

Asperger's is not a disease

fine art