Page 1 of 2 12>
Topic Options
#32627 - 2002-11-15 10:27 PM Determine OS via IP-address over a VPN WAN link
Anonymous
Unregistered


Hi,

I've searched the boards on info about determining the OS of a remote client using only the IP-address. My thought was querying the registry as many of the post do.

What I need to find out is actually only if the OS is a NT OS like NT/2000/XP or another OS like Win95/98 etc. (I don't need to know the name of the OS if it isn't a NT OS).

One of the post I found was this:
http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=1;t=005783

The problem as I see it is that the only thing I know about the client is his IP-address. They all log on through a VPN tunnel over a WAN link, so there might only be open for certain ports through the VPN tunnel. The clients aren't member of a central domain (they run a Terminal Server client through the VPN tunnel) so I don't have administrative privs on the machine (is it then at all possible to retrive the info from the registry?) - and does anyone know what ports is used when querying the remote registry? I guess the port should be open in the VPN router - and at this moment I don't know excactly how much is allowed through the VPN tunnel.

To summerize:
User connect via a VPN tunnel with port restrictions. When connected he starts a Terminal Server client and logs on to the internal network. The logon script contains a script that retrieves the client IP through some TS DLL calls. What I need is using the retrieved IP-address to find out if the client on the other end of the VPN tunnel runs NT/2000/XP or another OS.

Can it be done?

Any help is highly appreciated!

Thanks ya all!!!!!!!

/Nicolaj [Smile]

Top
#32628 - 2002-11-15 10:33 PM Re: Determine OS via IP-address over a VPN WAN link
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
code:
$os=readvalue('\\123.123.123.123\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion',
'ProductName')

should work. Alternatively, you might be able to use WMI and the IP address instead of the computer name.

