dips-post - A shell script to post your IP address
            to a DIPS server every X minutes.

dips-post Ver 0.1.0 by Dave Wormfood <wormfood@oink.pig.net>

FEATURES:
  100% automated (after everything is configured)
  Can be used on multiple interfaces (2 modems or whatever)
  Low overhead (spends most of it's life sleeping)
  It's FREE (as long as the DIPS service is free)

REQUIRED PROGRAMS: (make sure they're in your path)
  nc - NetCat (The TCP/IP Swiss Army knife)
    (you can get NetCat at http://www.l0pht.com/~weld/netcat/)
    (and it is included with RedHat 5.x and 6.x)
  echo
  rm
  sleep
  ifconfig
  kill
  date (optional - uncomment the 6th line from the END of the script)


STARTING THE SCRIPT FROM A COMMAND LINE:
  To start the script type "dips-post ppp0 1.2.3.4 P1234567890 DipsTopic"
where ppp0 is the name of your Internet connected interface (usually ppp0),
1.2.3.4 is is your IP address (which can be gotten by typing "ifconfig" at the
command prompt), P1234567890 is your DIPS password, and DipsTopic is your
topic to be displayed on the list of active DIPS users. If you mess up, or if
your IP address changes, then you need to run the script over again, with your
new IP address. The script will update your address to the DIPS server every
30 minutes. You don't need to worry about several scripts running at the same
time, because when a new script starts, it kills the old script. When
dips-post detects that your network interface is no longer active, it will
die. If for some reason you want the script to stop posting your IP address
without disconnecting from the Internet, then look in /var/run/ for a file
called dips-post.XXXX.pid where XXXX is your interface name (usually ppp0) and
delete it, and when the timer runs out, dips-post will die.

STARTING THE SCRIPT AUTOMATICLY:
  Assuming you're using ppp to make your network connection, I will explain how
to use this to your advantage, and what changes are needed. If you're using 
slip, or something other than ppp to make your connection, then you'll have to
adapt these instructions to suit your needs.

  When pppd make a connection it starts a shell script called /etc/ppp/ip-up
and passes it several parameters, like the interface name and the IP address
(along with other info). Read the man page for pppd if you want more details.
Most systems already have the /etc/ppp/ip-up script installed as part of pppd
package, and it launches a script called /etc/ppp/ip-up.local. There is a
slight problem with the ip-up script as it comes in the pppd package, it does
not pass any of the parameters it receives from pppd to the ip-up.local script.
When you go to modify the ip-up script, you'll notice the message telling you
to make your changes to ip-up.local script....that's funny....we HAVE to
change it.

2 Things to do to make dips-post work automagicly

   1) Edit the /etc/ppp/ip-up script and look for "/etc/ppp/ip-up.local" and
      change it to "/etc/ppp/ip-up.local $*", so all the 0 are
      passed to ip-up.local. If we don't make this change then ip-up.local
      won't have the IP address and interface name to pass to dips-post. (I've
      included my copy of ip-up, and the original for reference)

   2) Create /etc/ppp/ip-up.local (if it is not already there, if it is there
      then modify it), or better yet, copy my copy of ip-up.local into your
      /etc/ppp/ directory, and edit (the password and topic) to suit your
      needs.

  Now when pppd makes a connection, it will start ip-up, and it will in turn
start ip-up.local, which will start dips-post, and it will post your IP
address to the DIPS server every 30 minutes (or whatever you set it to).


GENERAL NOTES:
  There are some variables in the beginning of the script that you may want
to change, but shouldn't need to.

  From a security stand point, it is usually a good idea to check the
programs/scripts that you install from an unknown source, and you don't know
me, so take a look at the script for yourself,and you'll see nothing is a
security concern. If you get this script from an untrusted source, you may
want to look for the inappropriate use of NetCat. On the RedHat 5/6.x Linux
distribution, you'll find the docs for NetCat at /usr/doc/nc-1.10/README.

  I've written this script using bash on a RedHat's 6.0 distribution of Linux.
If you have any problems making things work then take this into account.

THINGS TO DO LIST:
  Better/more error checking. (like DIPS server interaction)
  Rework some of the code to handle multiple network interfaces better.
    (this will not help most people, only those with 2 (or more) modems)
  Phrase the HTML returned from the server, or at least strip the tags.
  Make the wait time in seconds between server posting dependent on what
    the DIPS server return (DIPSretry=XXX)
  Add the ability to handle multiple DIPS accounts.
