3/17/2003
SSHIPUP by Scott Botterud scott@info-techs.com
The latest version can be downloaded from: http://www.info-techs.com/download.shtml
What is SSHIPUP?
SSHIPUP (Secure SHell IP UPloader) is a freeware command line utility that tracks your Cable Modem or DSL WAN IP address (also known as the external IP address). If your broadband connection gets issued a new IP addres SSLIPUP detects the new IP and uploads an HTML file via SSH to your web site and optionally sends an email with the new IP address. Runs on Windows 95/98/ME/NT/2000/XP.

SSHIPUP will perform the following functions:

1) Determine your WAN (Wide Area Network)IP address. If you are running a router (such as Linksys) which performs NAT (Network Address Translation) you are most likely assigned a CLASS C IP address via the routers DHCP (Dynamic Host Control Protocol) server, typically someting like 192.168.1.105. The IP of your Cable Modem or DSL is "someting" different. WANIPUP determines your WAN (or external) IP address. Knowing this address is useful for games, internet telephones, NetMeeting, pcAnywhere, running a Web or FTP server in house, and a whole lot more.

2) Post your IP address to a web page via SSH (Secure SHell) along with what may be other valuable information. With ever increasing Interent security concerns, more and more system administrators are turning off their FTP servers and opting instead to use SSH. Programs such as: are excellent choices for safely and securly while working the Internet.

In the past we used to use programs such as: Ultimately we found these programs unacceptable for our needs. IP Poster for Linksys Router is no longer supported, and would not work with newer version of Linksys Firmware. Keep Me Posted was great, except it does not support SSH. Both send unencrypted passwords ofer the Internet. Not a good idea. We also looked into programs such as TZO which brought up security concerns.

3) Keep track of your IP address history. This is useful for knowing what your ISP (Internet Sevie Provider) is doing for (or to) you. It is also useful for pcAnywhere users, as you know the range of IP address to search when attempting to connect remotely.

4) Optionally send you (and/or anyone else) an email notification that your IP address has changed and what the new IP is.

5) SSLIPUP can be manually initiated, run on startup, or, the recommended method, automated to periodically check your IP address and update the web site file along witt optionally sending an email notification of the new IP address.




INSTALLATION INSTRUCTIONS:
Getting SSHIPUP working takes 5 steps:
  1. Unpack the archive files from SSHIPUP???.ZIP
  2. Upload YOURIP.SHTML to your web server.
  3. Modify files to meet your configuration needs.
  4. Set up Email notification.
  5. Automate the SSHIPUP process (optional).
1) UNPACK FILES:
1) Create a folder and copy all the files from SSHIPUP???.ZIP into that folder. This can be on a local or network drive. For this document we are going to set up the program in a directory called SSHIPUP on the C: drive, so copy all files into the C:\SSHIPUP directory.

There is a possible security issue that needs to be consider. The SSHIPUP.BAT file contains the plain test username and password to your web site. Placing this on a server or a shared location poses a possible security issue. The username and password are encrypted before being sent across the interent.

2) UPLOAD YOURIP.SHTML TO YOUR WEB SERVER:
All program required to get SSHIPUP working are included in this distribution. A possible stumbling block is your web server must have SSI (Server Side Includes) enabled. To see if your server has SSI enabled, upload the file called VARIABLES.SHTML (which is included in this distribution) to your web server and bring it up on a browser. VARIABLES.SHTML is a list of all available environment variables. Some servers depending on what version of LINUX, UNIX, or (God help you) Windows will honor or not honor certain variables. To see a sample output from my server goto: If your server has SSI enabled you will see a variety of output in the right column. If SSI is not enabled the right column will be blank. If you do not have SSI, request your system administrator to enable it. Instructions for enabling SSI can be found at: In the event your system administrator is unwilling (or unable) to allow SSI on your server, and there is no other way for you to get YOURIP.SHTML going, you can use our server (please don't abuse this):
The YOURIP.SHTML file looks like:

	<!--#echo var="remote_addr" -->
An SSI enabled web server will process the variable and report back your WAN IP address. Please note that the page must have an .SHTML extension (not .HTML or .HTM) for the SSI to be processed. The only exception to this rule is if your system administrator is using the XBitHack directive, which is not recommended due to performance issues it creates.

3) MODIFY FILES:
Three files need modification: SSHIPUP.BAT, 1.HTML and 3.HTML