[ 15. November 2002, 22:35: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#32629 - 2002-11-15 10:52 PM Re: Determine OS via IP-address over a VPN WAN link
Anonymous
Unregistered


Thanks for the reply. But do you know what port is used when querying the remote registry? If the communication uses the same port every time I could probably open for this particular port through the VPN tunnel...

Thanks,
Nicolaj

Top
#32630 - 2002-11-15 10:54 PM Re: Determine OS via IP-address over a VPN WAN link
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, the special rpc ports should do...
135, 137...
probably you know.
_________________________
!

download KiXnet

Top
#32631 - 2002-11-15 10:54 PM Re: Determine OS via IP-address over a VPN WAN link
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Nope. However, it should be the 135-139 range, at least that would be my guess.

[ 15. November 2002, 22:59: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#32632 - 2002-11-15 10:56 PM Re: Determine OS via IP-address over a VPN WAN link
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
jens, is that nope for what?
_________________________
!

download KiXnet

Top
#32633 - 2002-11-15 10:57 PM Re: Determine OS via IP-address over a VPN WAN link
Anonymous
Unregistered


Ok, thanks for your help, I will try to test it on monday at work.

Take care,
Nicolaj

Top
#32634 - 2002-11-15 11:00 PM Re: Determine OS via IP-address over a VPN WAN link
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Jeez, now I don't even have time to append my post before somebody notices [Wink]
_________________________
There are two types of vessels, submarines and targets.

Top
#32635 - 2002-11-15 11:04 PM Re: Determine OS via IP-address over a VPN WAN link
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yep.
thanks to checker!

anyway, on that 135, everyone should check their firewall config as that is the new way to get commercial popup info no matter how strict firewall settings...
or 13x ports are normally secured but 135 ain't
_________________________
!

download KiXnet

Top
#32636 - 2002-11-15 11:07 PM Re: Determine OS via IP-address over a VPN WAN link
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
That would only work if you had admin rights to the remote client. You should look at how some port sniffers do it.

f.e Port 445 is for microsoft-ds so should imply Win2K/XP.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#32637 - 2002-11-16 03:27 PM Re: Determine OS via IP-address over a VPN WAN link
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
I assumed that the remote client is integrated into the domain.

Hmm, yes you could also check for open port 445 (Windows 2000/XP), then for the existance of admin$ (Windows NT), everything else would be Windows 9x or other OS. It's not bulletproof, howver.

Alternatively, create a list of computername/OS during logon. I don't think that computernames of remote client changes very often, thus this should give a pretty good representation independent of IP addresses of the remote clients.
_________________________
There are two types of vessels, submarines and targets.

Top
#32638 - 2002-11-18 09:20 AM Re: Determine OS via IP-address over a VPN WAN link
Anonymous
Unregistered


Thanks both of you for your replies.

The problem is that the client connects to a central server through the VPN tunnel using a Termibal Server client, therefore the logonscript is executed on the server - and I can't query the OS directly. Les sent me the WTSManager.dll but I haven't had time to test it yet, though I've testet a commandline utility TSQuery from Clusteresis.com that I think used the same procedure calls - and it can't return the OS of the client [Frown]

I guess the only way is port-probing like you suggest. Can KiXtart be used to check for existance of a port?

Thanks!

/Nicolaj

Top
#32639 - 2002-11-18 09:56 AM Re: Determine OS via IP-address over a VPN WAN link
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I would not go there before asked you a question.
did you try out reading from the reg?

as, if the computer takes a connection, it should also open multiple ports.
if you didn't try yet, check it out as it might work without anything speciality...
_________________________
!

download KiXnet

Top
#32640 - 2002-11-18 10:08 AM Re: Determine OS via IP-address over a VPN WAN link
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Before you go down the RPC route / opening up ports you should understand what it means.

When an RPC enabled service starts up it connects to the RPC registration service on the local machine at a well known port. The registration service allocates it a port to listen on. This port number is not necessarily the same one that it used last time. This means that your RPC enabled services change the port that they listen on each time that they run.

When you need to connect to the service from another machine, you first connect to the RPC location service on the well known port, and tell it the name and version of the service you want to talk to. The RPC locator then tells you what port the service is running on.

All this means that you cannot open up the port for an RPC enabled service because it may change every time the service starts.

Some services (such as Exchange) have kludges which allow you to specify the port to bind to, to get around the firewall problem.

Of course if it's not RPC then you won't have the problem.

There are a couple of open port checking solutions about - I wrote a quick'n'dirty external binary called "portchek" a while back (use "search" to locate it), and I think there was a KiXtart add-on DLL which also provided name resolution and pinging - again, search is your friend.

[ 18. November 2002, 10:09: Message edited by: Richard Howarth ]

Top
#32641 - 2002-11-19 09:43 AM Re: Determine OS via IP-address over a VPN WAN link
Anonymous
Unregistered


I haven't tried reading from the registry yet because I kinda dismissed the idea as we don't have administrative priviledges on the remote machines (they are clients running in their own network, but connecting to our network via VPN to run applications on a Terminal Server).

About RPC using dynamic ports (like MAPI and Oracle Net communication) I did think if it was the case, but kinda hoped it would be possible anyway.

On another note, I know that a network scanner like NSS from GFI (www.gfi.com) detects the OS even when scanning a host you havenm't admin privs on - I don't know how they do it (I wrote their tech support yesterday in hope that they could help) - maybe they use different ways to check for the name of the OS (SNMP, banner from the FTP service, reads the registry, RPC calls etc.), whatever is possible on the system in question...

Anyway, it seems to be a very cumbersome task to retrieve the info, but I'll keep looking and trying and post whatever I discover. Thanks for you help so far - and if you think of anything more, please don't hesitate to write [Smile]

Thanks!

/Nicolaj

Top
#32642 - 2002-11-19 09:47 AM Re: Determine OS via IP-address over a VPN WAN link
Anonymous
Unregistered


Forgot to add some of the findings from the search:

Test if port is listening = http://kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=2&t=002265
OS type = http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=2;t=002962

/Nicolaj

Top
#32643 - 2002-11-20 12:45 AM Re: Determine OS via IP-address over a VPN WAN link
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
nra, still...
they don't have to be more than users on their local machines to access the ip info.
I just wonder, how much it could suffer to try...
_________________________
!

download KiXnet

Top
#32644 - 2002-11-19 01:14 PM Re: Determine OS via IP-address over a VPN WAN link
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Lonkero,
From nra's first post:
quote:
The clients aren't member of a central domain (they run a Terminal Server client through the VPN tunnel) so I don't have administrative privs on the machine (is it then at all possible to retrive the info from the registry?)
So the script is not running on the client, it is running on the terminal server. There is no local context to run the script in.

nra, is there nothing else useful in the TS DLL which might provide the information?

Do you map client drives in the same way as you do with Citrix? If so you may be able to check for file versions on the client to determine it's type.

Top
#32645 - 2002-11-19 01:31 PM Re: Determine OS via IP-address over a VPN WAN link
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
nra: We receive numerous requests to obtain client info from a Terminal server session. Could you share your code that uses the TS DLL so that others can also benefit from your experience?

[ 19. November 2002, 13:32: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#32646 - 2002-11-19 02:32 PM Re: Determine OS via IP-address over a VPN WAN link
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
One thing I'd like to point out is that M$ is very sticky when it comes to TS CALs. That being said, the TS knows what OS the client is so that M$ can determine if it needs to issue a TS CAL or not. The only case where this may not apply is with Internet Connector Licenses.

So the answer, abeit still elusive, lies right on the TS server. Wheter by utility or API or whatever, it should be reachable.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (mole) and 1300 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.072 seconds in which 0.026 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org