Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > local interpreter remote machines

Reply
Thread Tools

local interpreter remote machines

 
 
hokieghal99
Guest
Posts: n/a
 
      01-05-2004
This may not be possible, but I thought I'd ask anyway. Could I get the
below code to run on a Python server where other machines would connect
to it (say thru the Web) and get details of *their* system instead of
the system details of the machine that the interpreter is running on?
Any ideas?

Thanks!!!

import os
import socket

x = os.uname()
y = socket.gethostbyaddr(x[1])
print
print "This is the connecting machine's os:", x[0]
print "This is the connecting machine's os version:", x[2]
print "This is the connecting machine's IP address:", y[2]
print

 
Reply With Quote
 
 
 
 
Paul Rubin
Guest
Posts: n/a
 
      01-05-2004
hokieghal99 <(E-Mail Removed)> writes:
> This may not be possible, but I thought I'd ask anyway. Could I get
> the below code to run on a Python server where other machines would
> connect to it (say thru the Web) and get details of *their* system
> instead of the system details of the machine that the interpreter is
> running on? Any ideas?


In general, what you're asking for is called OS fingerprinting. It's
an active topic in security research. Figuring out a remote system's
OS is the first step towards breaking into it, so there's a slow but
growing effort among OS implementers to thwart attempts at
fingerprinting.

In simple cases, though, you can do stuff like connect to the remote
IP address's port 80 and see if you can get any HTTP server headers to
examine, and stuff like that.

OS's also leave inadvertent fingerprints, like the "randomly
generated" TCP sequence numbers which have detectable statistical
patterns on some systems. If you can detect such a pattern, that
often lets you identify the remote OS.
 
Reply With Quote
 
 
 
 
Irmen de Jong
Guest
Posts: n/a
 
      01-05-2004
hokieghal99 wrote:

> This may not be possible, but I thought I'd ask anyway. Could I get the
> below code to run on a Python server where other machines would connect
> to it (say thru the Web) and get details of *their* system instead of
> the system details of the machine that the interpreter is running on?
> Any ideas?


If you also have Python running on the other machine,
you can do this very easily with Pyro: http://pyro.sourceforge.net
(no network programming necessary at all).

Essentially you create an object on the remote machine that contains
a method with the code you want to execute, and you call that object
-using Pyro- as if it was located on your own computer.

But this only works if you have a supported Python version running
on the remote machine, and that you are allowed to connect to that
machine over the network.

You can even create some python code on your local machine, and
actually submit that to the other machine, let it deal with it,
and then get the results back.
But only do this if you know that no unauthorised user can do this,
because this is a security risk.

--Irmen de Jong.
 
Reply With Quote
 
hokiegal99
Guest
Posts: n/a
 
      01-05-2004
Irmen de Jong wrote:
> hokieghal99 wrote:
>
>> This may not be possible, but I thought I'd ask anyway. Could I get
>> the below code to run on a Python server where other machines would
>> connect to it (say thru the Web) and get details of *their* system
>> instead of the system details of the machine that the interpreter is
>> running on? Any ideas?

>
>
> If you also have Python running on the other machine,
> you can do this very easily with Pyro: http://pyro.sourceforge.net
> (no network programming necessary at all).
>
> Essentially you create an object on the remote machine that contains
> a method with the code you want to execute, and you call that object
> -using Pyro- as if it was located on your own computer.
>
> But this only works if you have a supported Python version running
> on the remote machine, and that you are allowed to connect to that
> machine over the network.
>
> You can even create some python code on your local machine, and
> actually submit that to the other machine, let it deal with it,
> and then get the results back.
> But only do this if you know that no unauthorised user can do this,
> because this is a security risk.
>
> --Irmen de Jong.


Thank you, this is exactly what I was looking for!



 
Reply With Quote
 
Irmen de Jong
Guest
Posts: n/a
 
      01-05-2004
hokiegal99 wrote:

> Irmen de Jong wrote:
> [...about Pyro...]
> Thank you, this is exactly what I was looking for!


While Pyro may be of help (I'm sure it will be you
should not forget that there are many other ways to do
what you want.
For instance, you could also create a simple web server
application on the remote machine that has a page on which
those data about the remote machine are written.
You can then get the data from the web page using the
urllib module.

For really good advice you will have to tell a lot
more about what you want exactly (and how it should work)...

Good luck!

--Irmen
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unlocking and reenabling a local account on multiple machines Simon Perl Misc 3 07-02-2007 12:46 PM
Python embedded interpreter: how to initialize the interpreter ? ycollet@freesurf.fr Python 3 01-03-2007 01:00 AM
all ip addresses of machines in the local network damacy Python 31 09-01-2006 06:17 AM
Remote Assistance fails to connect, remote remote host name could not be resolved Peter Sale Wireless Networking 1 12-11-2004 09:09 PM
Enumerating machines on the local network? Simon Brown Python 0 05-06-2004 08:29 AM



Advertisments