SSHIPUP.BAT - This file is heavily commented so it will not be covered here.

1.HTML - This is the first of four parts that constitute the final MYIP.SHTML file that SSHIPUP creates.
	<HTML>
	<HEAD>
	<TITLE>WAN IP Address</TITLE>		<--- What shows up in the browsers Title bar
	</HEAD>
	<BODY>
	<CENTER>
	<HR>
	My Cable Modem/DSL IP address is:	<--- The first line displayed before your WAN IP address
	<BR>
3.HTML - This is the third of four parts that constitute the final MYIP.SHTML file that SSHIPUP creates.
	<BR>
	<HR>
	Your IP address is:
	<BR>
	<!--#echo var="remote_addr" -->
	<HR>
	<A HREF="http://www.yourwebsite.com">yourwebsite.com</A> IP address is:<BR><!--#echo var="SERVER_ADDR" -->
	<BR>
	<HR>
	<!--#config timefmt="%A %B %e, %Y at %R" -->IP Address Last Updated on: <!--#echo var="LAST_MODIFIED"-->
	<BR>
	<BR>
	</CENTER>
	IP Address History:<BR>
You need to modify http://www.yourwebsite.com and yourwebsite.com to reflect your web site name.

4) SET UP EMAIL NOTIFICATION (Optional): As an option, Email can be generated to notify of a new IP address. If you don't need this, simply REM out the POSTIE.EXE line in SSHIPUP.BAT. If you want this feature, download POSTIE from: After modifying the files, the next step is to test your setup. From a command prompt type SSHIPUP and hit ENTER.

5) AUTOMATING THE PROCESS:
Once you are convinced the SSHIPUP process is working correctly there are two (possibly more) ways to automate process:
  1. Place a shortcut to SSHIPUP.BAT to your startup folder so every time the computer starts SSHIPUP runs. To create a shortcut open Windows Explorer, navigate to the SSHIPUP.BAT file and right click on the file. Select "Create Shortcut". Copy the newly created "Shortcut to sshipup.lnk" to your startup folder.
  2. Run WinCRON in the background so SSHIPUP runs periodically. This is the recommended method. WinCRON is a Freeware program that is not included in this distrubution. It can be downloaded from: info-techs.com/download.shtml. Windows includes the AT command but we have found this to be unreliable.





TROUBLESHOOTING:
The first time SSHIPUP runs, it needs to create some files for future use. These files are dynamically created:
	newip.txt - Created by GRABURL.EXE - contains your WAN IP address
	history.txt - The history file of your IP address
	myip.shtml - The file to be uploaded 
	temphist.txt - A temporary history file necessary for processing
	tmp.txt - A temporary history.txt file necessary for processing
	oldip.txt - the old IP file used by FC.EXE to compare to NEWIP.TXT
Check that these files exist and verify the contents.

Since batch files are designed to run and terminate, they can be frustrating to troubleshoot. Putting some well located PAUSE statments in SSHIPUP.BAT can allow you to see what is going on. Another method is to capture the program output to a file and then review it. To do this use: This will create a file called output.txt that contains all the output that would normally goto the screen.


BUGS:
If you believe you have found a bug, have a suggestion, or an enhancment please email me! The latest version can be downloaded from my web site:


COST:
This program is distributed as Freeware. All the programs used in this program are availalbe as Freeware.


REVISION HISTORY:

5/30/2003: Release version 1.06 4/01/2003: Release 1.05: Fix mistake in SSHIPUP.BAT:
3/17/2003: Initial non-beta release of version 1.04.




