Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Linux, perl, windows conundrum

by Kickstart (Pilgrim)
on Jun 26, 2002 at 20:47 UTC ( [id://177524]=perlquestion: print w/replies, xml ) Need Help??

Kickstart has asked for the wisdom of the Perl Monks concerning the following question:

I have a need for a real cross-OS solution!!

What I have is this script called 'getipuser' that I wrote here. It exists on a linux server, and does a query based on a provided username and the nmblookup script to get the IP address on a machine on the network based on who is logged in there. All it does is return the username, nothing fancy.

Now, to the crux of the problem. This works fine for me on linux. I can even use PHP or Perl to do this lookup and post it on a webpage on our intranet. What I can't do, and what I really would like to do, is have something available for windows users on our network to click on and be asked for a username, and whatever coolness has to happen in the background to run a command on the client system (ie "c:\vnc\vncviewer.exe 10.0.10.123"), where '10.0.10.123' is the IP address obtained by my linux-only script.

Perl doesn't exist on the individual machines, so this is likely not really going to be a Perl problem. However if one of you smart people has a way to improve this situation with Perl involved, you'd make me very happy. It doesn't matter if it's something they click on in a browser, something that I can create a Desktop shortcut to, or whatever...all I ask is that it retrieves a username somehow, and from that grabs the IP address, and from that runs a command on the client based on that IP address.

Thanks for any help in relieving my eternal frustration!!!

Kickstart

Replies are listed 'Best First'.
Re: Linux, perl, windows conundrum
by BrowserUk (Patriarch) on Jun 26, 2002 at 22:35 UTC

    If what your trying to do is have a list of currently logged on users displayed on on a page on your intranet website and allow windows users to click the users name in order to start a vnc session with that user, then then the following works for me.

    The default associations (on the workstations) for "VNC_auto_file" is to run the WinVNC.exe - which is distinctly non-useful!

    Changing this to (amended to suit):

    FTYPE VNC_auto_file="X:\Program files\ORL\VNC\vncviewer.exe" /config %1

    And having the links point to username.vnc files on the linux box. Ie

    <a href="file://path/to/user1.vnc">User1Name</a>

    When the link is clicked it will download the .vnc file and then start the associated app.

    The .vnc files can be created (for the open connection) from with the vncviewer by using the "Save connection info as..." option from the VNCViewer "system menu" (top left).

    The file is a plain text (.ini) format file and looks something like this:

    [connection] host=10.0.10.123 port=5900 password=dae126243ba34a31 [options] use_encoding_0=1 use_encoding_1=1 use_encoding_2=1 use_encoding_3=1 use_encoding_4=1 use_encoding_5=1 preferred_encoding=5 restricted=0 viewonly=0 fullscreen=0 8bit=1 shared=0 swapmouse=0 belldeiconify=0 emulate3=1 emulate3timeout=100 emulate3fuzz=4 disableclipboard=0 localcursor=1 scale_num=1 scale_den=1

    So arranging for your Perl script to produce these (perhaps as a part of the same script that presents the page) should be no problem.

    Note: The password field is only lightly encrypted so your local policies will need to decide whether to include this or not - if not, the VNCVeiwer program will prompt the user. They may also be prompted as to whether they wish to download the file or open it with VNCVeiwer - again this depends on local policy/settings.

Re: Linux, perl, windows conundrum
by linebacker (Scribe) on Jun 26, 2002 at 21:53 UTC
    I don't think I am totally clear on what you are doing, but I think you want to remotely gather IP addresses from usernames?

    Depending on your naming convention this may or may not work. There is a system call in Windows called nbtstat.

    You can do nbtstat -a 'computername' (without the quotes) You can do nbtstat -A 'IP ADDRESS' (without the quotes)

    This will return the name of the logged in user and maybe you could parse this into something useable? I don't know how you could do the parsing without perl though? And of course, if the users name is not the computername, my whole theory falls apart on you.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://177524]
Approved by grinder
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2024-03-28 19:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found