Re: IP in the Windows registry

From: Michele Andreoli (m.andreoli@tin.it)
Date: Thu Nov 21 2002 - 22:34:21 CET


On Wed, Nov 20, 2002 at 11:19:32PM -0000, Dave Houghton nicely wrote:

>
> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\
> Tcpip\Parameters\Interfaces\adapterID
>

I'm uploading a new version of rustic-shell.exe. I added some new command in /bin
and the file

                c:\rs\config.txt

This file contains VAR=VALUE pairs and allow a first basic form of
configuration. Edit it with notepad.

I added the important feature I was searching for: to find the current
IPaddress of the machine, scanning the Windows registry with this simple script:

        
===========================================================================
#!/bin/sh
# (C) 2002 M.Andreoli

# try to find my current IP
# scanning Windows registry

DIR="/proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Tcpip/Parameters/Interfaces"

for x in $DIR/*/IpAddress ; do
        BASE=$(dirname $x)
        IP=$(cat $BASE/IpAddress)
        DG=$(cat $BASE/DefaultGateway)
        if [ "$DG" ] && [ "$IP" != "0.0.0.0" ] ; then
                echo $IP; exit
        fi
done

echo ""

===========================================================================

This is only my first attempt to do that, because in this part of the Windows
registry I found a lot of (un)configured network interfaces. So, I assumed the
right one as the interface with IP!=0.0.0.0 and a DefaultGateway set.

Please, Dave, check if this mechanism may works in general.

If the system fetch a good IP, it send the IP, via email, to the address
set in the config.txt: NOTIFY_IP_TO.
You can disable this feature using a blank email.
Please, edit this file and put in it *your* address, removing mine.

The IP is sent automagically only if you run the sshd.bat script.

As previous stated, this feature is required by Paolo, my friend in
Sardinia.

Michele

-- 
"Physics is like sex: it may give some practical
results, but that's not why we do it"  (Richard Feynman)
---------------------------------------------------------------------
To unsubscribe, e-mail: mulinux-unsubscribe@sunsite.dk
For additional commands, e-mail: mulinux-help@sunsite.dk


This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:23 CET