PROGRAM COMMAND LINE ARGUMENTS AND SWITCHES:
COMMAND LINE SWITCHES FOR PuTTY:

PuTTY Secure Copy client
Release 0.53b
Usage: pscp [options] [user@]host:source target
       pscp [options] source [source...] [user@]host:target
       pscp [options] -ls user@host:filespec
Options:
  -p        preserve file attributes
  -q        quiet, don't show statistics
  -r        copy directories recursively
  -v        show verbose messages
  -load sessname  Load settings from saved session
  -P port   connect to specified port
  -l user   connect with specified username
  -pw passw login with specified password
  -1 -2     force use of particular SSH protocol version
  -C        enable compression
  -i key    private key file for authentication
  -batch    disable all interactive prompts
  -unsafe   allow server-side wildcards (DANGEROUS)


COMMAND LINE SWITHCES FOR GRABURL:

graburl 1.05
Copyright (C) 1996-1998 Kiraly Enterprises
All Rights Reserved.

Usage: graburl [-h] [-a] [-9] URL [URL [...]]

Supports URLs of the form:

        [http://]site[:port][/path]

        -h      retrieve HTTP headers only
        -a      transfer in ASCII mode
        -9      use HTTP/0.9 protocol

Examples:

        graburl http://www.sun.com
        graburl -h www.sun.com
        graburl www.sun.com:80/index.html


COMMAND LINE SWITCHES FOR FC.EXE:

usage: fc [/a] [/b] [/c] [/l] [/lbNN] [/w] [/t] [/n] [/NNNN] file1 file2

/A  	Abbreviates the output of an ASCII comparison. Instead of displaying all
	the lines that are different, FC displays only the first and last line
	for each set of differences.

/C  	Ignores the case of letters.

/L  	Compares the files in ASCII mode. FC compares the two files line by line
	and attempts to resynchronize the files after finding a mismatch. This
	is the default mode for comparing files that do not have extensions of
	.EXE, .COM, .SYS, .OBJ, .LIB, or .BIN.

/LBn	Sets the number of lines for the internal line buffer. The default
	length of the line buffer is 100 lines. If the files being compared have
	more than this number of consecutive differing lines, FC cancels the 
	comparison.

/N	Displays the line numbers during an ASCII comparison.

/T	Does not expand tabs to spaces. The default behavior is to treat tabs as
	spaces, with stops at each eighth character position.

/W	Compresses white space (tabs and spaces) during the comparison. If a
	line contains many consecutive spaces or tabs, the /W switch treats
	these characters as a single space. When used with the /W switch, FC
	ignores (and does not compare) white space at the beginning and end of a
	line.

/nnnn   Specifies the number of consecutive lines that must match before FC
	considers the files to be resynchronized. If the number of matching
	lines in the files is less than this number, FC displays the matching
	lines as differences. The default value is 2.

/B	Compares the files in binary mode. FC compares the two files byte by
	byte and does not attempt to resynchronize the files after finding a
	mismatch. This is the default mode for comparing files that have
	extensions of .EXE, .COM, .SYS, .OBJ, .LIB, or .BIN.


COMMAND LINE SWITCHES FOR DATETIME.COM:

datetime
PLOP DateTime v5.0 Coded by Elmar Hanlhofer   http://plop.at
datetime [string]

 output of date and time + string

 !d   day number                    !D   Weekday
 !m   month number                  !y   year 2digits
 !Y   year 4digits
 !b   month name (Jan, Feb,...)
 !B   full month name (January, February,...)

 !H   hour                          !M   minute
 !S   second                        !h   hundrets of second

 !r   return                        !n   new line
      for windows style use  !r!n for return
      for unix style use !n only

Examples:  datetime Today is !D !d/!m/!y  Time:  !H:!M
 output is: Today is Sun 27/10/02  Time:  16:00
 write into a file:  datetime !d/!m/!y > date.txt

EOF